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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12708 in the body.
You can then email your comments to 12708 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Mon, 22 Oct 2012 20:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Oct 2012 20:47:02 GMT) Full text and rfc822 format available.

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

From: Kevin Ryde <user42 <at> zip.com.au>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1; M-x display-time-world "q" close window
Date: Tue, 23 Oct 2012 07:44:25 +1100
Severity: wishlist

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.




In GNU Emacs 24.1.1 (i486-pc-linux-gnu, GTK+ Version 2.24.8)
 of 2012-08-07 on blah.blah, modified by Debian
Configured using:
 `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Tue, 23 Oct 2012 06:36:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: 12708 <at> debbugs.gnu.org
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Wed, 24 Oct 2012 07:54:02 GMT) Full text and rfc822 format available.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Wed, 24 Oct 2012 14:59:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.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 22:53:11 +0800
martin rudalics <rudalics <at> gmx.at> writes:

> 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?

Yes, display-time-world is clearly behind the times, and the use of
pop-to-buffer is a mistake.  I changed display-time-world-mode to derive
from special mode, and display-time-world to use display-buffer.




bug closed, send any further explanations to 12708 <at> debbugs.gnu.org and Kevin Ryde <user42 <at> zip.com.au> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 24 Oct 2012 14:59:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Wed, 24 Oct 2012 16:28:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 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 12:25:43 -0400
Chong Yidong wrote:

> Yes, display-time-world is clearly behind the times, and the use of
> pop-to-buffer is a mistake.  I changed display-time-world-mode to derive
> from special mode, and display-time-world to use display-buffer.

emacs -Q -f display-time-world
q    ; in world time buffer
M-x display-time-world
   -> Buffer is read-only: #<buffer *wclock*>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Wed, 24 Oct 2012 18:30:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 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 14:27:36 -0400
Glenn Morris <rgm <at> gnu.org> writes:

> emacs -Q -f display-time-world
> q    ; in world time buffer
> M-x display-time-world
>    -> Buffer is read-only: #<buffer *wclock*>

Thanks, should be fixed now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sat, 27 Oct 2012 11:08:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12708 <at> debbugs.gnu.org
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sat, 27 Oct 2012 12:14:02 GMT) Full text and rfc822 format available.

Message #28 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
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Sat, 27 Oct 2012 14:45:18 +0300
>> (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)))
>
> Why don't you quit the *Occur* buffer window first and do a simple
> `pop-to-buffer' afterwards?

I tried it to be closer to the workflow of
`occur-mode-goto-occurrence-other-window'.
But your recipe would work as well.

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

You might find it more confusing when I tell you that in ~/.emacs
I bound `occur-mode-goto-occurrence-kill-buffer' to C-RET ;-)

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

Shouldn't `display-buffer-at-bottom' create a window with the width of
the frame's full width?  In this case, left/center/right are not needed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sat, 27 Oct 2012 13:48:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12708 <at> debbugs.gnu.org
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Sat, 27 Oct 2012 15:45:25 +0200
>>> (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)))
>> Why don't you quit the *Occur* buffer window first and do a simple
>> `pop-to-buffer' afterwards?
>
> I tried it to be closer to the workflow of
> `occur-mode-goto-occurrence-other-window'.
> But your recipe would work as well.

For <= two windows per frame users there's a difference: If the *Occur*
buffer appeared in a new window, the other window would be reused with
your approach.  If we delete the *Occur* window first, the other window
would be split.

>> 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.
>
> You might find it more confusing when I tell you that in ~/.emacs
> I bound `occur-mode-goto-occurrence-kill-buffer' to C-RET ;-)

Not really.  I use M-RET for going to the tag around `point'.  It has
some kind of "come on, get there ..." connotation for me.

> Shouldn't `display-buffer-at-bottom' create a window with the width of
> the frame's full width?  In this case, left/center/right are not needed.

I'm not sure.  People with two side-by-side windows would probably like
to split-below their window on the right for calendar-like things that
take fairly few columns only.  We need some framework for specifying
such behavior in a user-friendly way.  Well, they could use side-windows
already ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sat, 27 Oct 2012 15:22:01 GMT) Full text and rfc822 format available.

Message #34 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
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Sat, 27 Oct 2012 18:02:41 +0300
>> Shouldn't `display-buffer-at-bottom' create a window with the width of
>> the frame's full width?  In this case, left/center/right are not needed.
>
> I'm not sure.  People with two side-by-side windows would probably like
> to split-below their window on the right for calendar-like things that
> take fairly few columns only.

"Split-below on the right" is quite weird behavior as default.
Better would be "Split-below in the same column" (where column means
a vertical list of windows).  With a column of two windows
this is the same as `display-buffer-below-selected' already does.

> We need some framework for specifying such behavior in a user-friendly
> way.  Well, they could use side-windows already ...

In a user-friendly framework the user could just type a "print-screen" key
and it will convert the current window configuration info a structure
that can be used as a basis for further configuration.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sun, 28 Oct 2012 15:26:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12708 <at> debbugs.gnu.org
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Sun, 28 Oct 2012 16:23:04 +0100
>> I'm not sure.  People with two side-by-side windows would probably like
>> to split-below their window on the right for calendar-like things that
>> take fairly few columns only.
>
> "Split-below on the right" is quite weird behavior as default.
> Better would be "Split-below in the same column" (where column means
> a vertical list of windows).  With a column of two windows
> this is the same as `display-buffer-below-selected' already does.

Where would you put a calendar in a configuration like this:

 -----------------
|        |        |
|        |        |
|        |        |
|        |        |
 -----------------

Regardless of which window is selected, IMO the location would be

 -----------------
|        |        |
|        |        |
|        |--------|
|        | here.  |
 -----------------

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12708; Package emacs. (Sun, 28 Oct 2012 17:56:02 GMT) Full text and rfc822 format available.

Message #40 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
Subject: Re: bug#12708: 24.1; M-x display-time-world "q" close window
Date: Sun, 28 Oct 2012 19:41:45 +0200
> Where would you put a calendar in a configuration like this:
>
>  -----------------
> |        |        |
> |        |        |
> |        |        |
> |        |        |
>  -----------------

I think it should depend on which window is selected
like `display-buffer-below-selected' does:

 -----------------
|        |selected|
|        |        |
|        |--------|
|        | here.  |
 -----------------

 -----------------
|selected|        |
|        |        |
|--------|        |
| here.  |        |
 -----------------

The reasoning being that the result should look the same
as in a narrow 1-window frame:

----------
|selected|
|        |
|--------|
| here.  |
----------




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 26 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 178 days ago.

Previous Next


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