all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* killing an indirect buffer
@ 2010-03-01 18:09 Erik Iverson
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Iverson @ 2010-03-01 18:09 UTC (permalink / raw)
  To: help-gnu-emacs

I am working with indirect buffers. According to the GNU Emacs manual,

"Killing the base buffer effectively kills the indirect buffer, but 
killing an indirect buffer has no effect on its base buffer."

But I do want the base-buffer killed when a user kills the indirect 
buffer in my specific application. Can anyone think of a way to have the 
base-buffer killed when an indirect buffer is killed?  I first thought 
of something like the following hook, made buffer-local in my indirect 
buffer:

   (add-hook 'kill-buffer-hook 'my-kill-buffer-hook-fun)

   (defun my-kill-buffer-hook-fun ()
      (kill-buffer (buffer-base-buffer)))

but then killing the indirect buffer will attempt to kill the 
base-buffer which will attempt to kill the indirect buffer, which will 
attempt ...


and I get "not: Lisp nesting exceeds `max-lisp-eval-depth'"


Thanks!
Erik Iverson




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

* Re: killing an indirect buffer
       [not found] <mailman.2100.1267466997.14305.help-gnu-emacs@gnu.org>
@ 2010-03-01 21:43 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-03-01 21:43 UTC (permalink / raw)
  To: help-gnu-emacs

> But I do want the base-buffer killed when a user kills the indirect buffer
> in my specific application. Can anyone think of a way to have the
> base-buffer killed when an indirect buffer is killed?  I first thought of
> something like the following hook, made buffer-local in my indirect buffer:

>   (add-hook 'kill-buffer-hook 'my-kill-buffer-hook-fun)

>   (defun my-kill-buffer-hook-fun ()
>      (kill-buffer (buffer-base-buffer)))

You can try:

  (defun my-kill-buffer-hook-fun ()
    (let ((kill-buffer-hook nil))
     (kill-buffer (buffer-base-buffer))))

You'll also want to try and make sure that your my-kill-buffer-hook-fun
is run last in kill-buffer-hook.


        Stefan


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

end of thread, other threads:[~2010-03-01 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-01 18:09 killing an indirect buffer Erik Iverson
     [not found] <mailman.2100.1267466997.14305.help-gnu-emacs@gnu.org>
2010-03-01 21:43 ` Stefan Monnier

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.