From: Drew Adams <drew.adams@oracle.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: 30660@debbugs.gnu.org, "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Subject: bug#30660: mention describe-bindings on (info "(emacs) Keymaps")
Date: Fri, 23 Aug 2019 11:44:25 -0700 (PDT) [thread overview]
Message-ID: <b764982a-da75-4de0-a0a8-54d844b81ccb@default> (raw)
In-Reply-To: <CADwFkmn7DgatQdqeEOurZ16Efa5uXBo-4uvWBaQeuLqQFpy_7A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1971 bytes --]
> > `describe-bindings' does not describe the bindings of a given
> > keymap.
> >
> > S?he should use `describe-keymap' (`C-h M-k'), from `help-fns+.el'.
> >
> > It describes the bindings in a keymap in the usual human-readable
> > way. You are prompted for a keymap variable (e.g., `ctl-x-map`),
> > with completion. (Non-interactively, the argument can be a keymap
> > itself or a keymap variable.)
> >
> > This or similar code should be in vanilla Emacs. (I've offered
> > any and all of my code.)
> >
> > https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__www.emacswiki.org_emacs_download_help-2Dfns-
> 252b.el&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=kI3P6l
> jGv6CTHIKju0jqInF6AOwMCYRDQUmqX22rJ98&m=yA0xm3W_AykCUU9THjbJlpxhVhQlA3X
> AncZSWRe2Wc0&s=P11PKX0Nhl4PaaXOh-0ZYcfDDhlprpw4pnWG5QqizvQ&e=
>
> I copied and evaluated the describe-keymap function, but when I typed
> M-x describe-keymap I got the following error:
>
> save-current-buffer: Symbol’s function definition is void:
> Info-make-manuals-xref
>
> I couldn't find the definition of a function by that name in the file
> you indicated, so I'm guessing there's some dependencies involved and
> that I don't have. Could you provide a version of this function which
> works on current master without requiring these extra packages?
`Info-make-manuals-xref' _is_ defined in
help-fns+.el. And no extra packages are needed
for help-fns+.el.
But adding the functionality of
`Info-make-manuals-xref' is not necessarily
something that vanilla Emacs would want now.
That should probably be discussed separately.
Similarly, there are other features used by
`describe-keymap' that I'm not sure you want to
add now to vanilla Emacs. And you definitely
don't need the code that supports older Emacs
versions.
Bottom line, if you want to add only bare-bones
`describe-keymap' to vanilla Emacs then just
use the attached definition.
[-- Attachment #2: throw-describe-keymap-for-vanilla.el --]
[-- Type: application/octet-stream, Size: 2324 bytes --]
(defun describe-keymap (keymap &optional search-symbols-p) ; Bound to `C-h M-k'
"Describe key bindings in KEYMAP.
Interactively, prompt for a variable that has a keymap value.
Completion is available for the variable name.
Non-interactively:
* KEYMAP can be such a keymap variable or a keymap.
* Non-nil optional arg SEARCH-SYMBOLS-P means that if KEYMAP is not a
symbol then search all variables for one whose value is KEYMAP."
(interactive (list (intern (completing-read "Keymap: " obarray
(lambda (m) (and (boundp m) (keymapp (symbol-value m))))
t nil 'variable-name-history))))
(unless (and (symbolp keymap) (boundp keymap) (keymapp (symbol-value keymap)))
(if (not (keymapp keymap))
(error "%sot a keymap%s"
(if (symbolp keymap) (format "`%S' is n" keymap) "N")
(if (symbolp keymap) " variable" ""))
(let ((sym nil))
(when search-symbols-p
(setq sym (catch 'describe-keymap
(mapatoms (lambda (symb) (when (and (boundp symb)
(eq (symbol-value symb) keymap)
(not (eq symb 'keymap))
(throw 'describe-keymap symb)))))
nil)))
(unless sym
(setq sym (gentemp "KEYMAP OBJECT (no variable) "))
(set sym keymap))
(setq keymap sym))))
(setq keymap (or (ignore-errors (indirect-variable keymap)) keymap)) ; Follow aliasing.
(let* ((name (symbol-name keymap))
(doc (let ((raw-doc (documentation-property keymap 'variable-documentation 'RAW)))
(substitute-command-keys raw-doc)))
(doc (and (not (equal "" doc)) doc)))
(help-setup-xref (list #'describe-keymap keymap) (called-interactively-p 'interactive))
(with-help-window (help-buffer)
(princ name) (terpri) (princ (make-string (length name) ?-)) (terpri) (terpri)
(when doc (princ doc) (terpri) (terpri))
;; Use `insert' instead of `princ', so control chars (e.g. \377) insert correctly.
(with-current-buffer "*Help*" (insert (substitute-command-keys (concat "\\{" name "}")))))))
next prev parent reply other threads:[~2019-08-23 18:44 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 20:25 bug#30660: mention describe-bindings on (info "(emacs) Keymaps") 積丹尼 Dan Jacobson
2018-02-28 23:29 ` Drew Adams
2019-08-23 7:18 ` Stefan Kangas
2019-08-23 18:44 ` Drew Adams [this message]
2019-08-23 22:40 ` Stefan Kangas
2019-08-24 1:46 ` Drew Adams
2019-08-24 3:01 ` Stefan Kangas
2019-08-24 15:06 ` Drew Adams
2019-10-16 22:42 ` Stefan Kangas
2019-10-14 20:28 ` Lars Ingebrigtsen
2019-10-14 20:33 ` Eli Zaretskii
2019-10-17 9:39 ` Stefan Kangas
2019-10-17 9:42 ` Stefan Kangas
2019-10-17 12:07 ` Robert Pluim
2019-10-17 13:10 ` Eli Zaretskii
2019-10-17 13:30 ` Stefan Kangas
2019-11-07 0:18 ` Stefan Kangas
2019-11-07 0:40 ` Drew Adams
2019-10-17 13:00 ` Eli Zaretskii
2019-11-07 1:00 ` Stefan Kangas
2019-11-11 15:04 ` Stefan Kangas
2019-11-14 11:12 ` Eli Zaretskii
2019-11-17 20:36 ` Stefan Kangas
2019-11-18 16:23 ` Eli Zaretskii
2019-11-19 6:07 ` Richard Stallman
2019-11-19 16:04 ` Eli Zaretskii
2019-11-17 20:51 ` Stefan Kangas
2019-11-18 16:20 ` Eli Zaretskii
2019-11-19 14:14 ` Stefan Kangas
2019-11-19 17:03 ` Eli Zaretskii
[not found] ` <87zhen2h81.fsf@marxist.se>
2020-01-17 8:07 ` Eli Zaretskii
2020-01-18 2:16 ` Stefan Kangas
2020-01-18 8:31 ` Eli Zaretskii
2020-01-18 9:12 ` Stefan Kangas
2020-01-18 9:41 ` Eli Zaretskii
2020-01-18 23:42 ` Stefan Kangas
2020-01-19 2:09 ` Drew Adams
2020-01-31 10:15 ` Eli Zaretskii
2020-02-04 1:32 ` Stefan Kangas
2019-10-14 20:50 ` Drew Adams
2019-10-16 22:48 ` Stefan Kangas
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=b764982a-da75-4de0-a0a8-54d844b81ccb@default \
--to=drew.adams@oracle.com \
--cc=30660@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=stefan@marxist.se \
/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).