GNU bug report logs - #12708
24.1; M-x display-time-world "q" close window

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Mon, 22 Oct 2012 20:47:02 UTC

Severity: wishlist

Found in version 24.1

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 12708 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 12708 <at> debbugs.gnu.org, Kevin Ryde <user42 <at> zip.com.au>
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Wed, 24 Oct 2012 10:44:44 +0300
> We could do
>
> (defun quit-window-kill-buffer (&optional window)
>   "Quit WINDOW and kill its buffer.
> WINDOW must be a live window and defaults to the selected one."
>   (interactive)
>   (quit-restore-window window 'kill))
>
> (defvar display-time-world-mode-map
>   (let ((map (make-sparse-keymap)))
>     (define-key map "q" 'quit-window-kill-buffer)
>     map)
>   "Keymap of Display Time World mode.")

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.

> But `display-time-world' should probably also use `display-buffer'
> instead of `pop-to-buffer' and put the buffer in `view-mode'.  After
> all, who wants to edit or navigate the *wclock* buffer?

In addition to this, it could also use the action
`display-buffer-below-selected' (like in dired),
and instead of `fit-window-to-buffer' it could use
'((window-height . fit-window-to-buffer)).




This bug report was last modified 12 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.