unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: peder@klingenberg.no, Zachary Kanfer <zkanfer@gmail.com>
Cc: 24221@debbugs.gnu.org
Subject: bug#24221: 25.1.50; binding anonymous functions to keys cause help buffer navigation errors
Date: Sat, 17 Sep 2016 11:28:47 -0700 (PDT)	[thread overview]
Message-ID: <1a54fc94-0550-420a-8160-51c2e81e5355@default> (raw)
In-Reply-To: <cbf5bf33-74c4-4ab1-8a9b-bb4ce4f554a8@default>

I suggest using code such as that below - allow FUNCTION to be
`functionp', not only a symbol that is `fboundp' (and test for
the former first).

Also, the function that raises an error should be `user-error'
only when called interactively.  Otherwise, it should be `error'.

[I would even argue that for interactive use it should be
`message', not `user-error', as that allows `describe-function'
to be used, e.g., in the minibuffer to get help on different
function-name candidates.]

(let* ((interactivep  (called-interactively-p 'interactive))
       (err-fn        (if interactivep #user-error #'error)))
  (if (and interactivep  (not function))
      (funcall err-fn "You did not specify a function symbol")
    (if (not (or (functionp function) ; Allow anonymous functions.
                 (and function   ; Allow macros and special forms.
                      (fboundp (intern-soft function))))))
        (funcall err-fn "Not a defined function: `%S'" function)
    (help-setup-xref ...)
    ...)





  reply	other threads:[~2016-09-17 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14  0:59 bug#24221: 25.1.50; binding anonymous functions to keys cause help buffer navigation errors Zachary Kanfer
2016-08-28 20:07 ` Peder O. Klingenberg
2016-08-28 21:56   ` Drew Adams
2016-09-16 17:43     ` Drew Adams
2016-09-17 18:28       ` Drew Adams [this message]
2016-10-03 23:33       ` npostavs
2016-10-22  2:48         ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=1a54fc94-0550-420a-8160-51c2e81e5355@default \
    --to=drew.adams@oracle.com \
    --cc=24221@debbugs.gnu.org \
    --cc=peder@klingenberg.no \
    --cc=zkanfer@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).