Based upon the current question posed by the O.P., and based upon a prior question by the same O.P. about a week prior thereto wherein he stated that he had recently switched to GNUS mail Opening Gnus messages to the full height of the screen , it seemed appropriate to grep
the Emacs source code looking for likely suspects that would generate the stated buffer-name of *message*-20210127-065515
. I expected to find a variable with a default value containing the string *message*
that is concatenated with the date ..., which could hopefully be customized. Instead, I found that message-set-auto-save-file-name
hard-codes the buffer-name with a slight programmatic variation depending upon whether the system-type
is a memq
of '(ms-dos windows-nt cygwin)
. As such, modifying the function directly appears to be the most viable method to achieve the desired change.
Because the question was a little unclear as to what the O.P. wants to achieve (i.e., the question title states "Changing file names automatically generated by save-buffer"), I chose not to take the chance of guessing incorrectly as to the proposed modification. As such, this answer is generic in that the O.P. can change the buffer name within the function at issue as he sees fit. We wrap the modified function in a with-eval-after-load
statement so that the modified function gets loaded after the stock/built-in version loads -- otherwise, the stock/built-in version would replace the modified version if it loads subsequent to its attempted redefinition. The .emacs
/ init.el
could contain the following form with the modified function at issue: (with-eval-after-load 'message (defun message-set-auto-save-file-name ...))
M-x find-function RET message-set-auto-save-file-name RET
. Copy that function over to a*scratch*
buffer and tinker with it to see if that is what causes the behavior you wish to change. E.g., change"*message*"
to*message-foo*
and evaluate the modified function; and, then do some mail related stuff. This function doesn't look like it's meant to be customized by the user, so you may need to modify the function and stick the modified function in your.emacs
/init.el
file. You may also wish to consider wrapping it in awith-eval-after-load 'message ...
*scratch*
and then run my mail program, it works as I expect. If I add the code to myinit.el
it defaults back to the unmodified code inmessage.el
, a file which, as you have correctly observed cannot be directly modified.with-eval-after-load
statement so that the modified function is evaluated after themessage.el
library gets loaded? If not, when themessage.el
library loads, it will replace your modified function with the stock/built-in version.(with-eval-after-load 'message (defun message-set-auto-save-file-name ...))