From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24221: 25.1.50; binding anonymous functions to keys cause help buffer navigation errors Date: Mon, 03 Oct 2016 19:33:50 -0400 Message-ID: <87ponhxb1d.fsf@users.sourceforge.net> References: <95980cc0-0429-449a-8e98-e629b2e885b8@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1475537681 11121 195.159.176.226 (3 Oct 2016 23:34:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Oct 2016 23:34:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 24221@debbugs.gnu.org, peder@klingenberg.no, Zachary Kanfer To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 04 01:34:36 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brCkX-0000Tm-HJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Oct 2016 01:34:21 +0200 Original-Received: from localhost ([::1]:39508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brCkT-0001iE-2p for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Oct 2016 19:34:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brCkJ-0001hx-3g for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2016 19:34:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brCkF-0007rX-O8 for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2016 19:34:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brCkF-0007rF-Jx for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2016 19:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1brCkF-0001Z1-B2 for bug-gnu-emacs@gnu.org; Mon, 03 Oct 2016 19:34:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Oct 2016 23:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24221 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24221-submit@debbugs.gnu.org id=B24221.14755376095945 (code B ref 24221); Mon, 03 Oct 2016 23:34:03 +0000 Original-Received: (at 24221) by debbugs.gnu.org; 3 Oct 2016 23:33:29 +0000 Original-Received: from localhost ([127.0.0.1]:43469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brCjg-0001Xk-Qg for submit@debbugs.gnu.org; Mon, 03 Oct 2016 19:33:29 -0400 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:35740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brCjf-0001XO-4V; Mon, 03 Oct 2016 19:33:27 -0400 Original-Received: by mail-it0-f43.google.com with SMTP id r192so130130336ita.0; Mon, 03 Oct 2016 16:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Si8LGvDxNvN81rCHix9astDdfj+XUiV7UCJzHupysdY=; b=e80yZIjtJO0A41vH34e9cE6Q0oDHGTBuWc8xHeKIB8xly1S9qLdmjHiiwWYfNCd2pj 4O/nF1OJgZGyyCCWRKoGZATv5eVLaqD9WWW/iPVmSYC+E3ufrt263kEgDSIoN5ua1T9O zQ5CfjOTrwb4A1LMio3Ks7ffnwp6jPaegMzgv08RIwvNbZizhzC3CPJJCewYfPSlX/in bmiXKYZFk4yejWXsK3RcSBAhSNPWd9fIFI+QA/FBY0egDotukdK/YXYQ6szLUcEMNog3 hOOPjY7VAp0fMXmp2bKcKStuo/KDcdTcaEuU6qkx/wXcfvNKtUqGlbRY3yrD+EZ/O2UR Hxqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Si8LGvDxNvN81rCHix9astDdfj+XUiV7UCJzHupysdY=; b=OgyLLtDrTv14sFmfYgqjiVLz4DkPjtoKx0mctUEMfmHrL6Vxc80AI6mUVmRPYZLuMl hHaTgHjqBlnX0G9jv6qw2hCuAXLHRYhzaDuA2+TNCPE01uYeotgxtGjhRKIt7/3+t/2a 90wXwO0D+K7iwhSK9uxkwhsS1vOUcIOmhXsz/SuDVI8ONxlK8JkJ6HUPLX5SscZtgprD 5fJhXTVH+mOobJM2BgD1e4U97G1EscAv/OVsjBlbtmGkiWtWwfEcDflEp5oOEVQoZnLC 1/l3rAWHxDx5tz6lF6vWVK6e1/DV2PZDtjClBngcJEsD4+E5tCA+eaf4G0cj9hgtuepW pWnA== X-Gm-Message-State: AA6/9RnUEPbnER4bp322cywFJ1CE+9CTO+4qeb3oYGVzaqzYBPe3QOCDdr8KNi7zJnBb3A== X-Received: by 10.36.210.70 with SMTP id z67mr19347241itf.67.1475537601328; Mon, 03 Oct 2016 16:33:21 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id t14sm491363itb.22.2016.10.03.16.33.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Oct 2016 16:33:20 -0700 (PDT) In-Reply-To: (Drew Adams's message of "Fri, 16 Sep 2016 10:43:46 -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" Xref: news.gmane.org gmane.emacs.bugs:123986 Archived-At: --=-=-= Content-Type: text/plain tags 24221 patch quit Drew Adams writes: > > 2. Someone changed `describe-function' so that it now barfs > if its arg is not a function symbol. Yes, seems to have been 82d0f42a "* lisp/help-fns.el (describe-function): More type checking[...]". I think it was an accident: the non-interactive case wasn't considered, probably because the docstring doesn't mention it. Here's a patch that moves the checks into the interactive form and updates the docstring: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=v1-0001-Let-describe-function-work-for-lambda-again.patch Content-Description: patch >From 7dffe1868222f33c8845cac7b5e46836149c72f8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 3 Oct 2016 18:49:56 -0400 Subject: [PATCH v1] Let describe-function work for lambda again Since commit "* lisp/help-fns.el (describe-function): More type checking[...]", `describe-function' throws a user-error when given a non-symbol. This prevents the [back] button in a *Help* buffer from working when the page it goes back to describes an anonymous function (e.g., the result of `describe-key' on a key which is bound to a lambda form). * lisp/help-fns.el (describe-function): Move the checks on FUNCTION being an fbound symbol into the `interactive' form. This allows non-interactive calls to pass an anonymous function (Bug #24221). Note that passing a non-bound symbol non-interactively will still trigger a `void-function' error from `describe-function-1'. --- lisp/help-fns.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 26d8839..7dfa670 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -50,23 +50,24 @@ describe-function-orig-buffer ;;;###autoload (defun describe-function (function) - "Display the full documentation of FUNCTION (a symbol)." + "Display the full documentation of FUNCTION (a symbol). +When called from lisp, FUNCTION may also be a function object." (interactive - (let ((fn (function-called-at-point)) - (enable-recursive-minibuffers t) - val) - (setq val (completing-read (if fn - (format "Describe function (default %s): " fn) - "Describe function: ") - obarray 'fboundp t nil nil - (and fn (symbol-name fn)))) - (list (if (equal val "") - fn (intern val))))) - (or (and function (symbolp function)) - (user-error "You didn't specify a function symbol")) - (or (fboundp function) - (user-error "Symbol's function definition is void: %s" function)) - + (let* ((fn (function-called-at-point)) + (enable-recursive-minibuffers t) + (val (completing-read + (if fn + (format "Describe function (default %s): " fn) + "Describe function: ") + obarray 'fboundp t nil nil + (and fn (symbol-name fn))))) + (unless (equal val "") + (setq fn (intern val))) + (unless (and fn (symbolp fn)) + (user-error "You didn't specify a function symbol")) + (unless (fboundp fn) + (user-error "Symbol's function definition is void: %s" fn)) + (list fn))) ;; We save describe-function-orig-buffer on the help xref stack, so ;; it is restored by the back/forward buttons. 'help-buffer' ;; expects (current-buffer) to be a help buffer when processing -- 2.9.3 --=-=-=--