[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kill buffer in other window
From: |
harven |
Subject: |
Re: kill buffer in other window |
Date: |
Thu, 24 Apr 2008 05:47:01 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Mar 3, 9:45 pm, Florian Kaufmann <sensor...@gmail.com> wrote:
> Hello
>
> Say you called something that displays a new buffer in the 'other
> window', e.g. describe-function, grep. When you done reading that
> buffer, you want to undo the displaying. That is kill the buffer, and
> delete the window if one was created. I din't found yet a convenient
> way to do it. Of course I can write a small lisp function, but I think
> there are other cool ways.
>
> Greetings
>
> Flo
Here is a short code snippet which gets ride of a hanging compilation
window if compilation was successful. Taken from some .emacs file
found on the wiki.
;; I also don't like that the compilation window sticks around after a
;; successful compile. After all, most of the time, all I care about
;; is that the compile completed cleanly. Here's how I make the
;; compilation window go away, only if there was no compilation
;; errors:
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;; there were errors
(message "compilation errors, press C-x ` to visit")
;; no errors, make compilation window go away in 0.5 sec
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "NO COMPILATION ERRORS!"))))
I use something similar to get rid of a hanging help window when
compiling successfully a tex file using auctex.
(defadvice TeX-command-master (after kill-Help-window)
(if (and TeX-error-report-switches
(plist-get TeX-error-report-switches
(intern (plist-get TeX-error-report-switches 'TeX-current-
master))))
(TeX-next-error 1)
(when (get-buffer "*TeX Help*")
(set-buffer "*TeX Help*")
(kill-buffer-and-window))))
(ad-activate 'TeX-command-master)
(setq TeX-process-asynchronous nil)
Hope this helps.
- Re: kill buffer in other window,
harven <=