display-buffer-reuse-frames makes View-quit abnormal

View: New views
4 Messages — Rating Filter:   Alert me  

display-buffer-reuse-frames makes View-quit abnormal

by an0 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

After `(setq display-buffer-reuse-frames t)', `C-h f'(or `C-h v' and the alike) to view help, `C-x o' to jump to the help window, `q' to quit view mode, then I find `View-quit' does not restore window and buffer to previous state as usual, instead Emacs pops one of other buffers.

In GNU Emacs 23.0.0.8 (i686-pc-linux-gnu, GTK+ Version 2.8.3)
 of 2007-06-18 on ht14
Windowing system distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure  '--prefix=/home/wangling' '--enable-font-backend' '--with-xft''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: zh_CN.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  shell-dirtrack-mode: t
  auto-insert-mode: t
  display-time-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  show-paren-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  auto-image-file-mode: t
  server-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
l l l l l l l l l l l l l l l l l l l l l l l l l l
l l l l l l l l l SPC u <return> C-v C-v C-v C-v M-v
M-v M-v k k k k k k k k k k k k k k k k k k k k k k
k k k k k l l l l l l l l l l l l l l l l l l l l l
l l l l l l l l l l j M-v [ j j j j C-f C-v k k k k
M-x r e p o <tab> <tab> r <tab> i <tab> <backspace>
- i <tab> <return> C-x C-b n n n <return> C-x k <return>
C-x k <return> M-x M-p <return> M-x M-p C-e <backspace>
<backspace> <backspace> C-g C-h f M-p M-p C-k r e p
o <tab> r <tab> <tab> <tab> <tab> - e <tab> m <tab>
<tab> = i <backspace> \ <backspace> <backspace> - i
<tab> <return> C-x 1 M-x M-p C-e <backspace> <backspace>
<backspace> <backspace> <backspace> <return> C-x C-f
C-x o C-x C-f C-x o C-x C-f ~ / . e m <tab> <return>
<next> C-s r e u s e <down> <down> <down> <down> <down>
<down> <down> <down> <up> <up> <up> <up> <up> <up>
M-x M-p <return> C-g C-h f <return> C-x o C-h c q C-h
k q j j j j j l l l l l l l l l l l l l l l l l l l
l l l l l l l l l l l l l l l l l l j q C-h v M-x M-p
M-p M-n <return>

Recent messages:
Composing main Info directory...done
Quit
Making completion list... [3 times]
Type C-x 1 to remove help window. 
byte-code: Command attempted to use minibuffer while in minibuffer [2 times]
Mark saved where search started
Quit
Type C-x 1 to remove help window. 
q runs the command View-quit
Quit


--
Ling Wang
Work at: ICScape(Beijing) Technology Ltd.
Graduate from: Department of Electrical Engineering, Tsinghua University
Email: an00na@...
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@...
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Re: display-buffer-reuse-frames makes View-quit abnormal

by martin rudalics :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 > After `(setq display-buffer-reuse-frames t)', `C-h f'(or `C-h v' and the
 > alike) to view help, `C-x o' to jump to the help window, `q' to quit view
 > mode, then I find `View-quit' does not restore window and buffer to
 > previous
 > state as usual, instead Emacs pops one of other buffers.

Thank you for reporting this.  The behavior you experience is due to the
following changes:

2000-08-08  Gerd Moellmann  <gerd@...>

        * help.el (print-help-return-message): When
        display-buffer-reuse-frames is set, let the help window been quit,
        instead of deleting it, which might delete a reused frame.

and

2006-04-18  Richard Stallman  <rms@...>

        * help-mode.el (help-mode): Set view-exit-action to delete window.

and

2006-05-01  Richard Stallman  <rms@...>

        * help-mode.el (help-mode): view-exit-action calls delete-window
        only when it is safe and possible.

Now with `display-buffer-reuse-frames' non-nil
`print-help-return-message' (called by C-h f ...) adds

   (W1 W2 . 'quit-window)

to `view-return-to-alist'.  With `display-buffer-reuse-frames' nil it
would add

   (W1 W2 . t)

instead, where in both cases W1 is the help window, W2 the original
window, and t means delete W1 when done, 'quit-window call that
function.

