emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using temporary buffers to display messages


From: Stefan Monnier
Subject: Re: Using temporary buffers to display messages
Date: Thu, 29 Mar 2012 10:31:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

> `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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]