emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quit-window


From: Christoph Scholtes
Subject: Re: quit-window
Date: Mon, 24 Oct 2011 19:24:04 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (windows-nt)

Richard Stallman <address@hidden> writes:

> As far as buffers are concerned, it is no different from any other
> change in selection.  That's not supposed to change anything about
> any buffer.

Except for the buffer associated with the temporary window, right? If the
content of the window is of temprary nature (in most cases) I would want
to kill the associated buffer when the window is quit.

> Thus, if a mode tries to do something nontrivial to the buffer on the
> occasion of quitting, that makes me worry.  Should that be done at
> all?

That would have to be decided on a case by case basis, I think. 

>     I have identified at least 18 modes that do something similar. Maybe
>     some special case even needs to, but most of the time it could be
>     cleaned up, IMO.
>
> I think we need to study carefully what things they do, and whether there
> is a good reason for them.

I agree. I basically just looked for cases where the keymap bound `q',
but did not bind it to quit-window, but some other function,
e.g. ibuffer-quit.

Take this:

(defun ibuffer-quit ()
  "Quit this `ibuffer' session.
Try to restore the previous window configuration if
`ibuffer-restore-window-config-on-quit' is non-nil."
  (interactive)
  (if ibuffer-restore-window-config-on-quit
      (progn
        (bury-buffer)
        (unless (= (count-windows) 1)
          (set-window-configuration ibuffer-prev-window-config)))
    (bury-buffer)))

Here I am wondering if the same couldn't be achieved by a call to
(the new and improved) `quit-window'.

> I looked at Info-exit and it seems ok, because it is only doing
> something special in the case of stand-alone Info.

It wraps `quit-window' in a way that I cannot use `C-u q' to quit the
window and *kill* the buffer, though. 

Something like

(defun Info-exit (kill)
  "Exit Info by selecting some other buffer."
  (interactive "P")
  (if Info-standalone
      (save-buffers-kill-emacs)
    (quit-window kill)))

would allow that and be consistent with other cases where `q' binds
`quit-window' directly. The next step would then be the previously
discussed `quit-window-hook' to move the additional functionality to (if
applicable).

> We don't want to install these changes now, but there's no need to
> delay the studying.

I will create a list of the occurrences I found and look at if (and what)
functionality would get lost if the function used `quit-window'. This is
obviously only for cases where the additional functionality deals with
window management.

Christoph



reply via email to

[Prev in Thread] Current Thread [Next in Thread]