;; The licence of this software is GPL version 3 ;;---------------------- Closing parens, lispm style : ;; To evaluate any sexp inside the *inferior-lisp* buffer simply by closing parens (require 'inf-lisp) ; First, an auxiliar function : (defun lispmstyle-unbalanced-parens () "Simplification of the original check-parens function in file lisp.el" (interactive) (condition-case data (scan-sexps (marker-position (process-mark (get-buffer-process (current-buffer)))) (point-max)) (scan-error () t) (error t))) ; The main part : (defun lispmstyle-close-paren (&optional N) "If the closing paren being written completes a sexp, it is sent for evaluation without using the return key." (interactive "P") (if (not N) (setq N 1)) (self-insert-command N) (if (not (lispmstyle-unbalanced-parens)) (comint-send-input))) ;; Now that the command has been defined, it is assigned to close-paren : (define-key inferior-lisp-mode-map ")" 'lispmstyle-close-paren) ; It is also necessary to redefine the function of the return key ; to make it work well with the altered closing paren. (defun lispmstyle-return (&optional N) "For sending to the lisp inferior process sexps instead of lines." (interactive "P") (if (not N) (setq N 1)) (if (lispmstyle-unbalanced-parens) (if 'ilisp (dotimes (i N) (newline-and-indent-lisp)) ; if you have ilisp installed (dotimes (i N) (newline))) ; use this if you don't have ilisp installed (progn ; This would not seem necessary, but beware it is. (goto-char (point-max)) (comint-send-input)))) ;; Now that the command has been defined, it is assigned to the return key : (define-key inferior-lisp-mode-map "\r" 'lispmstyle-return) ;;---------------------- End of closing parens lispm style.