From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs 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-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0160c90850a7c3052e802221 X-Trace: ger.gmane.org 1458502823 28452 80.91.229.3 (20 Mar 2016 19:40:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2016 19:40:23 +0000 (UTC) Cc: Paul Eggert , Stephen Leake To: 22716@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 20 20:40:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahjCw-0006Cy-JE for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Mar 2016 20:40:14 +0100 Original-Received: from localhost ([::1]:54248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahjCs-0008Fg-KE for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Mar 2016 15:40:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahjCn-0008Dl-TD for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 15:40:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahjCk-0003fd-Mz for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 15:40:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahjCk-0003fZ-HI for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 15:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ahjCk-0004Ae-6z for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2016 15:40:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Mar 2016 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22716 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22716-submit@debbugs.gnu.org id=B22716.145850275715974 (code B ref 22716); Sun, 20 Mar 2016 19:40:02 +0000 Original-Received: (at 22716) by debbugs.gnu.org; 20 Mar 2016 19:39:17 +0000 Original-Received: from localhost ([127.0.0.1]:55846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahjC1-00049a-7H for submit@debbugs.gnu.org; Sun, 20 Mar 2016 15:39:17 -0400 Original-Received: from mail-ob0-f174.google.com ([209.85.214.174]:34920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahjBz-00049L-La for 22716@debbugs.gnu.org; Sun, 20 Mar 2016 15:39:16 -0400 Original-Received: by mail-ob0-f174.google.com with SMTP id fp4so159843682obb.2 for <22716@debbugs.gnu.org>; Sun, 20 Mar 2016 12:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc; bh=ufBD7xYecaXsHfHXpPQE7AVb4RlK2aZ6tHWFFme0JM8=; b=aXr96qgPpfgMUQxbsUFUXbNVfvTpGW/72Jcx6xwggpYgWWDIH8O85bx9yEo1RMkwl+ PLeSG/fWAuoEXbkK0lDN6DilA04oC6dk6vE7buphcRBS26sxqA8VQ3XoJHmIoZFfK5RC ZGbnSn+HuT8dIeb7HbS3GK/G+16S/bOVPYSrzQdpDjCtacHXHtD0aKowsFjzBupLOh6r wFMjWxrZPRloz92wIlcOqzUej+eIxVFFg0wRYgvh0XvwD5c7/bNtwL5kP0U+xo/Rz/X4 p07oYl6WqkDW3VPG+LFZiXMBuUwdejpqyie1l+6fJu4IxxjMNK+r0Nr09IK94LqgmdTf hRHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=ufBD7xYecaXsHfHXpPQE7AVb4RlK2aZ6tHWFFme0JM8=; b=BjXbw2amif7ZgHI4l2STZOnWCabkVsYaN8RFt3uHlJSKj4Aa9JtAAgpt1m5iL927r6 GKABem6sNDU4EJ35ycu62iwA0DCjfmBzhGqUd2kf1v+AYmGQZq8y501HtbiEgKMxR0aD pNCA81Pp5B39C5kso6HlIWoWCojuho5fgfNDePyWdPRyhorllsocrEsXkieYyEPEa+qp JVEFkBC9wuWrCUJqfOLVlsQPz0VDSh5gxOlzU06ArkNsfmtwv4Okd3TjqQ1Lmm9C5i8N KtMZD4r3Oh/yBO56h3xC/PRXC8YIB+QK9qNgsSkn7DhdQd2cDty9CzY2eVHpvqZhErnm sT0w== X-Gm-Message-State: AD7BkJLJTzdZTwAsgcoVWdKtztH7pynx49+gPBS3SnKUkn1eF1ND1+SAnLzFZwOMvhEGz9jSw2onnb0KHrIDkQ== X-Received: by 10.182.104.138 with SMTP id ge10mr12225812obb.81.1458502749953; Sun, 20 Mar 2016 12:39:09 -0700 (PDT) Original-Received: by 10.202.172.198 with HTTP; Sun, 20 Mar 2016 12:38:30 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:115172 Archived-At: --089e0160c90850a7c3052e802221 Content-Type: text/plain; charset=UTF-8 Hi all, Here is my attempt at fixing this bug: >From 3e320b4929710880e352ecbd749e77a20bfef3fe Mon Sep 17 00:00:00 2001 From: Kaushal Modi 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 --089e0160c90850a7c3052e802221 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

Here is my attempt at fixing th= is bug:

From 3e320b4929710880e352ecbd749e77a2= 0bfef3fe 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/cede= t/mode-local.el (describe-mode-local-overload): Check if the
=C2= =A0 passed argument SYMBOL is actually a symbol before proceeding with
=C2=A0 `(get symbol 'mode-local-overload)'. This check is req= uired for the
=C2=A0 case presented in bug # 22716 where a key mi= ght be bound to a bare
=C2=A0 lambda interactive function instead= of an interactive function symbol.

In addition, t= he code is re-arranged to follow the standard elisp coding
style.=
---
=C2=A0lisp/cedet/mode-local.el | 18 +++++++-------= ----
=C2=A01 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/cede= t/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -638,= 13 +638,13 @@ describe-function-orig-buffer
=C2=A0
=C2= =A0(defun describe-mode-local-overload (symbol)
=C2=A0 =C2=A0&quo= t;For `help-fns-describe-function-functions'; add overloads for SYMBOL.= "
- =C2=A0(when (get symbol 'mode-local-overload)
<= div>+ =C2=A0(when (and (symbolp symbol)
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (get symbol 'mode-local-overload))
=C2= =A0 =C2=A0 =C2=A0(let ((default (or (intern-soft (format "%s-default&q= uot; (symbol-name symbol)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 symbol))
=C2=A0 =C2=A0(override (with-current-= buffer describe-function-orig-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(fetch-overload symb= ol)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0modes)
-=
=C2=A0 =C2=A0 =C2=A0 =C2=A0(insert (substitute-command-keys (ove= rload-docstring-extension symbol))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0"\n\n")
=C2=A0 =C2=A0 =C2=A0= =C2=A0(insert (format-message "default function: `%s'\n" def= ault))
@@ -653,20 +653,16 @@ describe-mode-local-overload
=C2=A0 =C2=A0descr= ibe-function-orig-buffer override))
=C2=A0 (insert (format-message "\nno override in= buffer `%s'\n"
=C2=A0 describe-function-orig-buffer)))
-
= - =C2=A0 =C2=A0 =C2=A0(mapatoms
- =C2=A0 =C2=A0 =C2=A0 (lambda (s= ym) (when (get sym 'mode-local-symbol-table) (push sym modes)))
- =C2=A0 =C2=A0 =C2=A0 obarray)
-
+ =C2=A0 =C2=A0 = =C2=A0(mapatoms (lambda (sym)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (get sym 'mode-local-symbol-table)=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0(push sym modes)))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0obarray)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(dolist (= mode modes)
=C2=A0 (let* ((major-mode mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (override (fetch-overload symbol= )))
-
=C2=A0= =C2=A0(when override
=C2=A0 =C2=A0 =C2=A0(insert (format-message "\noverrid= e in mode `%s': `%s'\n"
- =C2=A0 =C2=A0major-mode override))
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)))
- =C2=A0 =C2=A0 =C2= =A0)))
+ = =C2=A0 =C2=A0major-mode override))))))))
=C2=A0
=C2=A0(= add-hook 'help-fns-describe-function-functions 'describe-mode-local= -overload)
=C2=A0
--=C2=A0
2.6.0.rc0.24.gec37= 1ff


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
--089e0160c90850a7c3052e802221--