home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / interfaces / Emacs-cl-shell / example.emacs < prev    next >
Encoding:
Text File  |  1991-04-12  |  5.9 KB  |  144 lines

  1. ;;;; This file contains example expressions that could be placed in
  2. ;;;; your personal emacs startup (.emacs) file.  It is divided into
  3. ;;;; sections corresponding to the files in the distibution.  The
  4. ;;;; lines marked ";***" should be customized for your system.
  5.  
  6.  
  7. ;;; Make sure emacs knows where to find the emacs-lisp code:
  8. (setq load-path (cons "/usr/local/emacs/extensions" load-path)) ;***
  9.  
  10.  
  11. ;;;; -----------------------------------------------------------------
  12. ;;;; cl-shell.el 
  13. ;;;; (also: cl-lucid.el, cl-clos.el, cl-pcl.el, cl-flavors.el,
  14. ;;;; cl-obvius.el, shell-history.el, source-file-extensions.lisp).
  15.  
  16. ;;; To run Common Lisp as a sub-shell inside emacs, type "M-x run-cl".
  17. ;;; To get a list of key bindings, type "C-h f cl-shell-mode", or see
  18. ;;; the file cl-shell.doc
  19.  
  20. ;;; Command for running a Common Lisp sub-shell.
  21. (setq *cl-program* "/usr/local/bin/lucid-pcl.5-89")  ;***
  22. (autoload 'run-cl "cl-shell" "" t)
  23.  
  24. ;;; Bind C-M-l globally to goto *lisp* buffer, or run lisp if it isn't
  25. ;;; running.
  26. (global-set-key "\C-\M-l" 'cl-goto-lisp-buffer)
  27. (autoload 'cl-goto-lisp-buffer "cl-shell" "" t)
  28.  
  29. ;;; Some cl-shell parameters:
  30. (setq *cl-echo-commands* t)        ;echo defuns in lisp....
  31. (setq *cl-pop-up* t)            ;see cl-shell.el
  32.  
  33. ;;; Run another lisp, with a different prompt, and send some
  34. ;;; initialization commands to it.
  35. (defun run-development-lisp ()
  36.   (interactive)
  37.   (require "cl-shell")
  38.   (let ((*cl-replacement-prompt*  "Lucid-4.0> "))  ;***
  39.     (run-cl "/usr/local/lucid-4.0"))         ;load Beta version of Lucid4.0
  40.   (cl-send-string "(load \"/usr/local/lucid-4.0/patches\")\n"))  ;***
  41.  
  42. ;;; Stuff for running OBVIUS (Object-Based Vision and Image
  43. ;;; Undertanding System).
  44. (setq *obvius-program* "/usr/local/bin/obvius")  ;***
  45. (autoload 'run-obvius  "cl-obvius" "" t)
  46.  
  47.  
  48. ;;;; -----------------------------------------------------------------
  49. ;;;; completion.el  (also always-complete.el, advise.el).
  50.  
  51. ;;; Completion code from TMC.  Default binding is M-<return>.
  52. (global-set-key "\M-\r" 'complete)
  53. (autoload 'complete "always-complete" "" t)
  54.  
  55. ;;; If you don't want the minibuffer reminders, use this line instead
  56. ;;; of the one above.
  57. ; (autoload 'complete "always-complete" "" t)
  58.  
  59.  
  60. ;;;; -----------------------------------------------------------------
  61. ;;;; misc-extensions.el
  62.  
  63. ;;; Note: you must have set your load-path (see first command in this
  64. ;;; file) for this to work!
  65. (load "misc-extensions")
  66.  
  67. ;;; Set indentation for Common Lisp
  68. (setq lisp-indent-hook 'common-lisp-indent-hook)
  69.  
  70. ;;; Some useful functions which delete excess whitespace
  71. (global-set-key "\C-x " 'delete-forward-whitespace) 
  72. (rebind-keys-which-call 'just-one-space 'my-just-one-space) ;typically M-spc
  73.  
  74. ;;; When a close-paren is typed on top of an existing paren, blink the
  75. ;;; match, but don't insert a new paren
  76. (setq blink-paren-hook
  77.       '(lambda ()
  78.      (if (and (not (eobp))
  79.           (char-equal (char-after (point)) last-input-char))
  80.          (delete-char 1))        ;UGLY - this sets modification flag!
  81.      (blink-matching-open)))
  82.  
  83. ;;; C-M-s repositions window with point or defun at top
  84. (global-set-key "\M-\C-s" 'reposition-point-at-top)
  85. (define-key lisp-mode-map "\M-\C-s" 'reposition-defun-at-top)
  86. (define-key emacs-lisp-mode-map "\M-\C-s" 'reposition-defun-at-top)
  87.  
  88. ;; Grep for symbol nearest mouse in *.lisp files.
  89. (define-key lisp-mode-map "\M-\C-g" 'cl-grep-for-symbol)
  90.  
  91. ;;; Switch bindings so that standard carriage return indents the new line:
  92. (define-key lisp-mode-map "\C-m" 'newline-and-indent)
  93. (define-key lisp-mode-map "\n" 'newline)     ;this is control-<cr> on Suns
  94. (define-key emacs-lisp-mode-map "\C-m" 'newline-and-indent)
  95. (define-key emacs-lisp-mode-map "\n" 'newline)
  96.  
  97. ;;; The next 4 expressions fix comment paragraph filling in lisp:
  98. (rebind-keys-which-call 'fill-paragraph 'lisp-fill-paragraph lisp-mode-map)
  99. (rebind-keys-which-call 'fill-paragraph 'lisp-fill-paragraph emacs-lisp-mode-map)
  100. (setq lisp-mode-hook
  101.       '(lambda () 
  102.     (message "Running lisp-mode-hook.")
  103.     (setq paragraph-start
  104.      (concat "^[ \t]*[^ ; \t]\\|^[ \t]*$\\|" (or paragraph-start "")))
  105.     (setq paragraph-separate paragraph-start)
  106.     (setq buffer-file-name
  107.           (and buffer-file-name (expand-symlinks buffer-file-name)))))
  108. (setq emacs-lisp-mode-hook
  109.       '(lambda () 
  110.     (message "Running lisp-mode-hook.")
  111.     (setq paragraph-start
  112.      (concat "^[ \t]*[^ ; \t]\\|^[ \t]*$\\|" (or paragraph-start "")))
  113.     (setq paragraph-separate paragraph-start)))
  114.  
  115. ;;; Bind C-middle-mouse to copy the sexpr under the mouse to the point.
  116. ;;; This amazingly useful!
  117. (if (and (eq window-system 'x) (= window-system-version 11))
  118.     (progn
  119.       (require 'x-mouse)    ; load this from the standard Emacs distribution
  120.    ;;; RAW:
  121.       (define-key mouse-map x-button-left       'x-mouse-set-point)
  122.       (define-key mouse-map x-button-left-up    'x-cut-text)          ;drag left
  123.       (define-key mouse-map x-button-middle     'x-paste-text)
  124.       (define-key mouse-map x-button-right      'x-cut-text)
  125.    ;;; C: deleting text (these are parallel to raw bindings)
  126.       (define-key mouse-map x-button-c-left     'x-mouse-set-point)
  127.       (define-key mouse-map x-button-c-left-up  'x-cut-and-wipe-text) ;drag C-left
  128.       (define-key mouse-map x-button-c-middle   'x-copy-sexp)
  129.       (define-key mouse-map x-button-c-right    'x-cut-and-wipe-text)
  130.    ;;; M: sexp manipulation
  131.       (define-key mouse-map x-button-m-left     'x-move-sexp)
  132.       (define-key mouse-map x-button-m-middle   'x-replace-sexp)      
  133.       (define-key mouse-map x-button-m-right    'x-zap-sexp)
  134.    ;;; S: scrolling
  135.       (define-key mouse-map x-button-s-left     'x-line-to-top)
  136.       (define-key mouse-map x-button-s-middle   'x-line-to-middle)
  137.       (define-key mouse-map x-button-s-right    'x-line-to-bottom)
  138.    ;;; M-S: window operations
  139.       (define-key mouse-map x-button-m-s-left   'x-mouse-keep-one-window)
  140.       (define-key mouse-map x-button-m-s-right  'x-mouse-select-and-split)
  141.    ;;; C-S: menus
  142.       (define-key mouse-map x-button-c-s-left   'x-buffer-menu)
  143.       (define-key mouse-map x-button-c-s-middle 'x-help)))
  144.