From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#6454: 24.0.50; kill-buffer switches current-buffer Date: Mon, 21 Jun 2010 16:25:01 +0200 Message-ID: References: <4C1CC855.4060508@gmx.at> <4C1DF080.2030203@gmx.at> <4C1F42ED.8010404@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1277130551 8945 80.91.229.12 (21 Jun 2010 14:29:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 Jun 2010 14:29:11 +0000 (UTC) Cc: 6454@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 21 16:29:09 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OQhzk-0005Qc-Ry for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Jun 2010 16:29:05 +0200 Original-Received: from localhost ([127.0.0.1]:52467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQhzk-0004Lr-Ac for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Jun 2010 10:29:04 -0400 Original-Received: from [140.186.70.92] (port=36576 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQhzb-0004Jz-Pf for bug-gnu-emacs@gnu.org; Mon, 21 Jun 2010 10:28:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQhza-0005z5-0x for bug-gnu-emacs@gnu.org; Mon, 21 Jun 2010 10:28:55 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54799) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQhzZ-0005yz-UW for bug-gnu-emacs@gnu.org; Mon, 21 Jun 2010 10:28:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OQhwo-0004ey-Ir; Mon, 21 Jun 2010 10:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Helmut Eller Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Jun 2010 14:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6454 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6454-submit@debbugs.gnu.org id=B6454.127713031417903 (code B ref 6454); Mon, 21 Jun 2010 14:26:02 +0000 Original-Received: (at 6454) by debbugs.gnu.org; 21 Jun 2010 14:25:14 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQhw1-0004ei-PK for submit@debbugs.gnu.org; Mon, 21 Jun 2010 10:25:14 -0400 Original-Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQhw0-0004ed-AZ for 6454@debbugs.gnu.org; Mon, 21 Jun 2010 10:25:13 -0400 Original-Received: by wya21 with SMTP id 21so2668692wya.3 for <6454@debbugs.gnu.org>; Mon, 21 Jun 2010 07:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:to:cc:subject :references:date:in-reply-to:message-id:user-agent:mime-version :content-type; bh=tLhVMA3iJ7m+IIO3ejFyWUWowTQy9T4oQlFsjONBGD8=; b=Qsb9YUEwVck+Tl2Y4mY1+LkaF/ckVqd46Gis7w319A79zVfgqX3poTI2b4odg+dy90 isla+WyjI3cj+DLj/cm6NbmGCYEkWqLMhy6oX9fFZE2q2Nyf+f1cumaAR7BAufbadtCF aNylguMAkDcWd18CafxjkXHB08qE4F7WRzy/c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=T8syNRpEmADhH4FM+Uc5zisrdhtzvIITOLUXTcJJBcd9WRoKBawi6LMpSllPJy0/hp Kzgur/52KjbVahO54uiCu8TFZzzzvISGvNTCBfyt0jSXE/I90goFP+btZlMAw2qFynfa aY4qIM6LYscSmTnvVR21dH8dIGDunPaS1M+CI= Original-Received: by 10.216.163.79 with SMTP id z57mr3583319wek.17.1277130305869; Mon, 21 Jun 2010 07:25:05 -0700 (PDT) Original-Received: from ix (dial-182193.pool.broadband44.net [212.46.182.193]) by mx.google.com with ESMTPS id n29sm4037302wej.17.2010.06.21.07.25.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 21 Jun 2010 07:25:04 -0700 (PDT) Original-Received: from helmut by ix with local (Exim 4.69) (envelope-from ) id 1OQhvp-0000ty-Bo; Mon, 21 Jun 2010 16:25:01 +0200 In-Reply-To: <4C1F42ED.8010404@gmx.at> (martin rudalics's message of "Mon, 21 Jun 2010 12:46:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 21 Jun 2010 10:26:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37927 Archived-At: * 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