Open the directory in dired with C-x 4 d and type M-x turn-on-gnus-dired-mode. Then mark the required files with m (or whatever) and type C-c RET C-a. The files can now be attached to an already opened message buffer or assigned to a new one.
Bind message-log-max to nil:
(defun foo ()
(let ((message-log-max nil))
M-x foo RET
[P.S. Don't be misled by tests using things such as M-: (let ((message-log-max nil)) (message "EEEEEEEEEEEEEEEEEE")) into thinking that the EEEEEEEEEEEEEEEEEE from evaluating the let sexp is the message that was output ...
You can clean up the *Messages* buffer the same way you always could, with the kill-buffer command.
The next time a message is signaled, the buffer will be recreated anew.
The reason that this buffer is read-only now, is that it has been granted
its own major-mode, which inherits from
which is read-only. The advantages behind that are several.
As was pointed out by @phils the "Wrote file" comes from write-region. If you don't use the inhibit-message variable introduced in Emacs 25, you could replace the original write-region with a function that sets VISIT to neither t nor nil nor a string. As the docstring of write-region tells us, this will avoid displaying the message. In the following example ...
Forms in the function body are executed in order, just as you would expect.
When you choose "y" if does not "jump" past the first message call. If looks like it did because the first message gets immediately replaced by the second one.
To check that this is true, open the *Messages* buffer and then do M-x foo. You will see that foo adds two messages to the ...
I have the following snippet in my init.el, which was adapted from an original I found in the following Reddit thread:
(EDIT: modernised to advice-add and removed clumsy read-only buffer handling on advice of @blujay)
(defun sh/current-time-microseconds ()
You can't with message. Having looked at the internals of message, only the raw char* is given to the function that actually logs the text, all text properties are lost.
You can hack your way around this by writing a function that:
calls message with message-log-max let-bound to nil so that it won't log to *Messages*
manually inserts the propertized string ...
Maybe org-mime.el by Eric Schulte.
;; WYSWYG, html mime composition using org-mode
;; For mail composed using the orgstruct-mode minor mode, this
;; provides a function for converting all or part of your mail buffer
;; to embedded html as exported by org-mode. Call `org-mime-htmlize'
;; in a message buffer to convert either the active region or the
One solution for that narrow case is to dynamically set save-silently for that invocation specific invocation. Try:
(run-at-time nil (* 5 60)
(let ((save-silently t))
You might alternatively use advice to globally accomplish the same thing. See Advising Functions in the Emacs ...
(erase-buffer) won't work on comint and shell buffers if they are read-only.
Here's the defun I use quite often for clearing shellish buffers:
(defun clear-comint-buffer ()
(let ((old-max comint-buffer-maximum-size))
(setq comint-buffer-maximum-size 0)
(setq comint-buffer-maximum-size old-max)
Take a look at current-message function:
Probably introduced at or before Emacs version 20.
Return the string currently displayed in the echo area, or nil if none.
(format "current message is %s" (current-message)))
will return "current message is foo"
When you evaluate a function with M-:, the function gets run, and then its return value is displayed in the echo area. The return value of test-fn is the value returned by message, which is the string that was printed. Thus, though message did actually display the message, it was overwritten by M-: displaying the return value. (You can confirm that both ...
What you see printed in the echo area when evaluating the command is its return value - a string. The print syntax for strings includes quotation marks.
When you call the command non-interactively from another function/command, you shouldn't see the quotation marks:
(defun test-test-fn ()
Then call M-x test-test-fn RET to test....
I located a package called muse-message, which does exactly what I was hoping for. I have not ever used Muse, but it's a markup system similar to markdown.
Muse-message allows for using Muse markup, and then M-x muse-message-markup turns the message buffer into a multipart MIME message with an HTML component.
The translation of @xinfatang's simple solution to the new advice-add syntax as a wrapper around the message function is:
(defun my-message-with-timestamp (old-func fmt-string &rest args)
"Prepend current timestamp (with microsecond precision) to a message"
(concat (format-time-string "[%F %T.%3N %Z] ")
It's not being skipped. The second message is printed after the first message is printed, but there is no wait between the two, so you do not notice the first message. Look in buffer *Messages* and you will see both messages.
To give the user time to see the first message, you can use sit-for or sleep-for after it:
(defun foo (str bool)
You could try something like:
(run-with-timer 2 nil
(message "Some message")
(run-with-timer 3 nil
run-with-timer will call a function of your choice after a delay (there's a run-with-idle-timer variant if you want to only show the message when Emacs ...
You can use following
(defmacro with-suppressed-message (&rest body)
"Suppress new messages temporarily in the echo area and the `*Messages*' buffer while BODY is evaluated."
(declare (indent 0))
(let ((message-log-max nil))
`(with-temp-message (or (current-message) "") ,@body)))
instead of (save-...
When killing Emacs, there are several hooks that may end up being called -- including, but not limited to, kill-emacs-hook, kill-buffer-hook (when a buffer is killed), write-file-functions hook (if a buffer is saved). A user can inspect a hook by calling M-x describe-variable and the name of the hook. A user can run a hook by evaluating (run-hooks NAME-OF-...
You can ensure do-auto-save is called with the correct argument to suppress the message by advising the function:
(defun my-auto-save-wrapper (save-fn &rest args)
(apply save-fn '(t)))
(advice-add 'do-auto-save :around #'my-auto-save-wrapper)
I think you'd need to use polling, sadly.
Detecting via polling that a change happened isn't very hard. Detecting which change happened would in general require keeping a copy of the buffer's contents, but if you're willing to assume that the buffer is only modified by adding to its end or removing from its beginning, you can make it much cheaper.
Refer from https://www.emacswiki.org/emacs/DebugMessages:
(defadvice message (before when-was-that activate)
"Add timestamps to `message' output."
(ad-set-arg 0 (concat (format-time-string "[%Y-%m-%d %T %Z] ")
(ad-get-arg 0)) ))
Finally i still like Stuart Hickinbottom 's answer, because it avoid show timestamp in minibuffer, ...
I don't know what you want to accomplish exactly, but as other people pointed out, reading the echo area is not the best strategy. Instead, you probably want to set up a sentinel.
Many commands in AUCTeX have a sentinel associated. For example, the one associated to LaTeX command is TeX-LaTeX-sentinel. You may want to build your own sentinel upon this ...
I tried the following. It seems to work, but I'm not sure about edge cases, and I'm still testing. The following code displays "foo" in the echo area, and then "bar", and then "hippo", and then "oink". The strings "quack" and "potamus" never show up ...
(defvar my-persisting-messages nil
"*Set if we are persisting messages.")
(defun my-message-function (...
I think you could add something like this to your initialization:
:around (lambda (orig-fun &rest args)
(let ((auto-revert-verbose (not (minibufferp (window-buffer)))))
(apply orig-fun args))))
Based on https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Misc.html#Minibuffer-...
There are two versions of function (inhibit-sentinel-messages FUN &rest ARGS) defined in Section Code of inhibit-sentinel-messages of this answer. The first version wraps all sentinels started in FUN with set-process-sentinel into let blocks with inhibit-message t. The second version avoids sentinel messages completely by temporarily advising message ...
A quick look at the code shows this:
blink-matching-open does not return a string - the return value is not the matching text. So message complains that its arg is not a string.
blink-matching-open itself calls message to show the matching text, so you should be able to just remove your (when matching-text...).