GNU bug report logs - #1319
Change in where-is-internal causing describe-key problems

Previous Next

Package: emacs;

Reported by: "Geoff Gole" <geoffgole <at> gmail.com>

Date: Sun, 9 Nov 2008 03:30:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1319 in the body.
You can then email your comments to 1319 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Geoff Gole" <geoffgole <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Geoff Gole" <geoffgole <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: Change in where-is-internal causing describe-key problems
Date: Sat, 8 Nov 2008 19:19:57 -0800
The behaviour of where-is-internal has changed in CVS emacs. Enter
view mode, M-: (where-is-internal 'self-insert-command nil nil nil) :

  22.2  => ([491520] [458752] [442368] [425984] [409600]...)
  CVS   => ([(128 . 4194303)])

This change breaks describe-function-1, used internally in
describe-key, causing a bound key to be printed as a non-ascii
character in some conditions. To reproduce the problem:

  emacs -Q
  C-h k k
  Switch to the *Help* buffer
  C-h k k

where-is-internal seems to be buggy, but perhaps describe-function-1
should also be doing more checking. I'm not sure if it should handle
input of the form ([(128 . 4194303)]) or not.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 1319 <at> debbugs.gnu.org
Cc: Geoff Gole <geoffgole <at> gmail.com>
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Tue, 11 Nov 2008 10:50:06 +0100
> but perhaps describe-function-1
> should also be doing more checking.

It chokes at the very last conjunct of

	  (if (and (eq function 'self-insert-command)
		   (eq (key-binding "a") 'self-insert-command)
		   (eq (key-binding "b") 'self-insert-command)
		   (eq (key-binding "c") 'self-insert-command))

because in `help-mode' "c" is bound to `View-leave'.  IIUC, the heuristic
above should make "many" in the text

	      (princ "It is bound to many ordinary text characters.\n")

sound reasonable but apparently fails miserably when one of a, b, or c
is bound to something else.

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Geoff Gole <geoffgole <at> gmail.com>
Cc: 1319 <at> debbugs.gnu.org
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Tue, 11 Nov 2008 13:40:39 +0100
> I saw that, but I thought it was more likely to be a cheap early
> out than a test that was ever meant to be bulletproof.

Maybe you were right in thinking so, I don't know.

> This code later in the describe-function-1 should handle the case
> where that test fails but there are many keys bound to
> self-insert-command:
>
>   (when keys
>     (princ (if remapped ", which is bound to " "It is bound to "))
>     ;; If lots of ordinary text characters run this command,
>     ;; don't mention them one by one.
>     (if (< (length non-modified-keys) 10)
>         (princ (mapconcat 'key-description keys ", "))
>       (dolist (key non-modified-keys)
>         (setq keys (delq key keys)))
>       (if keys
>           (progn
>             (princ (mapconcat 'key-description keys ", "))
>             (princ ", and many ordinary text characters"))
>         (princ "many ordinary text characters"))))
>
> And indeed in 22.2, it does. But the aforementioned change in
> where-is-internal breaks it.

What precisely was the change in `where-is-internal' that broke it?

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Geoff Gole" <geoffgole <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Geoff Gole" <geoffgole <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>, 1319 <at> debbugs.gnu.org
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Tue, 11 Nov 2008 06:12:11 -0800
The change in return value described in the original report:

> The behaviour of where-is-internal has changed in CVS emacs. Enter
> view mode, M-: (where-is-internal 'self-insert-command nil nil nil) :
>
> 22.2  => ([491520] [458752] [442368] [425984] [409600]...)
> CVS   => ([(128 . 4194303)])

Unfortunately I don't have the 22.2 source at the moment to
compare what differences in the code might cause that. If it
would be helpful, I'll try to figure out how to pull them from
cvs.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Geoff Gole <geoffgole <at> gmail.com>
Cc: 1319 <at> debbugs.gnu.org
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Tue, 11 Nov 2008 20:05:50 +0100
>> The behaviour of where-is-internal has changed in CVS emacs. Enter
>> view mode, M-: (where-is-internal 'self-insert-command nil nil nil) :
>>
>> 22.2  => ([491520] [458752] [442368] [425984] [409600]...)
>> CVS   => ([(128 . 4194303)])
>
> Unfortunately I don't have the 22.2 source at the moment to
> compare what differences in the code might cause that. If it
> would be helpful, I'll try to figure out how to pull them from
> cvs.

From your previous mail I concluded that you knew the change that caused
this.  I have no idea what the cons above stands for (some optimization,
I presume) so I'm totally lost here.

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Geoff Gole <geoffgole <at> gmail.com>
Cc: 1319 <at> debbugs.gnu.org, "martin rudalics" <rudalics <at> gmx.at>
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Tue, 11 Nov 2008 22:01:51 -0500
>> 22.2  => ([491520] [458752] [442368] [425984] [409600]...)
>> CVS   => ([(128 . 4194303)])

The 22.2 answer lists generic chars (these are chars that stand for
a whole charset).  In Emacs-23, generic chars have been dropped in favor
of using char-ranges, represented a a cons cell (START . END).


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1319; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at 1319 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Geoff Gole <geoffgole <at> gmail.com>, 1319 <at> debbugs.gnu.org
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Wed, 12 Nov 2008 19:32:26 +0100
>>> 22.2  => ([491520] [458752] [442368] [425984] [409600]...)
>>> CVS   => ([(128 . 4194303)])
>
> The 22.2 answer lists generic chars (these are chars that stand for
> a whole charset).  In Emacs-23, generic chars have been dropped in favor
> of using char-ranges, represented a a cons cell (START . END).

This would deserve a NEWS entry.

Anyway, we can either replace

	  (if (and (eq function 'self-insert-command)
		   (eq (key-binding "a") 'self-insert-command)
		   (eq (key-binding "b") 'self-insert-command)
		   (eq (key-binding "c") 'self-insert-command))
	      (princ "It is bound to many ordinary text characters.\n")
	    ...

by something like

	  (if (and (eq function 'self-insert-command)
		   (catch 'plenty
		     (let ((count 0))
		       (dolist (item (where-is-internal 'self-insert-command))
			 (when (vectorp item)
			   (let ((range (elt item 0)))
			     (when (consp range)
			       (setq count (+ count (- (cdr range) (car range))))
			       (when (> count 100)
				 (throw 'plenty count)))))))))
	      (princ "It is bound to many ordinary text characters.\n")
	    ...
	
or drop that "It is bound to many ordinary text characters" stuff.

martin, who'd drop it unless someone finds a better solution.





Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Geoff Gole" <geoffgole <at> gmail.com>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #40 received at 1319-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 1319-done <at> debbugs.gnu.org
Subject: Re: bug#1319: Change in where-is-internal causing describe-key problems
Date: Sat, 15 Nov 2008 01:22:27 -0500
I checked in a slightly simpler fix to describe-function-1.  It's
probably not necessary to lose too much hair over this part of the code.




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Sat, 13 Dec 2008 15:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.