GNU bug report logs - #22716
25.0.91; describe-key causes an error for lambda functions after loading mode-local

Previous Next

Package: emacs;

Reported by: Sho Takemori <stakemorii <at> gmail.com>

Date: Wed, 17 Feb 2016 12:02:02 UTC

Severity: normal

Found in version 25.0.91

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 22716 in the body.
You can then email your comments to 22716 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-gnu-emacs <at> gnu.org:
bug#22716; Package emacs. (Wed, 17 Feb 2016 12:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sho Takemori <stakemorii <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 Feb 2016 12:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sho Takemori <stakemorii <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.91; describe-key causes an error for lambda functions after
 loading mode-local
Date: Wed, 17 Feb 2016 21:00:33 +0900
[Message part 1 (text/plain, inline)]
After loading "mode-local.el", describe-key causes an error for anonymous
commands.
To reproduce it, please evaluate the following code in the scratch buffer:

(progn
  (require 'mode-local)
  (global-set-key [up] (lambda () (interactive)))
  (describe-key [up]))

Best regards,
Sho Takemori

In GNU Emacs 25.0.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7)
 of 2016-02-17 built on K430-Ubuntu
Repository revision: 132dbf089ffdc6c77c9383f225f2458d21c869a5
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description: Ubuntu 15.10

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: ja_JP.UTF-8
  value of $LC_NUMERIC: ja_JP.UTF-8
  value of $LC_TIME: ja_JP.UTF-8
  value of $LANG: ja_JP.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Mark set
Entering debugger...
Back to top level
Quit

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils debug help-fns
help-mode easymenu cl-loaddefs pcase cl-lib mode-local find-func
time-date mule-util japan-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 91710 9142)
 (symbols 48 20041 0)
 (miscs 40 328 196)
 (strings 32 15383 4581)
 (string-bytes 1 450391)
 (vectors 16 12878)
 (vector-slots 8 509828 11245)
 (floats 8 166 75)
 (intervals 56 223 2)
 (buffers 976 13)
 (heap 1024 22127 862))
[Message part 2 (text/html, inline)]

Added indication that bug 22716 blocks19759 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 17 Feb 2016 19:17:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22716; Package emacs. (Sun, 20 Mar 2016 19:40:02 GMT) Full text and rfc822 format available.

Message #10 received at 22716 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: 22716 <at> debbugs.gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>,
 Stephen Leake <stephen_leake <at> stephe-leake.org>
Subject: Re: 25.0.91; describe-key causes an error for lambda functions after
 loading mode-local
Date: Sun, 20 Mar 2016 15:38:30 -0400
[Message part 1 (text/plain, inline)]
Hi all,

Here is my attempt at fixing this bug:

From 3e320b4929710880e352ecbd749e77a20bfef3fe Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi <at> gmail.com>
Date: Sun, 20 Mar 2016 15:31:08 -0400
Subject: [PATCH] Check if arg is actually a symbol (bug # 22716)

* lisp/cedet/mode-local.el (describe-mode-local-overload): Check if the
  passed argument SYMBOL is actually a symbol before proceeding with
  `(get symbol 'mode-local-overload)'. This check is required for the
  case presented in bug # 22716 where a key might be bound to a bare
  lambda interactive function instead of an interactive function symbol.

In addition, the code is re-arranged to follow the standard elisp coding
style.
---
 lisp/cedet/mode-local.el | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index c7e6615..b39567d 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -638,13 +638,13 @@ describe-function-orig-buffer

 (defun describe-mode-local-overload (symbol)
   "For `help-fns-describe-function-functions'; add overloads for SYMBOL."
-  (when (get symbol 'mode-local-overload)
+  (when (and (symbolp symbol)
+             (get symbol 'mode-local-overload))
     (let ((default (or (intern-soft (format "%s-default" (symbol-name
symbol)))
        symbol))
   (override (with-current-buffer describe-function-orig-buffer
                       (fetch-overload symbol)))
           modes)
-
       (insert (substitute-command-keys (overload-docstring-extension
symbol))
               "\n\n")
       (insert (format-message "default function: `%s'\n" default))
@@ -653,20 +653,16 @@ describe-mode-local-overload
   describe-function-orig-buffer override))
  (insert (format-message "\nno override in buffer `%s'\n"
  describe-function-orig-buffer)))
-
-      (mapatoms
-       (lambda (sym) (when (get sym 'mode-local-symbol-table) (push sym
modes)))
-       obarray)
-
+      (mapatoms (lambda (sym)
+                  (when (get sym 'mode-local-symbol-table)
+                    (push sym modes)))
+                obarray)
       (dolist (mode modes)
  (let* ((major-mode mode)
        (override (fetch-overload symbol)))
-
   (when override
     (insert (format-message "\noverride in mode `%s': `%s'\n"
-    major-mode override))
-            )))
-      )))
+    major-mode override))))))))

 (add-hook 'help-fns-describe-function-functions
'describe-mode-local-overload)

-- 
2.6.0.rc0.24.gec371ff


I have copied Stephen and Paul as I see that they have past commits in this
region of code. So they should provide a good judgement on this patch.


--
Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22716; Package emacs. (Tue, 05 Apr 2016 12:44:02 GMT) Full text and rfc822 format available.

Message #13 received at 22716 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: 22716 <at> debbugs.gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>,
 Stephen Leake <stephen_leake <at> stephe-leake.org>
Subject: Re: 25.0.91; describe-key causes an error for lambda functions after
 loading mode-local
Date: Tue, 05 Apr 2016 12:43:36 +0000
[Message part 1 (text/plain, inline)]
Bump
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 05 Apr 2016 21:59:01 GMT) Full text and rfc822 format available.

Notification sent to Sho Takemori <stakemorii <at> gmail.com>:
bug acknowledged by developer. (Tue, 05 Apr 2016 21:59:02 GMT) Full text and rfc822 format available.

Message #18 received at 22716-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 22716-done <at> debbugs.gnu.org, Sho Takemori <stakemorii <at> gmail.com>
Cc: Kaushal Modi <kaushal.modi <at> gmail.com>
Subject: Re: 25.0.91; describe-key causes an error for lambda functions after
 loading mode-local
Date: Tue, 5 Apr 2016 14:58:22 -0700
[Message part 1 (text/plain, inline)]
I installed the attached patch, which should fix the problem. Thanks for 
reporting it.
[0001-Avoid-describe-key-error-with-lambdas.patch (application/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 May 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 49 days ago.

Previous Next


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