unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* lisp-interaction-mode binding RET
@ 2003-08-04 18:23 Peter Seibel
  2003-08-06  3:05 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Seibel @ 2003-08-04 18:23 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2003-07-17 on xeon
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.iso885915
  locale-coding-system: iso-latin-9
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

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. That seems
contrary to both the principle of least astonishment (to me anyway)
and the emacs coding standards which say:

  * Major modes must not define <RET> to do anything other than insert
    a newline. The command to insert a newline and then indent is
    `C-j'. Please keep this distinction uniform for all major modes.

Furthermore, the behavior of last-sexp-toggle-display is pretty
strange. For instance if I type this:

  (make-list 20 'a)

in my *scratch* buffer and eval it with C-j I get this:

  (make-list 20 'a)
  (a a a a a a a a a a a a ...)

Now if I put my cursor on the opening parentheses of the list of a's
and hit return I get an error:

  Wrong type argument: integer-or-marker-p, nil

from last-sexp-toggle-display. Then I move the cursor into the list
and l-s-t-d seems to work--it expands and contrats the list. But since
the binding of RET to l-s-t-d seems to be attached to the characters
themselves even more fun awaits. If I kill and then yank the two lines
so I have this:

  (make-list 20 'a)
  (a a a a a a a a a a a a ...)

  (make-list 20 'a)
  (a a a a a a a a a a a a ...)

And then I put the cursor at the beginning of the line containing the
second list of a's and type some stuff, giving me this:

  (make-list 20 'a)
  (a a a a a a a a a a a a ...)

  (make-list 20 'a)
  Type a bunch of stuff here(a a a a a a a a a a a a ...)


Then when I hit RET, l-s-t-d expands the list and wipes out everything
back to the original list leaving me with this:

  (make-list 20 'a)
  (a a a a a a a a a a a a ...)(a a a a a a a a a a a a a a a a a a a a)

This is all with GNU Emacs 21.3.1 running on Linux.

Bug? Feature? I'm hallucinating?

-Peter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lisp-interaction-mode binding RET
       [not found] <mailman.66.1060024420.29551.bug-gnu-emacs@gnu.org>
@ 2003-08-04 20:12 ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-08-04 20:12 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lisp-interaction-mode binding RET
  2003-08-04 18:23 Peter Seibel
@ 2003-08-06  3:05 ` Richard Stallman
  2003-08-06  4:19   ` Peter Seibel
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2003-08-06  3:05 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Can you suggest another key binding to use for last-sexp-toggle-display
instead of RET?

      (make-list 20 'a)
      (a a a a a a a a a a a a ...)

    Now if I put my cursor on the opening parentheses of the list of a's
    and hit return I get an error:

      Wrong type argument: integer-or-marker-p, nil

That bug seems to have been fixed in the latest sources in CVS.

      (make-list 20 'a)
      Type a bunch of stuff here(a a a a a a a a a a a a ...)


    Then when I hit RET, l-s-t-d expands the list and wipes out everything
    back to the original list leaving me with this:

      (make-list 20 'a)
      (a a a a a a a a a a a a ...)(a a a a a a a a a a a a a a a a a a a a)

That also seems to have been fixed.

    This is all with GNU Emacs 21.3.1 running on Linux.

Linux alone is not a sufficient platform to run Emacs.  You need the
whole GNU/Linux system.

We worked for many years to develope the GNU system before Linux was
even thought of.  If you call the whole system "Linux", you're giving
its principal developers none of the credit.  Would you please call it
"GNU/Linux"?  See http://www.gnu.org/gnu/gnu-linux-faq.html for more
explanation.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lisp-interaction-mode binding RET
  2003-08-06  3:05 ` Richard Stallman
@ 2003-08-06  4:19   ` Peter Seibel
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Seibel @ 2003-08-06  4:19 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Richard Stallman <rms@gnu.org> writes:

> Can you suggest another key binding to use for last-sexp-toggle-display
> instead of RET?

Dunno. Something I'm not already trying to use for something else like
entering new lines. ;-) I'm not sure I understand the binding for
last-sexp-toggle-display fits into things--it doesn't *seem* to be
part of the major mode (i.e. it's not listed as a binding when I type
C-h m) so I'm not sure what conventions it's supposed to be following.
Maybe ESC RET on the pattern of ESC TAB which the major mode already
uses?

Anyway, I noticed this problem because I was trying to use RET to
enter a new line in the middle of a longish list (like the value of
load-path) that I had just dumped into my *scratch* buffer to see what
the heck it was and was pretty confused at what the heck was going on
since the binding didn't show up in the mode documentation (nor, as it
turns out, in the output of describe-bindings) I eventually figured
out from experiments with C-h k more or less what was going on.

>       (make-list 20 'a)
>       (a a a a a a a a a a a a ...)
> 
>     Now if I put my cursor on the opening parentheses of the list of a's
>     and hit return I get an error:
> 
>       Wrong type argument: integer-or-marker-p, nil
> 
> That bug seems to have been fixed in the latest sources in CVS.

Cool.

>       (make-list 20 'a)
>       Type a bunch of stuff here(a a a a a a a a a a a a ...)
> 
> 
>     Then when I hit RET, l-s-t-d expands the list and wipes out everything
>     back to the original list leaving me with this:
> 
>       (make-list 20 'a)
>       (a a a a a a a a a a a a ...)(a a a a a a a a a a a a a a a a a a a a)
> 
> That also seems to have been fixed.

Likewise, cool.

>     This is all with GNU Emacs 21.3.1 running on Linux.
> 
> Linux alone is not a sufficient platform to run Emacs.  You need the
> whole GNU/Linux system.
>
> We worked for many years to develope the GNU system before Linux was
> even thought of.  If you call the whole system "Linux", you're giving
> its principal developers none of the credit.  Would you please call it
> "GNU/Linux"?

My mistake. Thanks for all your hard work.

-Peter

-- 
Peter Seibel                                      peter@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-06  4:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.66.1060024420.29551.bug-gnu-emacs@gnu.org>
2003-08-04 20:12 ` lisp-interaction-mode binding RET Kevin Rodgers
2003-08-04 18:23 Peter Seibel
2003-08-06  3:05 ` Richard Stallman
2003-08-06  4:19   ` Peter Seibel

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).