all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* delete frame automatically
@ 2011-04-09  9:35 henry atting
  2011-04-09 22:49 ` José A. Romero L.
  0 siblings, 1 reply; 3+ messages in thread
From: henry atting @ 2011-04-09  9:35 UTC (permalink / raw)
  To: help-gnu-emacs

I have set up ansi-term to start with tmux in a new frame:

--8<---------------cut here---------------start------------->8---
(defun multi-term-tmux ()
(interactive)
                  "Make a multi-term buffer running tmux."
                  (let ((multi-term-program "/usr/bin/tmux"))
                    (multi-term)))

(defun for-term-only ()
  "Make a frame for guess what"
  (interactive)
  (let ((frame (make-frame '(
		  			  (left-fringe . 1)
			     (right-fringe . 1)     
 			     (background-color . "white")
		             (foreground-color . "black")
                             (font . "DejaVu Sans Mono-11")
			     (internal-border-width . 12)
			     (menu-bar-lines . 0)
                             (width . 100) (height . 36)
			     (tool-bar-lines . 0)
			     (unsplittable . t)))))
    (select-frame frame)
(multi-term-tmux)
  ))
--8<---------------cut here---------------end--------------->8---

How can I bring it about that the frame is deleted automatically when
I close ansi-term/tmux? As far a I know the
special-display-buffer-names variable does not help in this case because it
only applies to buffers that get displayed in another window (which
ansi-term does not)

henry
-- 
http://literaturlatenight.de


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

* Re: delete frame automatically
  2011-04-09  9:35 delete frame automatically henry atting
@ 2011-04-09 22:49 ` José A. Romero L.
  2011-04-10  8:46   ` henry atting
  0 siblings, 1 reply; 3+ messages in thread
From: José A. Romero L. @ 2011-04-09 22:49 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 9, 11:35, henry atting <nsmp...@online.de> wrote:
(...)
> How can I bring it about that the frame is deleted automatically when
> I close ansi-term/tmux? As far a I know the
(...)

Write some advice around the term-sentinel function. Something like
this should do the trick:

    (defadvice term-sentinel (around my-advice-term-sentinel (proc
msg))
      (if (memq (process-status proc) '(signal exit))
          (let ((buffer (process-buffer proc)) )
            ad-do-it
            (kill-buffer buffer)
            (delete-frame))
        ad-do-it))
    (ad-activate 'term-sentinel)

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


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

* Re: delete frame automatically
  2011-04-09 22:49 ` José A. Romero L.
@ 2011-04-10  8:46   ` henry atting
  0 siblings, 0 replies; 3+ messages in thread
From: henry atting @ 2011-04-10  8:46 UTC (permalink / raw)
  To: help-gnu-emacs

José A. Romero L. <escherdragon@gmail.com> writes:

> On Apr 9, 11:35, henry atting <nsmp...@online.de> wrote:
> (...)
>> How can I bring it about that the frame is deleted automatically when
>> I close ansi-term/tmux? As far a I know the
> (...)
>
> Write some advice around the term-sentinel function. Something like
> this should do the trick:
>
>     (defadvice term-sentinel (around my-advice-term-sentinel (proc
> msg))
>       (if (memq (process-status proc) '(signal exit))
>           (let ((buffer (process-buffer proc)) )
>             ad-do-it
>             (kill-buffer buffer)
>             (delete-frame))
>         ad-do-it))
>     (ad-activate 'term-sentinel)

Great, thanks. This works perfectly for term but not for multi-term.
In multi-term.el is a function (multi-term-handle-close) which closes
the current buffer when closing multi-term. Additionally to the above
lines I had to change it to take care of the current frame.

Cheers,
henry

-- 
http://literaturlatenight.de


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

end of thread, other threads:[~2011-04-10  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-09  9:35 delete frame automatically henry atting
2011-04-09 22:49 ` José A. Romero L.
2011-04-10  8:46   ` henry atting

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.