emacs-devel
[Top][All Lists]
Advanced

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

RE: Annoying paren match messages in minibuffer


From: Drew Adams
Subject: RE: Annoying paren match messages in minibuffer
Date: Wed, 14 Jan 2009 07:29:30 -0800

> >> An annoyance like you reported can be eliminated with the following
> >> simple patch:
> >> -        (message "Mismatched parentheses"))
> >> +  (if (window-minibuffer-p (selected-window))
> >> +      (minibuffer-message " [Mismatched parentheses]")
> >> +    (message "Mismatched parentheses")))
> 
> > This patch looks like the right thing to do.  Does anyone see any
> > problems with this change?
> 
> Other than the fact that this should be done automatically by 
> `message'? No,

I won't know until I try it, and I don't have the time to do that right now. But
I suspect that this will sometimes lead to problems due to the delay involved
with `minibuffer-message'.

I do the same thing myself, but only as a separate function. So when I want
unconditional behavior (regardless of the current buffer) I can still call
either `message' or `minibuffer-message' instead.

BTW, don't you need to ensure that the minibuffer window is active?

FWIW, this is the code I use:

(defun msg-maybe-in-minibuffer (format-string &rest args)
  "Display FORMAT-STRING as a message.
If called with the minibuffer inactive, use `message'.
Otherwise, use `minibuffer-message'."
  (if (active-minibuffer-window)
      (save-selected-window
        (select-window (minibuffer-window))
        (minibuffer-message
         (apply #'format
                (concat "  [" format-string "]") args)))
    (apply #'message format-string args)))






reply via email to

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