diff options
author | Sam Steingold <sds@gnu.org> | 2014-07-08 11:35:29 -0400 |
---|---|---|
committer | Sam Steingold <sds@gnu.org> | 2014-07-08 11:35:29 -0400 |
commit | a897d1b1febb05b7d45d51351356f25e3c0c0b89 (patch) | |
tree | 77742f7dfb0713f8bcf3bf5a319147c45bca549f /lisp/progmodes/inf-lisp.el | |
parent | 96f17a2f73d1a29c7cdc279daa1fb7f1b7f58aff (diff) | |
download | emacs-a897d1b1febb05b7d45d51351356f25e3c0c0b89.tar.gz emacs-a897d1b1febb05b7d45d51351356f25e3c0c0b89.tar.bz2 emacs-a897d1b1febb05b7d45d51351356f25e3c0c0b89.zip |
New user commands, similar to what is available in ESS
* lisp/progmodes/inf-lisp.el (lisp-eval-paragraph, lisp-eval-form-and-next):
New user commands.
Diffstat (limited to 'lisp/progmodes/inf-lisp.el')
-rw-r--r-- | lisp/progmodes/inf-lisp.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 5419a6dbdb8..ba64ae31844 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el @@ -112,6 +112,8 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword (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) @@ -311,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." @@ -361,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." |