all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* find-alternate-file and kill-buffer-query-functions
@ 2002-08-27  4:01 Noah Friedman
  2002-08-27 18:02 ` Stefan Monnier
  2002-08-28  6:51 ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Noah Friedman @ 2002-08-27  4:01 UTC (permalink / raw)
  Cc: emacs-devel

I've been wondering why it was that sometimes all my shell buffers and
other things I had protected from accidentally killing with a hook on
kill-buffer-query-functions, would sometimes get killed anyway when I
marked everything for deletion in the buffer menu.

It turns out that find-alternate-file is setting
kill-buffer-query-functions to nil; this was a change made 2002-07-14.

This variable is not buffer-local by default.  I think you need to
let-bind it carefully using something like the logic below:

    ...
    (unless (eq (current-buffer) obuf)
      ;; We already asked; don't ask again.
      (save-excursion
        ;; switch to buffer before shadowing query functions, in case
        ;; they are buffer-local
        (set-buffer obuf)
        (let ((kill-buffer-query-functions nil))
          (kill-buffer obuf))))

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

* Re: find-alternate-file and kill-buffer-query-functions
  2002-08-27  4:01 find-alternate-file and kill-buffer-query-functions Noah Friedman
@ 2002-08-27 18:02 ` Stefan Monnier
  2002-08-28  6:51 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2002-08-27 18:02 UTC (permalink / raw)
  Cc: rms, emacs-devel

>     (unless (eq (current-buffer) obuf)
>       ;; We already asked; don't ask again.
>       (save-excursion
>         ;; switch to buffer before shadowing query functions, in case
>         ;; they are buffer-local
>         (set-buffer obuf)
>         (let ((kill-buffer-query-functions nil))
>           (kill-buffer obuf))))

Sounds right, except that I'd recommend `with-current-buffer'
in place of `save-excursion' + `set-buffer'.


	Stefan

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

* Re: find-alternate-file and kill-buffer-query-functions
  2002-08-27  4:01 find-alternate-file and kill-buffer-query-functions Noah Friedman
  2002-08-27 18:02 ` Stefan Monnier
@ 2002-08-28  6:51 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2002-08-28  6:51 UTC (permalink / raw)
  Cc: emacs-devel

Thanks.

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

end of thread, other threads:[~2002-08-28  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-27  4:01 find-alternate-file and kill-buffer-query-functions Noah Friedman
2002-08-27 18:02 ` Stefan Monnier
2002-08-28  6:51 ` Richard Stallman

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.