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: Nicolas Richard
Subject: Re: Detect content in minibuffer
Date: Thu, 30 Jan 2014 15:36:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Miguel Guedes <miguel.a.guedes@gmail.com> writes:

> 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.

I guess there are two problems :
1. minibuffer is not the same as echo area. Try
M-: M-: (with-current-buffer (window-buffer (minibuffer-window)) 
(buffer-string))
(i.e. enter a recursive minibuffer) and then you get something.

2. the command loop erases the echo area before running commands, so
whenever you try running your code interactively, it'll report an empty
echo area. Try this instead:

(progn
  (message "foo!")
  (with-current-buffer " *Echo Area 0*"
    (format "Found string: %s" (buffer-string))))

Also, the functions current-message and with-temp-message might be of
interest to you. (But note that current-message also suffers the
problems of being cleared if you call it interactively !)

HTH,

-- 
Nico.



reply via email to

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