unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* occur-hook changing the current buffer
@ 2005-06-21  2:00 Juanma Barranquero
  2005-06-21 21:20 ` Stefan Monnier
  2005-06-22  3:40 ` Richard M. Stallman
  0 siblings, 2 replies; 36+ messages in thread
From: Juanma Barranquero @ 2005-06-21  2:00 UTC (permalink / raw)


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?

-- 
                    /L/e/k/t/u


Index: replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.212
diff -u -2 -r1.212 replace.el
--- replace.el	8 Jun 2005 22:37:13 -0000	1.212
+++ replace.el	21 Jun 2005 01:48:51 -0000
@@ -1002,5 +1002,6 @@
  		(setq next-error-last-buffer occur-buf))
  	    (kill-buffer occur-buf)))
-	(run-hooks 'occur-hook))
+        (save-current-buffer
+          (run-hooks 'occur-hook)))
       (setq buffer-read-only t)
       (set-buffer-modified-p nil))))

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2005-06-30  1:44 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-21  2:00 occur-hook changing the current buffer Juanma Barranquero
2005-06-21 21:20 ` Stefan Monnier
2005-06-21 22:26   ` Juanma Barranquero
2005-06-22  3:34     ` Stefan Monnier
2005-06-22  3:56       ` Juanma Barranquero
2005-06-22  4:16         ` Miles Bader
2005-06-22  8:04           ` Juanma Barranquero
2005-06-22  8:11             ` Miles Bader
2005-06-22  8:35               ` Juanma Barranquero
2005-06-22 16:29                 ` Juri Linkov
2005-06-22 23:37                   ` Juanma Barranquero
2005-06-23  2:36                     ` Miles Bader
2005-06-23  7:26                       ` Juanma Barranquero
2005-06-23 13:44                         ` Emilio Lopes
2005-06-23 14:45                           ` Juanma Barranquero
2005-06-23 15:30                             ` Jason Rumney
2005-06-23 15:42                               ` Juanma Barranquero
2005-06-23 15:54                               ` Lute Kamstra
2005-06-23 15:59                                 ` Juanma Barranquero
2005-06-24  6:53                                   ` Lute Kamstra
2005-06-24  8:04                                     ` Juanma Barranquero
2005-06-23 16:54                   ` Richard M. Stallman
2005-06-24  2:45                     ` Juanma Barranquero
2005-06-26 23:22                       ` Juri Linkov
2005-06-27  5:46                         ` Juanma Barranquero
2005-06-27 16:46                         ` Richard M. Stallman
2005-06-27 20:31                           ` Werner LEMBERG
2005-06-28  0:19                             ` Juri Linkov
2005-06-28  4:56                               ` Werner LEMBERG
2005-06-28 18:47                             ` Richard M. Stallman
2005-06-29  4:40                               ` Werner LEMBERG
2005-06-30  1:44                                 ` Richard M. Stallman
2005-06-22 11:10               ` Juanma Barranquero
2005-06-22  3:40     ` Richard M. Stallman
2005-06-22  3:56       ` Juanma Barranquero
2005-06-22  3:40 ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).