all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: 22716@debbugs.gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>,
	Stephen Leake <stephen_leake@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	[thread overview]
Message-ID: <CAFyQvY2KeauaSwsoqz5ZqsnhGS1uJ7ZXWaqNc57vMYtfHx3=VA@mail.gmail.com> (raw)
In-Reply-To: <CAHbQ=cU4bEvuy_S0K1SxnY8ngHOTbCF4VZoOxHLaw42dS=4daQ@mail.gmail.com>

[-- 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 --]

  reply	other threads:[~2016-03-20 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-04-05 12:43   ` Kaushal Modi
2016-04-05 21:58     ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY2KeauaSwsoqz5ZqsnhGS1uJ7ZXWaqNc57vMYtfHx3=VA@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=22716@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.