I have this function:
(defun foo ()
(interactive)
(call-interactively 'bar)
(call-interactively 'baz)
(call-interactively 'qux)
(call-interactively 'quux)
(call-interactively 'fred))
When I call foo
, I would like to see in the echo area a message like X is running
as long as the X
function is running, where X
is bar
, baz
and so on, but without hiding any messages that emacs might show when foo
itself is running. I mean something like this:
bar is running
Query replacing regexp foo with bar: (? for help)
Just I have no idea how to do such a thing.
Clarification
db84x pointed out to me that my question is unclear, so I'm going to clarify it.
Suppose bar
contains this line:
(query-replace-regexp "bar" "qwerty" nil (point-min) (point-max))
When emacs finds this line, the following will appear in your echo area:
--- Echo area ---
Query replacing regexp bar with qwerty: (? for help)
--- Echo area ---
When I call bar
, I first want a message to appear in echo area:
--- Echo area ---
bar is running
--- Echo area ---
and this message must not disapper as long as bar
is running. So, when emacs finds the query-replace-regexp
above, the echo area should appear this way:
--- Echo area ---
bar is running
Query replacing regexp bar with qwerty: (? for help)
--- Echo area ---
I'm sorry if my question was unclear. Hope now it is.
Attempt 1
I picked up Drew's suggestion about message
and I found with-temp-message
:
Macro: with-temp-message message &rest body
This construct displays a message in the echo area temporarily, during the execution of body. It displays message, executes body, then returns the value of the last body form while restoring the previous echo area contents.
It seems this macro is just what I am looking for, so I defined this function:
(defun fred ()
(interactive)
(with-temp-message
(message "Time's up! Three bucks off!")
(query-replace-regexp "foo" "bar" nil (point-min) (point-max))))
When I call fred
, my message is shown only at the end of its execution and not during. Where am I wrong?
message
in your command, or advise those commands you invoke, to have them add calls tomessage
. (But this hints at an X-Y problem.)