emacs-devel
[Top][All Lists]
Advanced

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

Re: wrapper fn for message and minibuffer-message?


From: Stefan Monnier
Subject: Re: wrapper fn for message and minibuffer-message?
Date: Wed, 05 Oct 2005 11:53:57 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> (defun msg-maybe-in-minibuffer (string &rest args)
>   "Display STRING with `message' or `minibuffer-message', as appropriate."
>   (if (active-minibuffer-window)
>       (minibuffer-message (format "  [%s]" string))
>     (message string)))

I agree 100% with the intention.  Typical such messages are the completion
messages, for completion functions that can be used both in the minibuffer
and in normal buffers.  E.g. the pcomplete functions.

Of course I'd define it more like

(defun msg-maybe-in-minibuffer (format &rest args)
  "Display STRING with `message' or `minibuffer-message', as appropriate."
  (if (minibufferp)
      (minibuffer-message (apply 'format (concat "  [" format "]") args))
    (apply 'message format args)))

I'd even argue that this function should be called "minibuffer-message",
since currently minibuffer-message is only used when (minibufferp) is
non-nil.


        Stefan




reply via email to

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