Lisp

Programmer

博客园 首页 新随笔 联系 订阅 管理
;;
;; File .emacs - These commands are executed when GNU emacs starts up.
;;
;; Cause the region to be highlighted and prevent region-based commands
;; from running when the mark isn't active.
(pending-delete-mode t)
(setq kill-emacs-query-functions
(list (function (lambda ()
(ding)
(y-or-n-p "Really quit? ")))))
;; Fonts are automatically highlighted.  For more information
;; type M-x describe-mode font-lock-mode
;;(global-font-lock-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; This provides customized support for writing programs in different kinds
;;;; of programming languages.
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load the C++ and C editing modes and specify which file extensions
;; correspond to which modes.
(autoload 'python-mode "python-mode" "Python editing mode." t)
(setq auto-mode-alist
(cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
(cons '("python" . python-mode) interpreter-mode-alist))
(autoload 'c++-mode "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode "c-mode" "C Editing Mode"   t)
(autoload 'java-mode "cc-mode" "Java Editing Mode" t)
;;(setq c-basic-offset 4)
;; This function is used in various programming language mode hooks below.  It
;; does indentation after every newline when writing a program.
(defun newline-indents ()
"Bind Return to `newline-and-indent' in the local keymap."
(local-set-key "\C-m" 'newline-and-indent))
;; Tell Emacs to use the function above in certain editing modes.
(add-hook 'lisp-mode-hook             (function newline-indents))
(add-hook 'emacs-lisp-mode-hook       (function newline-indents))
(add-hook 'lisp-interaction-mode-hook (function newline-indents))
(add-hook 'scheme-mode-hook           (function newline-indents))
(add-hook 'c-mode-hook                (function newline-indents))
(add-hook 'c++-mode-hook              (function newline-indents))
(add-hook 'java-mode-hook             (function newline-indents))
;; Fortran mode provides a special newline-and-indent function.
(add-hook 'fortran-mode-hook
(function (lambda ()
(local-set-key "\C-m" 'fortran-indent-new-line))))
;; Text-based modes (including mail, TeX, and LaTeX modes) are auto-filled.
(add-hook 'text-mode-hook (function turn-on-auto-fill))
;; This is how emacs tells the file type by the file suffix.
(setq auto-mode-alist
(append '(("\\.mss$" . scribe-mode))
'(("\\.bib$" . bibtex-mode))
'(("\\.tex$" . latex-mode))
'(("\\.obj$" . lisp-mode))
'(("\\.st$"  . smalltalk-mode))
'(("\\.Z$"   . uncompress-while-visiting))
'(("\\.cs$"  . java-mode))
'(("\\.C$"   . c++-mode))
'(("\\.cc$"  . c++-mode))
'(("\\.icc$" . c++-mode))
'(("\\.cpp$" . c++-mode))
'(("\\.java$". java-mode))
'(("\\.c$"   . c-mode))
'(("\\.y$"   . c-mode))
'(("\\.h$"   . c++-mode))
auto-mode-alist))
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "k&r")
(c-toggle-auto-state)))
(add-hook 'java-mode-hook
'(lambda ()
(c-set-style "java")
(c-toggle-auto-state)))
(add-hook 'c++-mode-hook
'(lambda ()
(c-set-style "stroustrup")
(c-toggle-auto-state)))
(lambda nil (c-set-offset 'inline-open 0))
;; Added by He,Fei
(setq make-backup-files nil)
(setq auto-save-default nil)
;;(setq tab-width 4)
;;(setq column-number-mode t)
;; restore a window
(defun w32-restore-frame ()
"Restore a minimized frame"
(interactive)
(w32-send-sys-command 61728))
(defun w32-maximize-frame ()
"Maximize the current frame"
(interactive)
(w32-send-sys-command 61488))
(and window-system
(setq screen-width (x-display-pixel-width)
screen-height (x-display-pixel-height)))
;; window size and initial position
(set-frame-height (selected-frame) 32)
(set-frame-width (selected-frame) 95)
(set-frame-position (selected-frame) 0 0)
;; highlighting and show paren matching
(transient-mark-mode t)
(show-paren-mode 1)
;; For Allegero CL
;; (load "d:/Program Files/acl80-express/eli/fi-site-init.el")
;; (defun run-lisp ()
;;   (interactive)
;;   (fi:common-lisp "*common-lisp*"
;;                   "d:/program files/acl80-express/"
;;                   "d:/program files/acl80-express/mlisp.exe"
;;                   '("+B" "+cn")
;;                   "localhost"
;;                   "d:/program files/acl80-express/mlisp.dxl"))
;; (autoload 'common-lisp-indent-function "cl-indent")
;; (setq lisp-indent-function 'common-lisp-indent-function)
;; Set up SLIME
;; Note: I set %PATH% variable to include mlisp.exe, for (shell-command) has
;; problem with with spaces in absolute path of a executive.
;; The overall flow of starting slime seems like this:
;; first (mlisp option slime.lisp port) : start a server
;; then  (slime-connect host port)      : connect to a existing server
(defvar *slime-path* "d:/Test/Fei/slime/")
(defvar *common-lisp-program* "mlisp.exe")
(push *slime-path* load-path)
(require 'slime)
(slime-setup)
(setq slime-multiprocessing t)
(setq *slime-lisp* *common-lisp-program*)
(setq *slime-port* 9000)
(defun slime ()
(interactive)
(shell-command
(format "%s +B +cm -L c:/slime.lisp -- -p %s&"
*slime-lisp* *slime-port*))
(delete-other-windows)
(while (not (ignore-errors (slime-connect "localhost" *slime-port*)))
(sleep-for 0.2)))
(global-set-key
[(f5)]
'(lambda ()
(interactive)
(shell-command
(format "%s +B +cm -L c:/slime.lisp -- -p %s&"
*slime-lisp* *slime-port*))
(delete-other-windows)
(while (not (ignore-errors (slime-connect "localhost" *slime-port*)))
(sleep-for 0.2))))
;; End of file.

c:/slime.lisp

(load "d:/Test/Fei/slime/swank-loader.lisp")
(sys:with-command-line-arguments (("p" :short port :required))
(restvar)
(swank::create-swank-server (parse-integer port :junk-allowed nil)
:spawn #'swank::simple-announce-function t))
posted on 2006-06-19 15:19  fei  阅读(645)  评论(0编辑  收藏  举报