Subject: bug#22716: 25.0.91; describe-key causes an error for lambda functions after loading mode-local

From: Kaushal Modi <[email-masked]>
Date: Sun, 20 Mar 2016 15:38:30 -0400

Hi all,

Here is my attempt at fixing this bug:

>From 3e320b4929710880e352ecbd749e77a20bfef3fe Mon Sep 17 00:00:00 2001
From: Kaushal Modi <[email-masked]>
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