Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Any idea how one would do it for non-file buffers? I seem to recall seeing a S.O. thread a long while back that said it couldn't be done, but I could easily be misremembering. Commented Apr 1, 2015 at 18:16
  • 2
    @Dan: AFAIK, there is no single function that all buffer-creation goes through. But you can try advising get-buffer-create. That's written in C, however. You can certainly advise generate-new-buffer, which calls get-buffer-create. (But you might also ask yourself whether you really need this for non-file buffers.) Commented Apr 1, 2015 at 18:25
  • Yes, I am familiar I read through the source and couldn't figure it out. I never heard of advise before so I will take a look at what that means. I think this solves it. Thanks! Commented Apr 1, 2015 at 18:31
  • advice-add is the new way to advise. But you can still use defadvice (which is good). Commented Apr 1, 2015 at 18:37