all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Escaping a string for substitute-command-keys
Date: Fri, 04 Oct 2019 17:17:39 +0300	[thread overview]
Message-ID: <83imp461do.fsf@gnu.org> (raw)
In-Reply-To: <ab411bb8-9d72-b285-2c3f-68682a083d1f@gmail.com> (message from Clément Pit-Claudel on Fri, 4 Oct 2019 09:56:56 -0400)

> Cc: emacs-devel@gnu.org
> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Fri, 4 Oct 2019 09:56:56 -0400
> 
> > Then why do you use APIs that are meant for keys and quoted strings?
> > Why not format the message yourself?
> 
> Sorry, I do not understand what you mean.  I want to display information when the mouse hovers on a portion of the buffer.  Isn't the proper way to do that to set a help-echo property on the corresponding text?

help-echo is for displaying documentation, not for displaying
general-purpose text strings.

> The manual says nothing about command-key substitutions, it just says "If text has a string as its help-echo property, then when you move the mouse onto that text, Emacs displays that string in the echo area, or in the tooltip window (see Tooltips)."

And a little ways down from that text you have a cross-reference to
"Help display", which leads to the description of show-help-function,
and that one does say the output is passed through
substitute-command-keys.

> Really, all that I'm complaining about is this bit of code in keyboard.c:
> 
>   if (STRINGP (help) || NILP (help))
>     {
>       if (!NILP (Vshow_help_function))
> 	call1 (Vshow_help_function, Fsubstitute_command_keys (help));
>       help_echo_showing_p = STRINGP (help);
>     }
> 
> My question is why Vshow_help_function is called with its arguments passed through Fsubstitute_command_keys.

See above.

> >> Ideally, it would be best to be able to turn off that translation entirely, I think.  I see why it is convenient, but it seems wasteful to mangle a string with escapes only for these escapes to be promptly removed right after.
> > 
> > Format it yourself, and you have that, no?  Or what am I missing?
> 
> I think I've been miscommunication :/ Sorry for wasting your time.

No reason to apologize or think you were wasting my time.

> > I think you are using the wrong APIs for the job you need to do.
> > These APIs perform the substitutions for a reason: they were all
> > written for displaying documentation, not arbitrary strings.
> 
> I'm saying that these APIs are inconsistent: sometimes they do substitution, sometimes they don't.

Please tell more about these inconsistencies.  Specifically, which
APIs behave inconsistently?

> > Then don't use help-echo, use child frames instead.
> 
> Are you saying that flymake should grow its own implementation of tooltips

Tooltips by themselves don't substitute, you get in the tooltip the
exact text you've provided.  Here's an example I just trried:

  M-: (tooltip-show "foo `bar' \\[kill-buffer]") RET

The tooltip that popped up didn't do any substitutions, I see the same
text I typed.

The substitution happens specifically in generating the help-echo, and
it happens before we pop up the tooltip.

It is possible that we need to provide some additional facilities to
make this stuff more flexible in specific situations, but I think we
should first be on the same page regarding the existing facilities and
what they are intended for.



  reply	other threads:[~2019-10-04 14:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 13:52 Escaping a string for substitute-command-keys Clément Pit-Claudel
2019-10-03 16:31 ` Eli Zaretskii
2019-10-03 16:46   ` Clément Pit-Claudel
2019-10-03 17:21     ` Eli Zaretskii
2019-10-03 18:28       ` Clément Pit-Claudel
2019-10-03 18:54         ` Eli Zaretskii
2019-10-04 13:56           ` Clément Pit-Claudel
2019-10-04 14:17             ` Eli Zaretskii [this message]
2019-10-05  4:03               ` Clément Pit-Claudel
2019-10-05  7:33                 ` Eli Zaretskii
2019-10-05 15:05                   ` Stefan Monnier
2019-10-05 15:59                     ` Eli Zaretskii
2019-10-05  4:06               ` Clément Pit-Claudel
2019-10-05  7:12                 ` Eli Zaretskii
2019-10-05  8:04                   ` Clément Pit-Claudel
2019-10-05  8:13                     ` Eli Zaretskii
2019-10-05  8:24                       ` Clément Pit-Claudel
2019-10-05  9:20                         ` Eli Zaretskii
2019-10-04 19:19         ` Stefan Monnier
2019-10-05 15:40           ` Basil L. Contovounesios
2019-10-05 16:06             ` Eli Zaretskii
2019-10-05 19:53               ` Basil L. Contovounesios
2019-10-06  2:57                 ` Clément Pit-Claudel
2019-10-06 17:21                 ` 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=83imp461do.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.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.