unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: lisp-interaction-mode binding RET
Date: Mon, 04 Aug 2003 14:12:35 -0600	[thread overview]
Message-ID: <3F2EBE33.8010208@yahoo.com> (raw)
In-Reply-To: mailman.66.1060024420.29551.bug-gnu-emacs@gnu.org

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

       reply	other threads:[~2003-08-04 20:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.66.1060024420.29551.bug-gnu-emacs@gnu.org>
2003-08-04 20:12 ` Kevin Rodgers [this message]
2003-08-04 18:23 lisp-interaction-mode binding RET Peter Seibel
2003-08-06  3:05 ` Richard Stallman
2003-08-06  4:19   ` Peter Seibel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F2EBE33.8010208@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).