When you type "q" in window W1 the (contrived code of) `quit-window'
invoked by `view-mode-exit' will do

          (switch-to-buffer (other-buffer))))

switching in W1 to some buffer not shown in W2.

On the other hand invoking `help-mode' after (C-h f ...) has done

   (setq view-exit-action (lambda (buffer)
                           (or (window-minibuffer-p (selected-window))
                               (one-window-p t)
                               (delete-window))))

locally in *Help*.  After invoking `quit-window' as described above
`view-mode-exit' does

        (if (window-live-p old-window) ; still existing window
            (select-window old-window))

where old-window is W2.  Since W2 is still live it gets selected.
Finally, `view-mode-exit' calls `view-exit-action' with BUFFER the still
existing *Help* buffer and W2 selected.  `view-exit-action' does not pay
attention to BUFFER and deletes the selected window W2.  You are left
with W1 showing a completely unrelated buffer.

Reverting the changes above would give the correct behavior in _this_
case.  Keeping Gerd's change means that you would have to live with a
frame with W2 showing the original buffer and W1 the one selected by
`quit-window'.  Richard's change could then be modified by doing

   (setq view-exit-action (lambda (buffer)
                           (or (window-minibuffer-p (selected-window))
                               (one-window-p t)
                               (not (eq (window-buffer) buffer))
                               (delete-window))))

though I think that `view-exit-action' should _not_ fiddle with windows.

Comments welcome.



_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@...
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Parent Message unknown Re: display-buffer-reuse-frames makes View-quit abnormal

by martin rudalics :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please CC this and all related postings to emacs-pretest-bug.

 > I am not clear about the all the innards of the process of view quit, but
 > what about:
 > just let
 >
 >>`help-mode' after (C-h f ...) has done
 >
 >
 >> (setq view-exit-action (lambda (buffer)
 >>                        (or (window-minibuffer-p (selected-window))
 >>                              (one-window-p t)
 >>                             (delete-window))))

`view-exit-action' should care about BUFFER and not about any windows.

 > but let
 > `quit-window'
 > invoked by `view-mode-exit' go without
 >
 >
 >>        (switch-to-buffer (other-buffer)))),

`quit-window' is called by functions that have no relation to help,
help-mode, or view-mode.  It might be called interactively by you.
Hence, we can't change that without giving it either an additonal,
optional argument or breaking other code.

 > and let
 > view-mode-exit' go without
 >
 >
 >>      (if (window-live-p old-window)  ; still existing window
 >>          (select-window old-window)).

The same goes here: `view-mode-exit' is used by other functions as well.
Usually, selecting old-window won't harm.  That's the window where you
called C-h f from.

 > Following this line, the effective (delete-window) will be done in the help
 > window, with the original buffer in the other window, and then all is
 > restored.

Your approach would work for help-mode (it should even work if we _did_
switch buffers in `quit-window' - the window gets deleted anyway).  It
might break other modes though that don't set `view-exit-action' and
still expect old-window to get reselected.



_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@...
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Parent Message unknown Fwd: display-buffer-reuse-frames makes View-quit abnormal

by an0 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



---------- Forwarded message ----------
From: an0 <an00na@...>
Date: Jul 28, 2007 10:38 PM
Subject: Re: display-buffer-reuse-frames makes View-quit abnormal
To: martin rudalics <rudalics@...>

Thank you for your patient explanation.

I am not clear about the all the innards of the process of view quit, but what about:
just let
> `help-mode' after (C-h f ...) has done

>  (setq view-exit-action (lambda (buffer)
>                         (or (window-minibuffer-p (selected-window))
>                               (one-window-p t)
>                              (delete-window))))
but let
`quit-window'
invoked by `view-mode-exit' go without

>         (switch-to-buffer (other-buffer)))),
and let
view-mode-exit' go without

>       (if (window-live-p old-window)  ; still existing window
>           (select-window old-window)).
Following this line, the effective (delete-window) will be done in the help window, with the original buffer in the other window, and then all is restored.


--
Ling Wang
Work at: ICScape(Beijing) Technology Ltd.
Graduate from: Department of Electrical Engineering, Tsinghua University
Email: an00na@...


--
Ling Wang
Work at: ICScape(Beijing) Technology Ltd.
Graduate from: Department of Electrical Engineering, Tsinghua University
Email: an00na@...
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@...
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug