[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hooks for new buffers?
From: |
Lowell Gilbert |
Subject: |
Re: Hooks for new buffers? |
Date: |
Fri, 05 Apr 2013 10:45:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) |
wgreenhouse@riseup.net (W. Greenhouse) writes:
> Steven Degutis <sbdegutis@gmail.com> writes:
>
>> The easiest way to solve this is to find a hook that's called when
>> new buffers are created, even if that's not its official purpose.
>> Apparently after-change-major-mode-hook isn't enough, presumably
>> because these never changed major modes. So is there such a hook?
>>
>> And if not, is there at least some hook that happens whenever new
>> windows are opened?
>>
>> -Steven
>
> `window-configuration-change-hook', maybe?
I was going to suggest that, but I wanted to test it first because its
documentation is unclear on whether it gets run for a new buffer in an
existing window (and haven't gotten around to said testing). Another
possibility was buffer-list-update-hook, but you'd have to figure out on
your own whether there was a new buffer and if so, which it was.
'advice'ing get-buffer-create should catch all the cases, but that's a C
function, and it might be wandering into deep magic (and intractable
debugging).