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.

Full log


View this message in rfc822 format

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: bug#22716: 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)]

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.