I want my emacs buffer to have a different name than the file name. Rather than setting this manually every time, I want to have this happen automatically based on the file contents, something like:
// Local Variables:
// buffer-name: MyName
// End:
But this doesn’t work because buffer-name is a function, not a variable. How can I do this?
You could say:
It is a trick though.
You could otherwise program a
find-file-hookhook in your.emacswhich rename the buffer to a specific local variable contents. Something like:Then in your specific file you have
With more brain power you could have a nicer solution.
Note that there could already exist an extension for your need. Look in the Emacs wiki.