From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: occur-hook changing the current buffer Date: Tue, 21 Jun 2005 04:00:39 +0200 Message-ID: Reply-To: Juanma Barranquero NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1119321310 5227 80.91.229.2 (21 Jun 2005 02:35:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2005 02:35:10 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 21 04:35:09 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DkYbM-0001IV-Ow for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2005 04:35:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkYhh-0007vu-KT for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2005 22:41:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DkYfL-0006qo-Jz for emacs-devel@gnu.org; Mon, 20 Jun 2005 22:39:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DkYfK-0006pw-16 for emacs-devel@gnu.org; Mon, 20 Jun 2005 22:39:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkYap-0005Gb-Qv for emacs-devel@gnu.org; Mon, 20 Jun 2005 22:34:27 -0400 Original-Received: from [64.233.182.197] (helo=nproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DkY6s-0001Cz-HS for emacs-devel@gnu.org; Mon, 20 Jun 2005 22:03:30 -0400 Original-Received: by nproxy.gmail.com with SMTP id i2so52093nfe for ; Mon, 20 Jun 2005 19:00:39 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=nQY3jj3vyll6cWh2Tz+uo0fyFyWw07JU54s5BcGv2sdn7/Bao1TwXjJrODJij48yhBJavw4bkwQmEEXN5rbWeEipkTtZ8CwnpylNAwe8HWYHukyv7WecKgZJPV5ew7gsAKf6+lHArOpHvk+LbrJ8n2H+t5Y0AvgaAsbfH1Q8/HQ= Original-Received: by 10.48.144.12 with SMTP id r12mr95896nfd; Mon, 20 Jun 2005 19:00:39 -0700 (PDT) Original-Received: by 10.48.250.5 with HTTP; Mon, 20 Jun 2005 19:00:39 -0700 (PDT) Original-To: emacs-devel@gnu.org Content-Disposition: inline X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39215 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39215 In my `occur-hook' I have a custom function which does not save the current buffer, so the last two lines of `occur-1', i.e.: (setq buffer-read-only t) (set-buffer-modified-p nil)))) where affecting the wrong buffer (the one searched by `occur', in fact). Now, I can easily change my function to do the right thing, but I still feel that `occur-1' should be fixed by using `save-current-buffer' around the call to "(run-hooks 'occur-hook). The rationale being that setting the modified flag to nil on the wrong buffer can lead to data loss. Opinions? --=20 /L/e/k/t/u Index: replace.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v retrieving revision 1.212 diff -u -2 -r1.212 replace.el --- replace.el=098 Jun 2005 22:37:13 -0000=091.212 +++ replace.el=0921 Jun 2005 01:48:51 -0000 @@ -1002,5 +1002,6 @@ =09=09(setq next-error-last-buffer occur-buf)) =09 (kill-buffer occur-buf))) -=09(run-hooks 'occur-hook)) + (save-current-buffer + (run-hooks 'occur-hook))) (setq buffer-read-only t) (set-buffer-modified-p nil))))