display-message-or-buffer?

Byrel Mitchell byrel.mitchell at gmail.com
Sat Jun 23 00:08:36 EDT 2012


Here you go:
display-message-or-buffer message &optional buffer-name not-this-window frame

 This function displays the message `message', which may be either a
string or a buffer. If it is shorter than the maximum height of the
echo area, as defined by max-mini-window-height, it is displayed in
the echo area, using message.  Otherwise, display-buffer is used to
show it in a pop-up buffer.

 Returns either the string shown in the echo area, or when a pop-up
buffer is used, the window used to display it.

 If message is a string, then the optional argument `buffer-name' is
the name of the buffer used to display it when a pop-up buffer is
used, defaulting to *Message*. In the case where message is a string
and displayed in the echo area, it is not specified whether the
contents are inserted into the buffer anyway.

 The optional arguments `not-this-window' and `frame' are as for
display-buffer, and only used if a buffer is displayed.


I can't find any equivalent XEmacs function (and I don't think I've
ever observed that behavior.) However, something like the following
should work I think:

(defun display-message-or-buffer (message &optional buffer-name
not-this-window frame)
 "docstring-from-emacs"
 (let ((message-buffer (get-buffer-create (or buffer-name "*Message*")))
       (message-lines 0))
   (save-excursion
     (set-buffer message-buffer)
     (erase-buffer)
     (insert message)
     (setq fill-column (window-width (minibuffer-window)))
     (fill-region (point-min) (point-max))
     (setq message-lines (count-lines (point-min) (point-max))))
   (if (> message-lines (window-height (minibuffer-window)))
       (display-buffer message-buffer not-this-window frame)
     (message message))))

Or something like that. I'm away from XEmacs at the moment, and I'm
not sure exactly what window-height returns for a minibuffer window. I
know it includes the modeline in normal windows, but... Anyway, hope
it helps!

On Fri, Jun 22, 2012 at 2:42 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Raymond Toy writes:
>
>  > Does xemacs have the equivalent of emacs display-message-or-buffer?
>
> It would help if you included the docstring of things you want
> equivalents for.
>
> (Half the time when people request Emacs features and I find out what
> they are, I go "WTF?"  But maybe that's just me.... :-)  N.B. That
> doesn't mean you shouldn't request them, or that we shouldn't add them
> -- Emacs compatibility still is an explicit goal of XEmacs development.
> Just that a lot of times I can't figure out why they exist. ;-)
>
> _______________________________________________
> XEmacs-Beta mailing list
> XEmacs-Beta at xemacs.org
> http://lists.xemacs.org/mailman/listinfo/xemacs-beta



More information about the XEmacs-Beta mailing list