Sample Header Ad - 728x90

Emacs: mute messages ("echo area")

5 votes
2 answers
2211 views
I do lots of automatizing in Emacs, by stacking commands that I know from using **manually**. That is a method I recommend, because it doesn't take much effort: you use Emacs as you ordinarily would, and now and then it pops to your head, "hey, I'm always using those commands in succession, why don't I just merge them?" All the more simple since you know the commands, by name or shortcut. One problem, though, is that when you stack commands, you get lots of messages flashing by in the "echo area" (same place as the minibuffer). Those messages don't make any sense, as everything going on below (the functions invoked) is (should be) transparent to the user. So, could you **mute** it, and then **unmute** it? Take a look below: (defun invisible-pretty-mail () "Automatize `pretty-mail'." (interactive) ; (mute-echo-area) (rmail-edit-current-message) (pretty-mail) ; lots of replace-string, replace-regexp, etc. here ; that will flood messages (rmail-cease-edit) ; (unmute-echo-area) ) **Edit** in response to sds' [answer](https://unix.stackexchange.com/a/67191/13136) : I'm very much aware of those notes you refer to, as they are very common in the Emacs help system. While your advice is not incorrect in general, let us examine this particular situation in greater detail: 1) There is an Elisp function in .emacs. 2) It uses commands that the person who setup the function is very familiar with, so it is very readable and maintainable. 3) The function works exactly as intended, with 4) the _one_ drawback that it echos too many messages. Now, in this situation, would you really suggest a **complete rewrite** of that function (and many others), using altogether different commands, commands that may or may not exist, as a possible way of reducing messages, which we won't even know will happen? **Edit**: An example (that works), after the help I got from [Drew](https://unix.stackexchange.com/a/83849/13136) . (defun test-suppress-msgs () (interactive) (let ((log-size message-log-max)) (setq message-log-max nil) (message "This message is suppressed.") (setq message-log-max log-size) (message "This is echoed, and logged.") ))
Asked by Emanuel Berg (7101 rep)
Mar 6, 2013, 10:07 PM
Last activity: Feb 3, 2017, 09:42 PM