all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Drew Adams <drew.adams@oracle.com>
Cc: 30660@debbugs.gnu.org, "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Subject: bug#30660: mention describe-bindings on (info "(emacs) Keymaps")
Date: Sat, 24 Aug 2019 00:40:34 +0200	[thread overview]
Message-ID: <CADwFkmm_=x8YzqN9Fcnbq5XZohJh-yBLNgCCRNhW+KDT9bj3Fw@mail.gmail.com> (raw)
In-Reply-To: <b764982a-da75-4de0-a0a8-54d844b81ccb@default>

Drew Adams <drew.adams@oracle.com> writes:

> `Info-make-manuals-xref' _is_ defined in
> help-fns+.el.

OK, sorry about that.  I must have missed it.

> Bottom line, if you want to add only bare-bones
> `describe-keymap' to vanilla Emacs then just
> use the attached definition.

Thanks.  I tried it, and I personally think it's a useful addition.
Maybe others disagree.  I was going to pack it up as a patch for
review but I have some questions about the code first.

> 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."

Is the purpose of SEARCH-SYMBOLS-P just to allow for calling it like this:

    (describe-keymap 'my-keymap t)
    (describe-keymap my-keymap t)

And have it work automatically?  Or am I missing something?  Also see below.

>   (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))))

I admit that I find this code a bit hard to follow.  If I understand
correctly, then most of this can be removed if we don't want to
support SEARCH-SYMBOLS-P, and instead just require that the KEYMAP
argument is a symbol.  Is that correct or am I missing something?

I'm sort of leaning towards simplifying this by removing the
SEARCH-SYMBOLS-P argument, but I might not understand the use case
here.  If I'm missing something, could you please briefly describe the
use case for that and if and why it's important to keep?

>   (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)))

Why not just say (documentation-property keymap 'variable-documentation)
without the 'RAW argument?  That should have the same effect as
passing the 'RAW argument and then calling substitute-command-keys on
the result, AFAICT.

>          (doc   (and (not (equal "" doc))  doc)))

Is this to allow us to simply say (when doc ...) below instead of
(when (not (equal "" doc)) ...) or am I missing something?

Thanks,
Stefan Kangas





  reply	other threads:[~2019-08-23 22:40 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
2019-08-23 22:40     ` Stefan Kangas [this message]
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

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

  git send-email \
    --in-reply-to='CADwFkmm_=x8YzqN9Fcnbq5XZohJh-yBLNgCCRNhW+KDT9bj3Fw@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=30660@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=jidanni@jidanni.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.