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