[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lisp-interaction-mode binding RET
From: |
Kevin Rodgers |
Subject: |
Re: lisp-interaction-mode binding RET |
Date: |
Mon, 04 Aug 2003 14:12:35 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Peter Seibel wrote:
So I just installed 21.3 (after having been using Xemacs for a while).
I was immediately confused by the behavior of RET in
lisp-interaction-mode. Sometimes it is bound to newline as I'd expect;
other times it's bound to last-sexp-toggle-display...
Another odd thing is the way it's implemented. Every region that binds
last-sexp-toggle-display via the keymap text property has its own copy
of an admittedly small sparse keymap. If those regions shared a keymap,
the user could customize it with other bindings:
*** emacs-21.3/lisp/emacs-lisp/lisp-mode.el.orig Wed Jul 3 05:45:47 2002
--- emacs-21.3/lisp/emacs-lisp/lisp-mode.el Mon Aug 4 14:09:24 2003
***************
*** 320,339 ****
(terpri)))
(defun last-sexp-setup-props (beg end value alt1 alt2)
"Set up text properties for the output of `eval-last-sexp-1'.
BEG and END are the start and end of the output in current-buffer.
VALUE is the Lisp value printed, ALT1 and ALT2 are strings for the
alternative printed representations that can be displayed."
- (let ((map (make-sparse-keymap)))
- (define-key map "\C-m" 'last-sexp-toggle-display)
- (define-key map [down-mouse-2] 'mouse-set-point)
- (define-key map [mouse-2] 'last-sexp-toggle-display)
(add-text-properties
beg end
`(printed-value (,value ,alt1 ,alt2)
mouse-face highlight
! keymap ,map
help-echo "RET, mouse-2: toggle abbreviated display"
rear-nonsticky (mouse-face keymap help-echo
printed-value)))))
--- 320,343 ----
(terpri)))
+ (defvar last-sexp-map
+ "The local keymap for the output of `eval-last-sexp-1'."
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-m" 'last-sexp-toggle-display)
+ (define-key map [down-mouse-2] 'mouse-set-point)
+ (define-key map [mouse-2] 'last-sexp-toggle-display)
+ map))
+
(defun last-sexp-setup-props (beg end value alt1 alt2)
"Set up text properties for the output of `eval-last-sexp-1'.
BEG and END are the start and end of the output in current-buffer.
VALUE is the Lisp value printed, ALT1 and ALT2 are strings for the
alternative printed representations that can be displayed."
(add-text-properties
beg end
`(printed-value (,value ,alt1 ,alt2)
mouse-face highlight
! keymap ,last-sexp-map
help-echo "RET, mouse-2: toggle abbreviated display"
rear-nonsticky (mouse-face keymap help-echo
printed-value)))))
--
Kevin Rodgers