all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local
@ 2016-02-17 12:00 Sho Takemori
  2016-03-20 19:38 ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Sho Takemori @ 2016-02-17 12:00 UTC (permalink / raw)
  To: 22716

[-- Attachment #1: Type: text/plain, Size: 3117 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 4232 bytes --]

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

* bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local
  2016-02-17 12:00 bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local Sho Takemori
@ 2016-03-20 19:38 ` Kaushal Modi
  2016-04-05 12:43   ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2016-03-20 19:38 UTC (permalink / raw)
  To: 22716; +Cc: Paul Eggert, Stephen Leake

[-- Attachment #1: Type: text/plain, Size: 2673 bytes --]

Hi all,

Here is my attempt at fixing this bug:

From 3e320b4929710880e352ecbd749e77a20bfef3fe Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@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

[-- Attachment #2: Type: text/html, Size: 4370 bytes --]

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

* bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local
  2016-03-20 19:38 ` Kaushal Modi
@ 2016-04-05 12:43   ` Kaushal Modi
  2016-04-05 21:58     ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2016-04-05 12:43 UTC (permalink / raw)
  To: 22716; +Cc: Paul Eggert, Stephen Leake

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

Bump

[-- Attachment #2: Type: text/html, Size: 26 bytes --]

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

* bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local
  2016-04-05 12:43   ` Kaushal Modi
@ 2016-04-05 21:58     ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2016-04-05 21:58 UTC (permalink / raw)
  To: 22716-done, Sho Takemori; +Cc: Kaushal Modi

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

I installed the attached patch, which should fix the problem. Thanks for 
reporting it.

[-- Attachment #2: 0001-Avoid-describe-key-error-with-lambdas.patch --]
[-- Type: application/x-patch, Size: 1659 bytes --]

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

end of thread, other threads:[~2016-04-05 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 12:00 bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local Sho Takemori
2016-03-20 19:38 ` Kaushal Modi
2016-04-05 12:43   ` Kaushal Modi
2016-04-05 21:58     ` Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.