12

Is there a function for logging to Messages buffer without displaying in the echo-area? Or maybe another build in log mechanism?

I'm after a kind of console.log("string") kind of functionality.

  • Here is a link that demonstrates how I do it: emacs.stackexchange.com/a/6003/2287 Essentially, the function (messages-buffer) is used to obtain the buffer or create one with the proper mode if it doesn't exist. The function -- using (inhibit-read-only t) -- goes to the bottom of the buffer and tests to see if it is at a new line, if not then create a new line, then insert the contents of the message (what ever it is), then test again to see if it is a new line, if not at new line then insert one. This method keeps the echo area available for stuff like interactive prompts. – lawlist Jun 1 '15 at 14:12
10

With emacs-snapshot, you can let-bind inhibit-message to t:

Non-nil means calls to `message' are not displayed. They are still logged to the Messages buffer.

0

One way to do it is to call (message "") immediately after. This will, however, wipe out any existing content in the echo area.

(message "foo")
(message "")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.