From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62867@debbugs.gnu.org, Xinyang Chen <chenxy@mit.edu>
Subject: bug#62867: segfault in describe_vector
Date: Sat, 15 Apr 2023 18:16:32 -0400 [thread overview]
Message-ID: <jwvpm84iyke.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83y1mtaqkw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Apr 2023 22:33:03 +0300")
> Stefan, can we do better than the below?
The patch looks about right to me.
Only detail is that `shadowed_by` contains a binding, so it can be
a keymap, but it can also be a lambda expression, or a keyboard macro,
so we shouldn't say "shadowed by a keymap" but just "shadowed" (unless
we go through the extra trouble of checking if it's a keymap, or if it's
a ...).
Stefan
> diff --git a/src/keymap.c b/src/keymap.c
> index efac410..b9950b9 100644
> --- a/src/keymap.c
> +++ b/src/keymap.c
> @@ -3308,13 +3308,18 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
> if (this_shadowed)
> {
> SET_PT (PT - 1);
> - static char const fmt[] = " (currently shadowed by `%s')";
> - USE_SAFE_ALLOCA;
> - char *buffer = SAFE_ALLOCA (sizeof fmt +
> - SBYTES (SYMBOL_NAME (shadowed_by)));
> - esprintf (buffer, fmt, SDATA (SYMBOL_NAME (shadowed_by)));
> - insert_string (buffer);
> - SAFE_FREE();
> + if (SYMBOLP (shadowed_by))
> + {
> + static char const fmt[] = " (currently shadowed by `%s')";
> + USE_SAFE_ALLOCA;
> + char *buffer =
> + SAFE_ALLOCA (sizeof fmt + SBYTES (SYMBOL_NAME (shadowed_by)));
> + esprintf (buffer, fmt, SDATA (SYMBOL_NAME (shadowed_by)));
> + insert_string (buffer);
> + SAFE_FREE();
> + }
> + else
> + insert_string (" (binding currently shadowed by a keymap)");
> SET_PT (PT + 1);
> }
> }
next prev parent reply other threads:[~2023-04-15 22:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-15 12:07 bug#62867: segfault in describe_vector Xinyang Chen
2023-04-15 19:33 ` Eli Zaretskii
2023-04-15 22:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-04-16 5:53 ` Eli Zaretskii
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=jwvpm84iyke.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=62867@debbugs.gnu.org \
--cc=chenxy@mit.edu \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.