missing emacs hook
April 9, 2010 7:32 AM   Subscribe

Is there an "open file" or "new buffer" emacs hook?

Long story short, I want to change my emacs buffer names. I already have the code written and working to do the change using (rename-buffer), but I have to manually invoke it on every buffer when I open it. I can't find a hook for when emacs opens a file or creates a buffer to put this into. But surely this is a solved problem.
posted by DU to Computers & Internet (5 answers total) 1 user marked this as a favorite
 
Best answer:
C-h v find-file-hook

posted by spacewrench at 7:39 AM on April 9, 2010 [1 favorite]


Response by poster: Well then, that was simple. Definitely looks like what I want. Although it doesn't seem to be working, but then this is the first emacs hook I've written, so....
posted by DU at 7:54 AM on April 9, 2010


I don't know the answer, but if you are having problems getting spacewrench's hook to work, you might take a look at the source for uniquify to see how they're doing it. (A quick glance seems to indicate they're defining advice on rename-buffer and create-file-buffer.)
posted by enn at 8:03 AM on April 9, 2010


stackoverflow.com is probably a better place to ask emacs questions. The emacs wiki is also a great resource.
posted by chairface at 8:58 AM on April 9, 2010 [1 favorite]


Response by poster: Never mind, I got it working. I'm using emacs 21, where it's actually find-file-hooks.
posted by DU at 9:09 AM on April 9, 2010


« Older I'm an adult. I should know how mail works.   |   Starter camera for 5 year-old Newer »
This thread is closed to new comments.