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

From: martin rudalics <[email-masked]>
Date: Tue, 23 Oct 2012 08:33:16 +0200

> In an M-x display-time-world, it'd be good if the "q" key closed the
 > window (as well as killing the buffer).
 >
 > The window is a small extra opened at the bottom of the screen by the
 > command.  If it's still that size then it's not much use for anything
 > else.
 >
 > M-x calendar has its "q" close the small window it opens.  I'm suspect
 > it's not possible to share code, as the calendar bit looks like it does
 > other things too.

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.")

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?

martin