* Difference between help-form and minibuffer-help-form
@ 2020-04-30 6:04 Marcin Borkowski
2020-04-30 20:16 ` Michael Heerdegen
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2020-04-30 6:04 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi all,
I tried this:
--8<---------------cut here---------------start------------->8---
(defun read-string-with-help (help &rest args)
"Call `read-string' with `C-h' displaying HELP."
(let ((minibuffer-help-form help))
(apply #'read-string args)))
(defun demo-read-string-with-help ()
(interactive)
(message "%s" (read-string-with-help "this is help" "prompt: ")))
--8<---------------cut here---------------end--------------->8---
and it works like a charm. However, I'm not sure why binding to
help-form (not minibuffer-help-form) in `read-string-with-help' above
doesn't work. My guess is that `help-form' is bound locally in the
current buffer, and this would work for e.g. `read-char' (as the manual
suggests), but minibuffer is a separate buffer, so the (local) binding
of `help-char' wouldn't work there.
Am I correct?
TIA,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Difference between help-form and minibuffer-help-form
2020-04-30 6:04 Difference between help-form and minibuffer-help-form Marcin Borkowski
@ 2020-04-30 20:16 ` Michael Heerdegen
0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2020-04-30 20:16 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski <mbork@mbork.pl> writes:
> Hi all,
>
> I tried this:
>
> (defun read-string-with-help (help &rest args)
> "Call `read-string' with `C-h' displaying HELP."
> (let ((minibuffer-help-form help))
> (apply #'read-string args)))
>
> (defun demo-read-string-with-help ()
> (interactive)
> (message "%s" (read-string-with-help "this is help" "prompt: ")))
>
> and it works like a charm. However, I'm not sure why binding to
> help-form (not minibuffer-help-form) in `read-string-with-help' above
> doesn't work. My guess is that `help-form' is bound locally in the
> current buffer, and this would work for e.g. `read-char' (as the manual
> suggests), but minibuffer is a separate buffer, so the (local) binding
> of `help-char' wouldn't work there.
`help-char' or `help-form'?
It seems that locality is only a part of the solution: AFAIU
read_minibuf binds `help-form' to the binding of `minibuffer-help-form',
so the old binding of `help-form' just gets shadowed...?
Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-30 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-30 6:04 Difference between help-form and minibuffer-help-form Marcin Borkowski
2020-04-30 20:16 ` Michael Heerdegen
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).