]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/inf-lisp.el
Merge from emacs-24; up to 2014-07-26T12:14:42Z!schwab@linux-m68k.org
[gnu-emacs] / lisp / progmodes / inf-lisp.el
index f2578c140661dc22f7b61c87326871888d3d75d4..ba64ae318444307e168cee451623555bb67aa73e 100644 (file)
@@ -1,6 +1,7 @@
 ;;; inf-lisp.el --- an inferior-lisp mode
 
-;; Copyright (C) 1988, 1993-1994, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1993-1994, 2001-2014 Free Software Foundation,
+;; Inc.
 
 ;; Author: Olin Shivers <shivers@cs.cmu.edu>
 ;; Keywords: processes, lisp
@@ -90,12 +91,29 @@ mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
     (define-key map "\C-c\C-v" 'lisp-show-variable-documentation)
     map))
 
+(easy-menu-define
+  inferior-lisp-menu
+  inferior-lisp-mode-map
+  "Inferior Lisp Menu"
+  '("Inf-Lisp"
+    ["Eval Last Sexp" lisp-eval-last-sexp t]
+    "--"
+    ["Load File..." lisp-load-file t]
+    ["Compile File..." lisp-compile-file t]
+    "--"
+    ["Show Arglist..." lisp-show-arglist t]
+    ["Describe Symbol..." lisp-describe-sym t]
+    ["Show Documentation for Function..." lisp-show-function-documentation t]
+    ["Show Documentation for Variable..." lisp-show-variable-documentation t]))
+
 ;;; These commands augment Lisp mode, so you can process Lisp code in
 ;;; the source files.
 (define-key lisp-mode-map "\M-\C-x"  'lisp-eval-defun)     ; Gnu convention
 (define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention
 (define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun)
 (define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region)
+(define-key lisp-mode-map "\C-c\C-n" 'lisp-eval-form-and-next)
+(define-key lisp-mode-map "\C-c\C-p" 'lisp-eval-paragraph)
 (define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun)
 (define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp)
 (define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file)
@@ -200,8 +218,8 @@ This process selection is performed by function `inferior-lisp-proc'.
 Whenever \\[inferior-lisp] fires up a new process, it resets
 `inferior-lisp-buffer' to be the new process's buffer.  If you only run
 one process, this does the right thing.  If you run multiple
-processes, you can change `inferior-lisp-buffer' to another process
-buffer with \\[set-variable].")
+processes, you might need to change `inferior-lisp-buffer' to
+whichever process buffer you want to use.")
 
 (defvar inferior-lisp-mode-hook '()
   "Hook for customizing Inferior Lisp mode.")
@@ -295,6 +313,14 @@ of `inferior-lisp-program').  Runs the hooks from
 ;;;###autoload
 (defalias 'run-lisp 'inferior-lisp)
 
+(defun lisp-eval-paragraph (&optional and-go)
+  "Send the current paragraph to the inferior Lisp process.
+Prefix argument means switch to the Lisp buffer afterwards."
+  (interactive "P")
+  (save-excursion
+    (mark-paragraph)
+    (lisp-eval-region (point) (mark) and-go)))
+
 (defun lisp-eval-region (start end &optional and-go)
   "Send the current region to the inferior Lisp process.
 Prefix argument means switch to the Lisp buffer afterwards."
@@ -345,6 +371,14 @@ Prefix argument means switch to the Lisp buffer afterwards."
   (interactive "P")
   (lisp-eval-region (save-excursion (backward-sexp) (point)) (point) and-go))
 
+(defun lisp-eval-form-and-next ()
+  "Send the previous sexp to the inferior Lisp process and move to the next one."
+  (interactive "")
+  (while (not (zerop (car (syntax-ppss))))
+    (up-list))
+  (lisp-eval-last-sexp)
+  (forward-sexp))
+
 (defun lisp-compile-region (start end &optional and-go)
   "Compile the current region in the inferior Lisp process.
 Prefix argument means switch to the Lisp buffer afterwards."