emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: other-buffer advice on kill-buffer


From: Antoine Levitt
Subject: Re: other-buffer advice on kill-buffer
Date: Tue, 02 Aug 2011 01:19:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

02/08/11 01:03, Jérémy Compostella
> All,
>
> I'm trying to modify the behavior of the kill-buffer function to fit my
> needs. I would like to limit the list of eligible buffers used to select
> the buffer which will be displayed in place of the killed buffer.
>
> I have tried to advice the other-buffer function which seems called
> (Cf. buffer.c) but my advice is never called in this case. Indeed, my
> other-buffer advice is correctly called on switch-to-buffer call but
> never on kill-buffer call.
>
> So am I missing something ?
> Is there a restriction on advices for C implemented function ?
> How the kill-buffer function select the new displayed buffer ? Could I
> really modify its behavior and how ?
>
> Thanks for your help.
>
> Jeremy

Hi Jeremy,

I believe you can't advice a C function (not sure). In any case, advice
is generally best left as last resort. What's keeping you from defining
your own my-kill-buffer that'd call kill-buffer (which would switch to
the most recent buffer) and then do some buffer switching of your own?

Also see the docstring of kill-buffer. In particular, the docstring
tells you than it calls replace-buffer-in-windows, and then the source
code for replace-buffer-in-windows tells you that it calls
switch-to-prev-buffer. So if you must advice or redefine an emacs
function, these two look like better access points.

Just out of curiosity, what buffers are you trying to exclude?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]