From: Drew Adams <drew.adams@oracle.com>
To: Phil Sainty <psainty@orcon.net.nz>, Noam Postavsky <npostavs@gmail.com>
Cc: Stephen Berman <stephen.berman@gmx.net>,
32212@debbugs.gnu.org,
bug-gnu-emacs
<bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org>
Subject: bug#32212: 26; `subword-mode' doc string shows empty key-binding list
Date: Sun, 22 Jul 2018 18:01:54 -0700 (PDT) [thread overview]
Message-ID: <1fd3e236-7840-4115-bce8-a5d9201af2ce@default> (raw)
In-Reply-To: <709db299cf7a15791e4f342e2efa4993@webmail.orcon.net.nz>
> > Aha, then we should just remove it from the docstring, right?
>
> Would it be better if the \\{some-keymap} substitution handled the
> case where there were no bindings, and printed nothing?
No. A doc string can introduce the list of bindings any
way its author wants. We cannot predict what text might
precede or follow the text \\{some-keymap}.
We already handle the case where the keymap is not
defined at all, by substituting this particular text:
Uses keymap 'foo-map', which is not currently defined.
And that's not ideal either, because it, like your
suggestion (but in a different way) assumes something
about the surrounding context.
(defvar foo-map (make-keymap) "...")
(defun foo ()
"The key bindings are:
\\{foo-map}
For more info..."
42)
`C-h f foo'
,----
| foo is a Lisp function in `...'.
|
| (foo)
|
| The key bindings are:
|
| key binding
| --- -------
|
|
| For more info...
`----
(makunbound 'foo-map)
`C-h f foo'
,----
| foo is a Lisp function in `...'.
|
| (foo)
|
| The key bindings are:
|
|
| Uses keymap 'foo-map', which is not currently defined.
|
| For more info...
`----
With your suggestion:
,----
| foo is a Lisp function in `...'.
|
| (foo)
|
| The key bindings are:
|
|
| For more info...
`----
> That would then account for edge-cases where users add custom
> bindings to a previously-empty keymap, or clobber a populated keymap
> entirely.
I think what we have now is clearest for such cases.
It indicates that (1) the keymap is defined and (2) it
is empty - it has no defined bindings.
Printing nothing is much less clear, I think.
Arguably, the no-keymap case could be handled a bit
better. It might not be clear to users just what "not
currently defined" is supposed to mean. It might be
more accurate to say that the function uses `foo-map',
which is not a variable whose value is a keymap.
(Although the "currently" in the message now presumably
hints that it might become defined when a file is loaded
or some other initialization is done. That's useful.)
next prev parent reply other threads:[~2018-07-23 1:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-19 15:10 bug#32212: 26; `subword-mode' doc string shows empty key-binding list Drew Adams
2018-07-20 0:58 ` Noam Postavsky
2018-07-20 7:01 ` Eli Zaretskii
2018-07-20 8:38 ` Stephen Berman
2018-07-22 20:22 ` Noam Postavsky
2018-07-22 22:36 ` Phil Sainty
2018-07-23 1:01 ` Drew Adams [this message]
2018-07-23 4:15 ` Phil Sainty
2018-07-23 4:19 ` Drew Adams
2018-07-23 2:26 ` Eli Zaretskii
2018-07-23 12:22 ` Noam Postavsky
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=1fd3e236-7840-4115-bce8-a5d9201af2ce@default \
--to=drew.adams@oracle.com \
--cc=32212@debbugs.gnu.org \
--cc=bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org \
--cc=npostavs@gmail.com \
--cc=psainty@orcon.net.nz \
--cc=stephen.berman@gmx.net \
/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).