help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Detect content in minibuffer


From: Stefan Monnier
Subject: Re: Detect content in minibuffer
Date: Thu, 30 Jan 2014 10:13:05 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> I'm using the following to query the size of the buffer associated with the
> minibuffer but it always returns 0 even when there is a message currently
> being displayed in the echo area (say, documentation by eldoc or anything
> else).  The aim is to not echo anything when there's currently content in
> the echo area.

You might like to try (current-message).

> (with-current-buffer (window-buffer (minibuffer-window))
>   (unless (> 0 (buffer-size))

For some reason, (window-buffer (minibuffer-window)) returns the " *Minibuf-0*"
buffer rather than the " *Echo Area 0*" buffer.

> (with-current-buffer (get-buffer " *Echo Area 0*")
>   (unless (> 0 (buffer-size))

This should work.  At least in my tests:

   M-: (progn (message "foob") (with-current-buffer " *Echo Area 0*"
   (message "%S" (buffer-size)))) RET

returns 4.


        Stefan




reply via email to

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