Hot answers tagged

18

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.


13

Bind message-log-max to nil: (defun foo () (interactive) (let ((message-log-max nil)) (message "EEEEEEEEEEEEEEEEEE"))) 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 ...


12

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 special-mode, which is read-only. The advantages behind that are several. ...


7

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


7

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


6

I have the following snippet in my init.el, which was adapted from an original I found in the following Reddit thread: http://www.reddit.com/r/emacs/comments/16tzu9/anyone_know_of_a_reasonable_way_to_timestamp/ (EDIT: modernised to advice-add and removed clumsy read-only buffer handling on advice of @blujay) (defun sh/current-time-microseconds () "Return ...


6

M-x view-echo-area-messages RET or C-h e will open the *Messages* buffer. (This buffer can even contain some stuff that's not shown in the minibuffer, see inhibit-message.)


6

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


6

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


6

One solution for that narrow case is to dynamically set save-silently for that invocation specific invocation. Try: (run-at-time nil (* 5 60) (lambda () (let ((save-silently t)) (recentf-save-list)))) You might alternatively use advice to globally accomplish the same thing. See Advising Functions in the Emacs ...


5

(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 () (interactive) (let ((old-max comint-buffer-maximum-size)) (setq comint-buffer-maximum-size 0) (comint-truncate-buffer) (setq comint-buffer-maximum-size old-max) (...


5

Take a look at current-message function: (current-message) Probably introduced at or before Emacs version 20. Return the string currently displayed in the echo area, or nil if none. Code (progn (message "foo") (format "current message is %s" (current-message))) will return "current message is foo"


4

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


4

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 () (interactive) (test-fn)) Then call M-x test-test-fn RET to test....


4

You want to use the debug-on-message variable in this situation. If non-nil, debug if a message matching this regexp is displayed.


4

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.


4

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" (apply old-func (concat (format-time-string "[%F %T.%3N %Z] ") ...


3

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) (interactive (...


3

You could try something like: (run-with-timer 2 nil (lambda () (message "Some message") (run-with-timer 3 nil (lambda () (message 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 ...


3

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))) (with-suppressed-message (save-buffer)) instead of (save-...


3

Just convert the result of (char-after) to string: (message (string (char-after)))


3

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


2

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)


2

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


2

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


2

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


2

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


2

I think you could add something like this to your initialization: (advice-add 'auto-revert-handler :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-...


2

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


1

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


Only top voted, non community-wiki answers of a minimum length are eligible