* Using temporary buffers to display messages
@ 2012-03-29 2:36 Óscar Fuentes
2012-03-29 14:31 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Óscar Fuentes @ 2012-03-29 2:36 UTC (permalink / raw)
To: emacs-devel
`sunrise-sunset' contains this code, that displays the text on the
minibuffer if the frame is wide enough and on a temporary buffer
otherwise:
(if (<= (length msg) (frame-width))
(message "%s" msg)
(with-output-to-temp-buffer "*temp*"
(princ (concat date-string "\n" time-string)))
(message "%s"
(substitute-command-keys
(if one-window
(if pop-up-windows
"Type \\[delete-other-windows] to remove temp window."
"Type \\[switch-to-buffer] RET to remove temp window.")
"Type \\[switch-to-buffer-other-window] RET to restore old \
contents of temp window."))))
Is it correct nowadays to use a temporary buffer for displaying
informative text when it doesn't fit on a single line or is it a vestige
of the times when the minibuffer lacked autoexpand capabilities?
(There is another issue with the code above: if the minibuffer is on a
separate frame with different width, the function may end displaying the
text on a way that is not what the original developer intended.)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Using temporary buffers to display messages
2012-03-29 2:36 Using temporary buffers to display messages Óscar Fuentes
@ 2012-03-29 14:31 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2012-03-29 14:31 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: emacs-devel
> `sunrise-sunset' contains this code, that displays the text on the
> minibuffer if the frame is wide enough and on a temporary buffer
> otherwise:
> (if (<= (length msg) (frame-width))
> (message "%s" msg)
> (with-output-to-temp-buffer "*temp*"
> (princ (concat date-string "\n" time-string)))
> (message "%s"
> (substitute-command-keys
> (if one-window
> (if pop-up-windows
> "Type \\[delete-other-windows] to remove temp window."
> "Type \\[switch-to-buffer] RET to remove temp window.")
> "Type \\[switch-to-buffer-other-window] RET to restore old \
> contents of temp window."))))
> Is it correct nowadays to use a temporary buffer for displaying
> informative text when it doesn't fit on a single line or is it a vestige
> of the times when the minibuffer lacked autoexpand capabilities?
It's not incorrect. As for whether it's the best choice, it depends.
In general, for messages which are expected to be short (tho more
than a single line), I think `message' is the better choice, unless you
can expect that the user will often want to spend a bit of time looking
at the different parts of the message.
Stefan "whose minibuffer never has more than 1 line"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-29 14:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29 2:36 Using temporary buffers to display messages Óscar Fuentes
2012-03-29 14:31 ` Stefan Monnier
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.