unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: harven <harven@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: kill buffer in other window
Date: Thu, 24 Apr 2008 05:47:01 -0700 (PDT)	[thread overview]
Message-ID: <30697245-4f06-4e56-9bf5-c758fb2c7ca0@f36g2000hsa.googlegroups.com> (raw)
In-Reply-To: c59035aa-c961-4910-8b82-e15022e384ac@e6g2000prf.googlegroups.com

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.


  parent reply	other threads:[~2008-04-24 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03 19:45 kill buffer in other window Florian Kaufmann
2008-03-04  8:27 ` Tim X
2008-03-22  7:46 ` Uday S Reddy
2008-04-24 12:47 ` harven [this message]
2008-04-24 13:29   ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30697245-4f06-4e56-9bf5-c758fb2c7ca0@f36g2000hsa.googlegroups.com \
    --to=harven@free.fr \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).