Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window

From: martin rudalics <[email-masked]>
Date: Sat, 27 Oct 2012 13:04:54 +0200

> BTW, when I needed to do the same for the *Occur* buffer
 > (to kill it after going to the occurrence) I created a new command
 > `occur-mode-goto-occurrence-kill-buffer' based on
 > `occur-mode-goto-occurrence-other-window':
 >
 > (defun occur-mode-goto-occurrence-kill-buffer ()
 >   "Go to the occurrence the current line describes, and kill the Occur buffer."
 >   (interactive)
 >   (let ((buf (current-buffer))
 >         (pos (occur-mode-find-occurrence)))
 >     (switch-to-buffer-other-window (marker-buffer pos))
 >     (goto-char pos)
 >     (kill-buffer buf)
 >     (run-hooks 'occur-mode-find-occurrence-hook)))
 >
 > I still have no idea how to generalize this common behavior.

Why don't you quit the *Occur* buffer window first and do a simple
`pop-to-buffer' afterwards?  In any case I think that the "kill the
*Occur* buffer" effect should be achieved with some sort of prefix.

BTW, I find bindings like

     (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
     (define-key map "\C-m" 'occur-mode-goto-occurrence)
     (define-key map "o" 'occur-mode-goto-occurrence-other-window)

very confusing.

 > In addition to this, it could also use the action
 > `display-buffer-below-selected' (like in dired),

I think `display-buffer-at-bottom' would suit better.  But this needs
some way to say bottom-left, bottom-center, bottom-right.  I'm not yet
sure how to do that best.

 > and instead of `fit-window-to-buffer' it could use
 > '((window-height . fit-window-to-buffer)).

I installed that now.

martin