all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 6454@debbugs.gnu.org
Subject: bug#6454: 24.0.50; kill-buffer switches current-buffer
Date: Mon, 21 Jun 2010 16:25:01 +0200	[thread overview]
Message-ID: <m2631cea4i.fsf@gmail.com> (raw)
In-Reply-To: <4C1F42ED.8010404@gmx.at> (martin rudalics's message of "Mon, 21 Jun 2010 12:46:05 +0200")

* martin rudalics [2010-06-21 12:46+0200] writes:

>> Below are two patches.  The first essentially adds a save-excursion
>> around the whole function.
>>
>> The second patch adds a function run_hook_in_buffer. It iterates over
>> the functions in the hook and for each function explicitly sets the
>> buffer before calling it.  I had to introduce a new macro
>> DO_HOOK_FUNCTIONS which is a big hammer for this, but I couldn't find a
>> better way.
>
> Thanks.  I applied them here and will run them for a while to see
> whether and what they change.  BTW run_window_scroll_functions in
> xdisp.c has
>
>       run_hook_with_args_2 (Qwindow_scroll_functions, window,
> 			    make_number (CHARPOS (startp)));
>       SET_TEXT_POS_FROM_MARKER (startp, w->start);
>       /* In case the hook functions switch buffers.  */
>       if (current_buffer != XBUFFER (w->buffer))
> 	set_buffer_internal_1 (XBUFFER (w->buffer));
>
> so with your patch this is probably no more needed?
>
> Now, when a function run by a hook wants to change the current buffer it
> cannot do so any more.  Admittedly this was unreliable before so we
> probably won't lose much ...

My run_hook_in_buffer is (static) in buffer.c and only used by
Fkill_buffer.  The refactoring in eval.c was only needed to make it
possible to iterate over the functions of a hook.  It shouldn't affect
other things (modulo bugs that I introduced).

I guess unintended buffer switching could be a problem with many hooks,
but it's not clear if/when it's fix-worthy.

Helmut





  reply	other threads:[~2010-06-21 14:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18 11:10 bug#6454: 24.0.50; kill-buffer switches current-buffer Helmut Eller
2010-06-18 12:19 ` martin rudalics
2010-06-18 13:54   ` Stefan Monnier
2010-06-18 14:33     ` martin rudalics
2010-06-18 15:33       ` Stefan Monnier
2010-06-18 19:12         ` martin rudalics
2010-06-18 22:30           ` martin rudalics
2010-06-19 13:38 ` martin rudalics
2010-06-20  7:48   ` Helmut Eller
2010-06-20 10:42     ` martin rudalics
2010-06-20 18:00       ` Helmut Eller
2010-06-21 10:46         ` martin rudalics
2010-06-21 14:25           ` Helmut Eller [this message]
2010-06-21 15:49             ` martin rudalics
2010-06-21 16:19               ` Helmut Eller
2010-06-21 17:38                 ` martin rudalics
2011-09-21 20:44                   ` Lars Magne Ingebrigtsen
2011-09-22  7:07                     ` Helmut Eller
2011-09-23 10:56                       ` Lars Magne Ingebrigtsen
2010-06-24 23:07     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2631cea4i.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=6454@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.