GNU bug report logs - #37840
Missing in the Emacs manuals:

Previous Next

Package: emacs;

Reported by: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>

Date: Mon, 21 Oct 2019 00:40:02 UTC

Severity: normal

Merged with 37841

Done: Lars Ingebrigtsen <larsi <at> gnus.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 37840 in the body.
You can then email your comments to 37840 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#37840; Package emacs. (Mon, 21 Oct 2019 00:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Konrad Podczeck <konrad.podczeck <at> univie.ac.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 21 Oct 2019 00:40:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: bug-gnu-emacs <at> gnu.org
Subject: Missing in the Emacs manuals:
Date: Mon, 21 Oct 2019 02:39:28 +0200
There is no detailed example in the emacs manuals on how to migrate from using "special-display-frame-alist" and "special-display-regexps" to "display-buffer-alist."

E.g., how to migrate from 

(setq special-display-frame-alist
   (quote
    ((height . 42)
    (width . 83)
    (left . 770)
    (unsplittable)
    (tool-bar-lines . 0)
    (left-fringe . 0)
    (right-fringe . 0)
    (line-spacing . 0)
    (font . "Monaco-12")
    (top . 110))))

 and

(setq special-display-regexps '((".*output*" (right-fringe . 0) (left-fringe . 0) (top . 330) (left . 152)
  (width . 86) (height . 32)
  (tool-bar-lines . 0) (font . "Menlo-10") (menu-bar-lines . 0) "[ ]?[*][^*]+[*]"))

?

Konrad




Forcibly Merged 37840 37841. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 21 Oct 2019 01:07:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Tue, 22 Oct 2019 08:44:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>, 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 22 Oct 2019 10:43:14 +0200
> There is no detailed example in the emacs manuals on how to migrate
> from using "special-display-frame-alist" and
> "special-display-regexps" to "display-buffer-alist."

I'm not sure whether I'll be able to come up with something reasonable
in this regard, mainly because I've never been able to understand the
special display function mechanism.

> E.g., how to migrate from
>
> (setq special-display-frame-alist
>     (quote
>      ((height . 42)
>      (width . 83)
>      (left . 770)
>      (unsplittable)
>      (tool-bar-lines . 0)
>      (left-fringe . 0)
>      (right-fringe . 0)
>      (line-spacing . 0)
>      (font . "Monaco-12")
>      (top . 110))))
>
>   and
>
> (setq special-display-regexps '((".*output*" (right-fringe . 0) (left-fringe . 0) (top . 330) (left . 152)
>    (width . 86) (height . 32)
>    (tool-bar-lines . 0) (font . "Menlo-10") (menu-bar-lines . 0)))

You can try the following untested snippet (your regxp looks a bit
odd, BTW):

(setq my-special-display-frame-alist
      (quote
       ((height . 42)
	(width . 83)
	(left . 770)
	(unsplittable)
	(tool-bar-lines . 0)
	(left-fringe . 0)
	(right-fringe . 0)
	(line-spacing . 0)
	(font . "Monaco-12")
	(top . 110))))

(setq my-special-display-regexps
      '((".*output*"
	 (right-fringe . 0)
	 (left-fringe . 0)
	 (top . 330)
	 (left . 152)
	 (width . 86)
	 (height . 32)
	 (tool-bar-lines . 0)
	 (font . "Menlo-10")
	 (menu-bar-lines . 0))))

(setq display-buffer-alist
      `((".*output*"
	 (display-buffer-reuse-window
	  ; display-buffer-same-window
	  ; display-buffer-pop-up-window
	  display-buffer-pop-up-frame)
	 (reusable-frames . 0) (inhibit-switch-frame . nil)
	 (pop-up-frame-parameters . ,(append (cdr my-special-display-regexps)
					       special-display-frame-alist)))))

where you have to comment-in the respective alist functions when you
use 'same-window' or 'same-frame' in your 'special-display-regexps'
settings (apparently you don't).

I can put a similar example into the Elisp manual (Eli would have to
figure out the details to omit or add) but note the following two not
entirely negligible differences:

'special-display-popup-frame' (the default for
'special-display-function') uses

       (when (cdr (assq 'same-window args))
	 (condition-case nil
	     (progn (switch-to-buffer buffer nil t) (selected-window))
	   (error nil)))

which has no direct equivalent in the 'display-buffer-alist'
ecosystem.  I used 'display-buffer-same-window' instead but that does
not obey options like 'switch-to-buffer-in-dedicated-window' or
'switch-to-buffer-preserve-window-point'.  Which means that for a
faithful migration you would have to write your own action function
here.

The second difference derives from the fact that
'special-display-popup-frame' marks the window on a new frame as
dedicated to its buffer.  This is no more needed in the
'display-buffer-alist' world because there the 'quit-restore' window
parameter takes care of the problem the former tries to solve.  Still
this means a behavioral difference that should be mentioned.  I
_cannot_ add a non-nil 'dedicated' alist entry because that would be
applied by any other action function ('display-buffer-pop-up-window'
foremost) too.

Also I have left out details like the function to be called when the
car of the ARGS argument of 'special-display-popup-frame' is a symbol
or how to treat 'special-display-buffer-names' ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 23 Oct 2019 07:26:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Wed, 23 Oct 2019 09:25:00 +0200
[Message part 1 (text/plain, inline)]
Thanks for your reply. Working on the stuff, I encountered the following problem: If, in “ display-buffer-alist”, I have the entry:

      ("[ ]?Packages[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
       (pop-up-frame-parameters
        (tool-bar-lines . 1)
	(left . 1)
	(left-fringe . 2)
        (top . 0)
	(height . 65)
	(width . 149)
	(font . "SF MONO-18")
        (line-spacing . 3)
	))

then, contrary to what is promised, this does not pop up a new frame. I figured out that the problem goes away if, in “packages.el”, I replace in the defun “list-packages” the  code (switch-to-buffer buf) by (pop-to-buffer buf). My question is how to do this on the level of customizing “display-buffer-alist”. I didn’t find anything in this regard in the manuals.




> Am 22.10.2019 um 10:43 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > There is no detailed example in the emacs manuals on how to migrate
> > from using "special-display-frame-alist" and
> > "special-display-regexps" to "display-buffer-alist."
> 
> I'm not sure whether I'll be able to come up with something reasonable
> in this regard, mainly because I've never been able to understand the
> special display function mechanism.
> 
> > E.g., how to migrate from
> >
> > (setq special-display-frame-alist
> >     (quote
> >      ((height . 42)
> >      (width . 83)
> >      (left . 770)
> >      (unsplittable)
> >      (tool-bar-lines . 0)
> >      (left-fringe . 0)
> >      (right-fringe . 0)
> >      (line-spacing . 0)
> >      (font . "Monaco-12")
> >      (top . 110))))
> >
> >   and
> >
> > (setq special-display-regexps '((".*output*" (right-fringe . 0) (left-fringe . 0) (top . 330) (left . 152)
> >    (width . 86) (height . 32)
> >    (tool-bar-lines . 0) (font . "Menlo-10") (menu-bar-lines . 0)))
> 
> You can try the following untested snippet (your regxp looks a bit
> odd, BTW):
> 
> (setq my-special-display-frame-alist
>      (quote
>       ((height . 42)
> 	(width . 83)
> 	(left . 770)
> 	(unsplittable)
> 	(tool-bar-lines . 0)
> 	(left-fringe . 0)
> 	(right-fringe . 0)
> 	(line-spacing . 0)
> 	(font . "Monaco-12")
> 	(top . 110))))
> 
> (setq my-special-display-regexps
>      '((".*output*"
> 	 (right-fringe . 0)
> 	 (left-fringe . 0)
> 	 (top . 330)
> 	 (left . 152)
> 	 (width . 86)
> 	 (height . 32)
> 	 (tool-bar-lines . 0)
> 	 (font . "Menlo-10")
> 	 (menu-bar-lines . 0))))
> 
> (setq display-buffer-alist
>      `((".*output*"
> 	 (display-buffer-reuse-window
> 	  ; display-buffer-same-window
> 	  ; display-buffer-pop-up-window
> 	  display-buffer-pop-up-frame)
> 	 (reusable-frames . 0) (inhibit-switch-frame . nil)
> 	 (pop-up-frame-parameters . ,(append (cdr my-special-display-regexps)
> 					       special-display-frame-alist)))))
> 
> where you have to comment-in the respective alist functions when you
> use 'same-window' or 'same-frame' in your 'special-display-regexps'
> settings (apparently you don't).
> 
> I can put a similar example into the Elisp manual (Eli would have to
> figure out the details to omit or add) but note the following two not
> entirely negligible differences:
> 
> 'special-display-popup-frame' (the default for
> 'special-display-function') uses
> 
>       (when (cdr (assq 'same-window args))
> 	 (condition-case nil
> 	     (progn (switch-to-buffer buffer nil t) (selected-window))
> 	   (error nil)))
> 
> which has no direct equivalent in the 'display-buffer-alist'
> ecosystem.  I used 'display-buffer-same-window' instead but that does
> not obey options like 'switch-to-buffer-in-dedicated-window' or
> 'switch-to-buffer-preserve-window-point'.  Which means that for a
> faithful migration you would have to write your own action function
> here.
> 
> The second difference derives from the fact that
> 'special-display-popup-frame' marks the window on a new frame as
> dedicated to its buffer.  This is no more needed in the
> 'display-buffer-alist' world because there the 'quit-restore' window
> parameter takes care of the problem the former tries to solve.  Still
> this means a behavioral difference that should be mentioned.  I
> _cannot_ add a non-nil 'dedicated' alist entry because that would be
> applied by any other action function ('display-buffer-pop-up-window'
> foremost) too.
> 
> Also I have left out details like the function to be called when the
> car of the ARGS argument of 'special-display-popup-frame' is a symbol
> or how to treat 'special-display-buffer-names' ...
> 
> martin

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 23 Oct 2019 07:52:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Wed, 23 Oct 2019 09:46:17 +0200
> Thanks for your reply. Working on the stuff, I encountered the following problem: If, in “ display-buffer-alist”, I have the entry:
>
>        ("[ ]?Packages[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
>         (pop-up-frame-parameters
>          (tool-bar-lines . 1)
> 	(left . 1)
> 	(left-fringe . 2)
>          (top . 0)
> 	(height . 65)
> 	(width . 149)
> 	(font . "SF MONO-18")
>          (line-spacing . 3)
> 	))
>
> then, contrary to what is promised, this does not pop up a new
> frame.

There's no promise that 'display-buffer-alist' controls the behavior
of 'switch-to-buffer'.  The latter should be used interactively (via
C-x b) only.  But since that's practically impossible given the sheer
mass of occurrences of 'switch-to-buffer' in the Emacs code base, Juri
added the 'switch-to-buffer-obey-display-actions' option.  If that is
non-nil, your use case should work.

> I figured out that the problem goes away if, in
> “packages.el”, I replace in the defun “list-packages” the code
> (switch-to-buffer buf) by (pop-to-buffer buf). My question is how to
> do this on the level of customizing “display-buffer-alist”. I didn’t
> find anything in this regard in the manuals.

'switch-to-buffer' preferably shows its buffer in the same (selected)
window.  'pop-to-buffer' has no such preference.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 28 Oct 2019 17:38:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 28 Oct 2019 18:37:26 +0100
Thanks for your reply. With the "switch-to-buffer-obey-display-actions" option, opening of files works according to "display-buffer-alist". However, now the following problem appears. E.g., I have 

      ("[ ]?mail[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
        (reusable-frames nil)
        (pop-up-frame-parameters
        (tool-bar-lines . 1)
	(left . 859)
	(left-fringe . 2)
        (top . 183)
	(height . 32)
	(width . (text-pixels . 837))
	(font . "SF MONO-18")
        (line-spacing . 3)
        ))


in "display-buffer-alist". Now if I have some buffer.foo open in its own frame, and then issue C-x m, a new message buffer pops up in its own frame, as it should be. However, after finally issuing C-c C-c to send the mail, the frame which contained the mail buffer does not disappear (as it was the case with the old special-display.regexp stuff), rather this frame shows a second instance of buffer.foo.

Thanks, 

Konrad





> Am 23.10.2019 um 09:46 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > Thanks for your reply. Working on the stuff, I encountered the following problem: If, in “ display-buffer-alist”, I have the entry:
> >
> >        ("[ ]?Packages[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
> >         (pop-up-frame-parameters
> >          (tool-bar-lines . 1)
> > 	(left . 1)
> > 	(left-fringe . 2)
> >          (top . 0)
> > 	(height . 65)
> > 	(width . 149)
> > 	(font . "SF MONO-18")
> >          (line-spacing . 3)
> > 	))
> >
> > then, contrary to what is promised, this does not pop up a new
> > frame.
> 
> There's no promise that 'display-buffer-alist' controls the behavior
> of 'switch-to-buffer'.  The latter should be used interactively (via
> C-x b) only.  But since that's practically impossible given the sheer
> mass of occurrences of 'switch-to-buffer' in the Emacs code base, Juri
> added the 'switch-to-buffer-obey-display-actions' option.  If that is
> non-nil, your use case should work.
> 
> > I figured out that the problem goes away if, in
> > “packages.el”, I replace in the defun “list-packages” the code
> > (switch-to-buffer buf) by (pop-to-buffer buf). My question is how to
> > do this on the level of customizing “display-buffer-alist”. I didn’t
> > find anything in this regard in the manuals.
> 
> 'switch-to-buffer' preferably shows its buffer in the same (selected)
> window.  'pop-to-buffer' has no such preference.
> 
> martin
> 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 28 Oct 2019 18:14:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 28 Oct 2019 19:13:14 +0100
> Now if I have some buffer.foo open in its own frame, and then issue
> C-x m, a new message buffer pops up in its own frame, as it should
> be. However, after finally issuing C-c C-c to send the mail, the
> frame which contained the mail buffer does not disappear (as it was
> the case with the old special-display.regexp stuff), rather this
> frame shows a second instance of buffer.foo.

Can you tell me the function(s) called by C-c C-c to get rid of the
window or the mail buffer?  From what you say here, the function can
be hardly 'kill-buffer' because that would not show "a second instance
of buffer.foo".  And what is a second instance of a buffer?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 28 Oct 2019 19:05:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 28 Oct 2019 20:04:39 +0100
C-c C-c in this case runs the function "message-send-and-exit” from message.el:

(defun message-send-and-exit (&optional arg)
  "Send message like `message-send', then, if no errors, exit from mail buffer.
The usage of ARG is defined by the instance that called Message.
It should typically alter the sending method in some way or other."
  (interactive "P")
  (let ((buf (current-buffer))
	(actions message-exit-actions))
    (when (and (message-send arg)
	       (buffer-name buf))
      (message-bury buf)
      (if message-kill-buffer-on-exit
	  (kill-buffer buf))
      (message-do-actions actions)
      t)))

By “second instance” I meant the following situation:

Suppose originally I had frame A with buffer.foo and frame B with buffer.mail,

then after C-c  C-c	I get

frame A with buffer.foo and frame with B buffer.foo


> Am 28.10.2019 um 19:13 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > Now if I have some buffer.foo open in its own frame, and then issue
> > C-x m, a new message buffer pops up in its own frame, as it should
> > be. However, after finally issuing C-c C-c to send the mail, the
> > frame which contained the mail buffer does not disappear (as it was
> > the case with the old special-display.regexp stuff), rather this
> > frame shows a second instance of buffer.foo.
> 
> Can you tell me the function(s) called by C-c C-c to get rid of the
> window or the mail buffer?  From what you say here, the function can
> be hardly 'kill-buffer' because that would not show "a second instance
> of buffer.foo".  And what is a second instance of a buffer?
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Tue, 29 Oct 2019 09:29:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 29 Oct 2019 10:28:14 +0100
>        (message-bury buf)

'message-bury' calls 'bury-buffer' in a pretty contrived way instead
of simply calling 'quit-restore-window'.  But as long as I don't know
what it is really supposed to do, I can't change it.

In practice, this means that you have to include a 'dedicated' entry
like

      ("[ ]?mail[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
        (reusable-frames nil)
	(dedicated . t)
        (pop-up-frame-parameters
        (tool-bar-lines . 1)
	(left . 859)
	(left-fringe . 2)
        (top . 183)
	(height . 32)
	(width . (text-pixels . 837))
	(font . "SF MONO-18")
        (line-spacing . 3)
        ))

and I will add an according advice to the manual once your setup has
stabilized.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 30 Oct 2019 00:57:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Wed, 30 Oct 2019 01:56:02 +0100
The entry (dedicated . t) did the job. (BTW, where is this possibility documented?)

Thanks,  

Konrad

> Am 29.10.2019 um 10:28 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> >        (message-bury buf)
> 
> 'message-bury' calls 'bury-buffer' in a pretty contrived way instead
> of simply calling 'quit-restore-window'.  But as long as I don't know
> what it is really supposed to do, I can't change it.
> 
> In practice, this means that you have to include a 'dedicated' entry
> like
> 
>      ("[ ]?mail[ ]?" (display-buffer-reuse-window display-buffer-pop-up-frame)
>        (reusable-frames nil)
> 	(dedicated . t)
>        (pop-up-frame-parameters
>        (tool-bar-lines . 1)
> 	(left . 859)
> 	(left-fringe . 2)
>        (top . 183)
> 	(height . 32)
> 	(width . (text-pixels . 837))
> 	(font . "SF MONO-18")
>        (line-spacing . 3)
>        ))
> 
> and I will add an according advice to the manual once your setup has
> stabilized.
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 30 Oct 2019 08:15:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Wed, 30 Oct 2019 09:14:22 +0100
> The entry (dedicated . t) did the job. (BTW, where is this possibility documented?)

In section 28.15 Dedicated Windows of the Elisp manual.  But as I said
in my first answer in this thread, indiscriminately applying a non-nil
'dedicated' entry is not generally advisable since it might affect
windows that pop up on the same frame too, with the consequence that
you can no longer switch buffers in such windows.  And it won't handle
the case where the buffer is shown in the selected window either.

As explained in section 28.16 Quitting Windows of the Elisp manual,
'quit-restore-window' could automatically DTRT for windows like that
used for composing mail, so there would be no need for a 'dedicated'
entry.  But 'message-send-and-exit' calls 'message-bury' and that uses
a slightly weird strategy to possibly get rid of the window with the
consequence that 'quit-restore-window' won't even get called here.

A zache Gschicht, so to say.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 30 Oct 2019 20:38:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Wed, 30 Oct 2019 21:37:07 +0100
Thanks for your response. I have another question, on the following customization:


(setq display-buffer-base-action
       (quote (
  (display-buffer-reuse-window display-buffer-pop-up-frame)
  (reusable-frames . t)
 )))

(setq display-buffer-alist
       (quote (
      ("\\*[^s][^s]" (display-buffer-reuse-window display-buffer-pop-up-frame)
       (pop-up-frame-parameters
        (width . 92)
        (height . 48)
        (left . 1150)
        (unsplittable)
        (tool-bar-lines . 0)
        (left-fringe . 0)
        (right-fringe . 0)
        (line-spacing . 0)
        (font . "Monaco-12")
        (top . 180)
      ))
)))

Suppose I have buffer A open in frame A. Issuing occur->some word, the occur buffer pops up in its own frame, say frame B, as intended with the above customization. Moreover, frame B has input focus. Returning to frame A, without closing frame B, and issuing another time occur-> some word, frame B now shows the new occur buffer, as intended, but this time frame B lacks input focus. What goes wrong the second time?

Let me mention that if, in window.el, I add 

(x-focus-frame (window-frame window))

at the very end of the defun "display-buffer-reuse-window", the problem goes away, i.e., in the above example, frame B gets input focus after every invocation of occur in frame A. How can I get this with a suitable customization on the "display-buffer-alist" level?

Thanks

Konrad






 

> Am 30.10.2019 um 09:14 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > The entry (dedicated . t) did the job. (BTW, where is this possibility documented?)
> 
> In section 28.15 Dedicated Windows of the Elisp manual.  But as I said
> in my first answer in this thread, indiscriminately applying a non-nil
> 'dedicated' entry is not generally advisable since it might affect
> windows that pop up on the same frame too, with the consequence that
> you can no longer switch buffers in such windows.  And it won't handle
> the case where the buffer is shown in the selected window either.
> 
> As explained in section 28.16 Quitting Windows of the Elisp manual,
> 'quit-restore-window' could automatically DTRT for windows like that
> used for composing mail, so there would be no need for a 'dedicated'
> entry.  But 'message-send-and-exit' calls 'message-bury' and that uses
> a slightly weird strategy to possibly get rid of the window with the
> consequence that 'quit-restore-window' won't even get called here.
> 
> A zache Gschicht, so to say.
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 31 Oct 2019 08:00:03 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 31 Oct 2019 08:59:06 +0100
> Suppose I have buffer A open in frame A. Issuing occur->some word,
> the occur buffer pops up in its own frame, say frame B, as intended
> with the above customization. Moreover, frame B has input
> focus. Returning to frame A, without closing frame B, and issuing
> another time occur-> some word, frame B now shows the new occur
> buffer, as intended, but this time frame B lacks input focus. What
> goes wrong the second time?

Nothing, I suppose.  'occur' (I suppose that's the function you
invoke) calls 'occur-1' and that one simply does

            (display-buffer occur-buf)

which according to its doc-string does

  Display BUFFER-OR-NAME in some window, without selecting it.

IIUC the philosophy of 'occur' is given in its doc-string as

  The lines are shown in a buffer named `*Occur*'.
  It serves as a menu to find any of the occurrences in this buffer.

and programs usually don't preselect menus either.  The user has to
reach for the mouse or type some key to go there first ...

So the question is rather "what goes wrong the first time?".  The
answer to that is that, when 'display-buffer' creates a new frame, the
window manager usually also gives that new frame input focus.  Some
window managers allow to change that for all applications.  If you add
a non-nil 'no-focus-on-map' entry to your 'pop-up-frame-parameters',
Emacs will ask the window manager to not focus the new frame and
channces are that your window manager complies.

> Let me mention that if, in window.el, I add
>
> (x-focus-frame (window-frame window))
>
> at the very end of the defun "display-buffer-reuse-window", the
> problem goes away, i.e., in the above example, frame B gets input
> focus after every invocation of occur in frame A. How can I get this
> with a suitable customization on the "display-buffer-alist" level?

You can't.  I think the most simple way to achieve what you want is to
add a function to 'occur-hook' that does search for a window that
shows the current buffer and, if it finds such a window, invokes
'select-frame-set-input-focus' for that window's frame.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 02 Nov 2019 21:48:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 2 Nov 2019 22:47:40 +0100
I don't find anything in the manual related to the following:


Suppose, without any display-buffer-alist customization, I have just

(setq display-buffer-base-action
       (quote (
  (display-buffer-reuse-window display-buffer-pop-up-frame)
  (reusable-frames . x)
)))

in my init file, where x can be any of  0,1, nil, visible, all these choices don’t matter for this: If I open Emacs, the initial frame shows up, and any file loaded via recent-files, or by dragging on the Emacs icon, or by clicking on the file icon, shows up in the initial frame, contrary to what is advertised in the manual. However, once a file is loaded, then re-selecting it via Menu->Buffers, pops it up in a new frame (with properties as specified in defaults-frame-alist). So, what is the relation between "display-buffer-base-action” and “default-frame-alist”?

Thanks,

Konrad


> Am 31.10.2019 um 08:59 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > Suppose I have buffer A open in frame A. Issuing occur->some word,
> > the occur buffer pops up in its own frame, say frame B, as intended
> > with the above customization. Moreover, frame B has input
> > focus. Returning to frame A, without closing frame B, and issuing
> > another time occur-> some word, frame B now shows the new occur
> > buffer, as intended, but this time frame B lacks input focus. What
> > goes wrong the second time?
> 
> Nothing, I suppose.  'occur' (I suppose that's the function you
> invoke) calls 'occur-1' and that one simply does
> 
>            (display-buffer occur-buf)
> 
> which according to its doc-string does
> 
>  Display BUFFER-OR-NAME in some window, without selecting it.
> 
> IIUC the philosophy of 'occur' is given in its doc-string as
> 
>  The lines are shown in a buffer named `*Occur*'.
>  It serves as a menu to find any of the occurrences in this buffer.
> 
> and programs usually don't preselect menus either.  The user has to
> reach for the mouse or type some key to go there first ...
> 
> So the question is rather "what goes wrong the first time?".  The
> answer to that is that, when 'display-buffer' creates a new frame, the
> window manager usually also gives that new frame input focus.  Some
> window managers allow to change that for all applications.  If you add
> a non-nil 'no-focus-on-map' entry to your 'pop-up-frame-parameters',
> Emacs will ask the window manager to not focus the new frame and
> channces are that your window manager complies.
> 
> > Let me mention that if, in window.el, I add
> >
> > (x-focus-frame (window-frame window))
> >
> > at the very end of the defun "display-buffer-reuse-window", the
> > problem goes away, i.e., in the above example, frame B gets input
> > focus after every invocation of occur in frame A. How can I get this
> > with a suitable customization on the "display-buffer-alist" level?
> 
> You can't.  I think the most simple way to achieve what you want is to
> add a function to 'occur-hook' that does search for a window that
> shows the current buffer and, if it finds such a window, invokes
> 'select-frame-set-input-focus' for that window's frame.
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 04 Nov 2019 09:07:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 4 Nov 2019 10:06:46 +0100
> Suppose, without any display-buffer-alist customization, I have just
>
> (setq display-buffer-base-action
>         (quote (
>    (display-buffer-reuse-window display-buffer-pop-up-frame)
>    (reusable-frames . x)
> )))
>
> in my init file, where x can be any of 0,1, nil, visible, all these
> choices don’t matter for this: If I open Emacs, the initial frame
> shows up, and any file loaded via recent-files, or by dragging on
> the Emacs icon, or by clicking on the file icon, shows up in the
> initial frame, contrary to what is advertised in the
> manual.

What _is_ advertised in the manual?

> However, once a file is loaded, then re-selecting it via
> Menu->Buffers, pops it up in a new frame (with properties as
> specified in defaults-frame-alist). So, what is the relation between
> "display-buffer-base-action” and “default-frame-alist”?

If a new frame is created by 'display-buffer', its parameters are
determined by

(1) any 'pop-up-frame-parameters' entry found,

(2) the value of 'pop-up-frame-alist' (if the function specified by
    'pop-up-frame-function' processes it - the default does) and

(3) the value of 'default-frame-alist'.

So if you use the 'display-buffer-base-action' specification from the
top, only 'default-frame-alist' will be used because you neither
customized any 'pop-up-frame-parameters' nor 'pop-up-frame-alist' (the
latter should not be used anyway).  All based on the assumption that
you have customized 'switch-to-buffer-obey-display-actions' so that
Menu->Buffers indeed tries to pop to the buffer.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 04 Nov 2019 11:21:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 4 Nov 2019 12:20:11 +0100
[Message part 1 (text/plain, inline)]

> Am 04.11.2019 um 10:06 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > Suppose, without any display-buffer-alist customization, I have just
> >
> > (setq display-buffer-base-action
> >         (quote (
> >    (display-buffer-reuse-window display-buffer-pop-up-frame)
> >    (reusable-frames . x)
> > )))
> >
> > in my init file, where x can be any of 0,1, nil, visible, all these
> > choices don’t matter for this: If I open Emacs, the initial frame
> > shows up, and any file loaded via recent-files, or by dragging on
> > the Emacs icon, or by clicking on the file icon, shows up in the
> > initial frame, contrary to what is advertised in the
> > manual.
> 
> What _is_ advertised in the manual?

To quote from Section 28.13.5:

Let's consider a user who, as a rule, prefers to display buffers on another frame. Such a user might provide the following customization:
     (customize-set-variable
      'display-buffer-base-action
      '((display-buffer-reuse-window display-buffer-pop-up-frame)
        (reusable-frames . 0)))
This setting will cause display-buffer to first try to find a window showing the buffer on a visible or iconified frame and, if no such frame exists, pop up a new frame.


The words  “another”  and “new”  suggest a behavior different from what I described above.


> 
> > However, once a file is loaded, then re-selecting it via
> > Menu->Buffers, pops it up in a new frame (with properties as
> > specified in defaults-frame-alist). So, what is the relation between
> > "display-buffer-base-action” and “default-frame-alist”?
> 
> If a new frame is created by 'display-buffer', its parameters are
> determined by
> 
> (1) any 'pop-up-frame-parameters' entry found,
> 
> (2) the value of 'pop-up-frame-alist' (if the function specified by
>    'pop-up-frame-function' processes it - the default does) and
> 
> (3) the value of 'default-frame-alist'.
> 
> So if you use the 'display-buffer-base-action' specification from the
> top, only 'default-frame-alist' will be used because you neither
> customized any 'pop-up-frame-parameters' nor 'pop-up-frame-alist' (the
> latter should not be used anyway).  All based on the assumption that
> you have customized 'switch-to-buffer-obey-display-actions' so that
> Menu->Buffers indeed tries to pop to the buffer.
> 
> martin
> 

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 04 Nov 2019 18:28:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 4 Nov 2019 19:27:22 +0100
>> What _is_ advertised in the manual?
>
> To quote from Section 28.13.5:
>
> Let's consider a user who, as a rule, prefers to display buffers on another frame. Such a user might provide the following customization:
>       (customize-set-variable
>        'display-buffer-base-action
>        '((display-buffer-reuse-window display-buffer-pop-up-frame)
>          (reusable-frames . 0)))
> This setting will cause display-buffer to first try to find a window showing the buffer on a visible or iconified frame and, if no such frame exists, pop up a new frame.
>
>
> The words  “another”  and “new”  suggest a behavior different from what I described above.

Right.  But this text talks about 'display-buffer' only.  When you
choose a buffer from the Buffers menu you invoke the function
specified by 'menu-bar-select-buffer-function' and the default for
that is ‘switch-to-buffer’ which does not, by default, invoke
'display-buffer'.  So the text you quote does not apply in this case.
It will apply though if you set 'menu-bar-select-buffer-function' to
'pop-to-buffer' or set 'switch-to-buffer-obey-display-actions' to a
non-nil value.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 04 Nov 2019 19:11:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 4 Nov 2019 20:10:26 +0100
> I set 'switch-to-buffer-obey-display-actions’ to t, so to a non-nil value!

My bad.  According to its doc-string

  If non-nil, `switch-to-buffer' runs `pop-to-buffer-same-window' instead.

it just pops to the buffer in the same window and even using
'inhibit-same-window' won't prevent it from doing that.  So in this
particular case you have to set 'menu-bar-select-buffer-function' to
'pop-to-buffer'.

As for the general case I wouldn't know.  Juri, how about a special
value say 'strict' for 'switch-to-buffer-obey-display-actions' that
simply makes it behave like 'pop-to-buffer'?  Or at least obey
'inhibit-same-window'?  Those hard-coded 'switch-to-buffer' instances
are really hard to get by.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Wed, 06 Nov 2019 22:43:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 07 Nov 2019 00:41:17 +0200
>> I set 'switch-to-buffer-obey-display-actions’ to t, so to a non-nil value!
>
> My bad.  According to its doc-string
>
>   If non-nil, `switch-to-buffer' runs `pop-to-buffer-same-window' instead.
>
> it just pops to the buffer in the same window and even using
> 'inhibit-same-window' won't prevent it from doing that.  So in this
> particular case you have to set 'menu-bar-select-buffer-function' to
> 'pop-to-buffer'.
>
> As for the general case I wouldn't know.  Juri, how about a special
> value say 'strict' for 'switch-to-buffer-obey-display-actions' that
> simply makes it behave like 'pop-to-buffer'?  Or at least obey
> 'inhibit-same-window'?  Those hard-coded 'switch-to-buffer' instances
> are really hard to get by.

But pop-to-buffer-same-window still follows rules from
display-buffer-alist that can override inhibit-same-window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 07 Nov 2019 08:41:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 37840 <at> debbugs.gnu.org, Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 7 Nov 2019 09:39:50 +0100
> But pop-to-buffer-same-window still follows rules from
> display-buffer-alist that can override inhibit-same-window.

OK.  Then customizing 'display-buffer-base-action' and
'switch-to-buffer-obey-display-actions' alone is not sufficient for
overriding the behavior of 'switch-to-buffer'.  The user has to
customize 'display-buffer-alist' as well.

This means that for Konrad's scenario to work, the minimum requirement
is

(custom-set-variables
 '(display-buffer-base-action
   '((display-buffer-reuse-window display-buffer-pop-up-frame)
     (reusable-frames . 0)))
 '(display-buffer-alist
   '(("\\*.*\\*" . (nil (inhibit-same-window . t)))))
 '(switch-to-buffer-obey-display-actions t))

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 07 Nov 2019 22:59:05 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 07 Nov 2019 23:58:24 +0200
>> But pop-to-buffer-same-window still follows rules from
>> display-buffer-alist that can override inhibit-same-window.
>
> OK.  Then customizing 'display-buffer-base-action' and
> 'switch-to-buffer-obey-display-actions' alone is not sufficient for
> overriding the behavior of 'switch-to-buffer'.  The user has to
> customize 'display-buffer-alist' as well.
>
> This means that for Konrad's scenario to work, the minimum requirement
> is
>
> (custom-set-variables
>  '(display-buffer-base-action
>    '((display-buffer-reuse-window display-buffer-pop-up-frame)
>      (reusable-frames . 0)))
>  '(display-buffer-alist
>    '(("\\*.*\\*" . (nil (inhibit-same-window . t)))))
>  '(switch-to-buffer-obey-display-actions t))

This doesn't look good, indeed.

Then maybe switch-to-buffer-obey-display-actions should be replaced
by another variable switch-to-buffer-display-function that could be
customized to possible options #'pop-to-buffer-same-window,
#'pop-to-buffer or any other custom function (and nil by default).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 08 Nov 2019 09:22:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 37840 <at> debbugs.gnu.org, Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 8 Nov 2019 10:20:59 +0100
>> This means that for Konrad's scenario to work, the minimum requirement
>> is
>>
>> (custom-set-variables
>>   '(display-buffer-base-action
>>     '((display-buffer-reuse-window display-buffer-pop-up-frame)
>>       (reusable-frames . 0)))
>>   '(display-buffer-alist
>>     '(("\\*.*\\*" . (nil (inhibit-same-window . t)))))
>>   '(switch-to-buffer-obey-display-actions t))
>
> This doesn't look good, indeed.
>
> Then maybe switch-to-buffer-obey-display-actions should be replaced
> by another variable switch-to-buffer-display-function that could be
> customized to possible options #'pop-to-buffer-same-window,
> #'pop-to-buffer or any other custom function (and nil by default).

We can do whatever we think best as long as Emacs 27 is not out yet.

If we leave things as they are we should probably mention explicitly
that 'display-buffer-base-action' gets overridden when this option is
set.  We should also say how 'switch-to-buffer-preserve-window-point'
is or is not respected in that case (I'm slightly confused about how
it works now).

Otherwise, I see no need for renaming the option.  We could simply
allow its value to be an ordinary display action with functions and an
alist and have 'switch-to-buffer' act accordingly.  Or am I missing
something?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 08 Nov 2019 11:05:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 8 Nov 2019 12:04:26 +0100

> Am 08.11.2019 um 10:20 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> >> This means that for Konrad's scenario to work, the minimum requirement
> >> is
> >>
> >> (custom-set-variables
> >>   '(display-buffer-base-action
> >>     '((display-buffer-reuse-window display-buffer-pop-up-frame)
> >>       (reusable-frames . 0)))
> >>   '(display-buffer-alist
> >>     '(("\\*.*\\*" . (nil (inhibit-same-window . t)))))
> >>   '(switch-to-buffer-obey-display-actions t))

While this works in most cases, for me it still gives a problem with Speedbar: Suppose frame A has input focus, showing buffer A. Open Speedbar via the menu. Then the Speedbar frame pops up, with input focus, but with the same layout as frame A had, and a frame B opens, with the layput intended for the Speedbar frame, but showing buffer A. 

Konrad

> >
> > This doesn't look good, indeed.
> >
> > Then maybe switch-to-buffer-obey-display-actions should be replaced
> > by another variable switch-to-buffer-display-function that could be
> > customized to possible options #'pop-to-buffer-same-window,
> > #'pop-to-buffer or any other custom function (and nil by default).
> 
> We can do whatever we think best as long as Emacs 27 is not out yet.
> 
> If we leave things as they are we should probably mention explicitly
> that 'display-buffer-base-action' gets overridden when this option is
> set.  We should also say how 'switch-to-buffer-preserve-window-point'
> is or is not respected in that case (I'm slightly confused about how
> it works now).
> 
> Otherwise, I see no need for renaming the option.  We could simply
> allow its value to be an ordinary display action with functions and an
> alist and have 'switch-to-buffer' act accordingly.  Or am I missing
> something?
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 08 Nov 2019 18:28:03 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 8 Nov 2019 19:27:08 +0100
> While this works in most cases, for me it still gives a problem with
> Speedbar: Suppose frame A has input focus, showing buffer A. Open
> Speedbar via the menu. Then the Speedbar frame pops up, with input
> focus, but with the same layout as frame A had, and a frame B opens,
> with the layput intended for the Speedbar frame, but showing buffer
> A.

I cannot reproduce that here.  When with emacs -Q I ask to show the
speedbar from the Options menu, the speedbar pops up the same way
regardless of whether I have done these customizations or not.  Maybe
I don't understand the meaning of "layout".

What I did notice is that clicking on a file in the speedbar frame
always opens it in the same window of the initial frame thus maybe
disregarding the customizations but that's a different issue I
suppose.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 08 Nov 2019 21:13:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 8 Nov 2019 22:12:09 +0100

> Am 08.11.2019 um 19:27 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > While this works in most cases, for me it still gives a problem with
> > Speedbar: Suppose frame A has input focus, showing buffer A. Open
> > Speedbar via the menu. Then the Speedbar frame pops up, with input
> > focus, but with the same layout as frame A had, and a frame B opens,
> > with the layput intended for the Speedbar frame, but showing buffer
> > A.
> 
> I cannot reproduce that here.  

I used this customization:

(custom-set-variables
'(display-buffer-base-action
  '((display-buffer-reuse-window display-buffer-pop-up-frame)
    (reusable-frames . 0)))
'(display-buffer-alist
  '((".*" . (nil (inhibit-same-window . t)))))
'(switch-to-buffer-obey-display-actions t))

to get new frames for any type of file, and then Speedbar popped up with a layout according to defaults-frame-alist; by “layout” I mean frame geometry, font, color etc. 

Konrad

> When with emacs -Q I ask to show the
> speedbar from the Options menu, the speedbar pops up the same way
> regardless of whether I have done these customizations or not.  Maybe
> I don't understand the meaning of "layout".
> 
> What I did notice is that clicking on a file in the speedbar frame
> always opens it in the same window of the initial frame thus maybe
> disregarding the customizations but that's a different issue I
> suppose.
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 09 Nov 2019 09:02:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 9 Nov 2019 10:01:44 +0100
> I used this customization:
>
> (custom-set-variables
> '(display-buffer-base-action
>    '((display-buffer-reuse-window display-buffer-pop-up-frame)
>      (reusable-frames . 0)))
> '(display-buffer-alist
>    '((".*" . (nil (inhibit-same-window . t)))))
> '(switch-to-buffer-obey-display-actions t))
>
> to get new frames for any type of file, and then Speedbar popped up
> with a layout according to defaults-frame-alist; by “layout” I mean
> frame geometry, font, color etc.

That means "any type of buffer" and is obviously too strong.  Unless
you make your regexp more stringent, you will see similar problems all
over your session.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sun, 10 Nov 2019 16:46:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sun, 10 Nov 2019 17:44:54 +0100

> Am 09.11.2019 um 10:01 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > I used this customization:
> >
> > (custom-set-variables
> > '(display-buffer-base-action
> >    '((display-buffer-reuse-window display-buffer-pop-up-frame)
> >      (reusable-frames . 0)))
> > '(display-buffer-alist
> >    '((".*" . (nil (inhibit-same-window . t)))))
> > '(switch-to-buffer-obey-display-actions t))
> >
> > to get new frames for any type of file, and then Speedbar popped up
> > with a layout according to defaults-frame-alist; by “layout” I mean
> > frame geometry, font, color etc.
> 
> That means "any type of buffer" and is obviously too strong.  Unless
> you make your regexp more stringent, you will see similar problems all
> over your session.

So what is the correct customization if I wish to have _every_ buffer in its own (new) frame, just different buffer types having different frame types, the latter meaning different geometry, fonts etc.?


Konrad






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sun, 10 Nov 2019 18:34:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sun, 10 Nov 2019 19:33:17 +0100
> So what is the correct customization if I wish to have _every_
> buffer in its own (new) frame, just different buffer types having
> different frame types, the latter meaning different geometry, fonts
> etc.?

I'm afraid there's none.  The reason is a technical one.  The speedbar
code uses 'switch-to-buffer' internally to switch to its own buffer in
its own window on its own frame.  Any customization of
'switch-to-buffer' to do something like switch to _any_ buffer in
another frame will make the speedbar choke because its buffer won't be
displayed in the same window where it expects it.

Note that 'switch-to-buffer-obey-display-actions' is a new addition
that has not been yet tested extensively.  In earlier versions you had
no possibility customizing the behavior of 'switch-to-buffer'.  In
practice, it always used the selected window for displaying the
buffer.

You could try to replace the regexp in 'display-buffer-alist' with a
function that filters out all buffers that are in a sense special like
the speedbar buffer but I'm afraid that you will encounter too many
instances of internal uses of 'switch-to-buffer' so you will soon or
later get tired of such an approach.

The other approach is to specify in that function all buffers that
interest you (mostly based on the extension of the file they visit)
instead of _every_ buffer.  Would that be so difficult?

Finally, note that if you make sure that practically all windows you
use are strongly dedicated to their buffers, 'switch-to-buffer' calls
will respect that.  For example, if with emacs -Q I do

(custom-set-variables
 '(display-buffer-base-action
   '((display-buffer-reuse-window display-buffer-pop-up-frame)
     (dedicated . t)
     (reusable-frames . 0))))

(set-window-dedicated-p nil t)

and then choose *Messages* from the Buffers menu, it will pop up in a
new frame and the speedbar will work normally.  Note, however, that
strongly dedicated windows may have other disadvantages you will have
to get used to.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sun, 10 Nov 2019 20:56:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sun, 10 Nov 2019 22:11:06 +0200
>> Then maybe switch-to-buffer-obey-display-actions should be replaced
>> by another variable switch-to-buffer-display-function that could be
>> customized to possible options #'pop-to-buffer-same-window,
>> #'pop-to-buffer or any other custom function (and nil by default).
>
> We can do whatever we think best as long as Emacs 27 is not out yet.
>
> If we leave things as they are we should probably mention explicitly
> that 'display-buffer-base-action' gets overridden when this option is
> set.  We should also say how 'switch-to-buffer-preserve-window-point'
> is or is not respected in that case (I'm slightly confused about how
> it works now).
>
> Otherwise, I see no need for renaming the option.  We could simply
> allow its value to be an ordinary display action with functions and an
> alist and have 'switch-to-buffer' act accordingly.  Or am I missing
> something?

I agree.  Adding support for display actions with functions to the
existing variable seems the best solution that would cover more use cases.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 14 Nov 2019 10:04:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 14 Nov 2019 12:03:20 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sun, 10 Nov 2019 19:33:17 +0100
> Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
> 
> The speedbar code uses 'switch-to-buffer' internally to switch to
> its own buffer in its own window on its own frame.  Any
> customization of 'switch-to-buffer' to do something like switch to
> _any_ buffer in another frame will make the speedbar choke because
> its buffer won't be displayed in the same window where it expects
> it.

That seems unfortunate.  Can we somehow make Speedbar insulated from
the switch-to-buffer customizations?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 14 Nov 2019 18:20:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 14 Nov 2019 19:18:48 +0100
[Message part 1 (text/plain, inline)]
> That seems unfortunate.  Can we somehow make Speedbar insulated from
> the switch-to-buffer customizations?

The attached patch should do that.  But there are probably too many
similar cases out there.  Strictly spoken we should check each of our
'switch-to-buffer' calls for whether to

(1) convert it to 'set-window-buffer' (so no customization ever
    affects it),

(2) bind 'switch-to-buffer-obey-display-actions' to nil around it (to
    bow out comme il faut when the window is a minibuffer window or
    dedicated to its buffer),

(3) call 'pop-to-buffer-same-window' instead, or

(4) leave it alone.

martin
[dframe.diffs (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Thu, 14 Nov 2019 18:37:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Thu, 14 Nov 2019 20:35:36 +0200
> Cc: konrad.podczeck <at> univie.ac.at, 37840 <at> debbugs.gnu.org, juri <at> linkov.net
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Thu, 14 Nov 2019 19:18:48 +0100
> 
>  > That seems unfortunate.  Can we somehow make Speedbar insulated from
>  > the switch-to-buffer customizations?
> 
> The attached patch should do that.

LGTM, thanks.

> But there are probably too many similar cases out there.  Strictly
> spoken we should check each of our 'switch-to-buffer' calls for
> whether to
> 
> (1) convert it to 'set-window-buffer' (so no customization ever
>      affects it),
> 
> (2) bind 'switch-to-buffer-obey-display-actions' to nil around it (to
>      bow out comme il faut when the window is a minibuffer window or
>      dedicated to its buffer),
> 
> (3) call 'pop-to-buffer-same-window' instead, or
> 
> (4) leave it alone.

I think you are right.  Volunteers are welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 15 Nov 2019 08:52:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 15 Nov 2019 09:50:54 +0100
>> The attached patch should do that.
>
> LGTM, thanks.

Installed.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 22 Nov 2019 13:11:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 22 Nov 2019 14:09:58 +0100
> 
> The other approach is to specify in that function all buffers that
> interest you (mostly based on the extension of the file they visit)
> instead of _every_ buffer.  Would that be so difficult?
> 



> 
> The other approach is to specify in that function all buffers that
> interest you (mostly based on the extension of the file they visit)
> instead of _every_ buffer.  Would that be so difficult?
> 


I followed this advice, and the new display-buffer customization mechanism works indeed great. However,  the following problem arises. Suppose I have the customization

(customize-set-variable 'display-buffer-base-action
  '((display-buffer-reuse-window display-buffer-pop-up-frame)
    (reusable-frames . t)))

(customize-set-variable 'display-buffer-alist
     '(("\\`\\*[^s][^s].*\\*\\'"
      (display-buffer-reuse-window display-buffer-pop-up-frame)
       (dedicated . t)
       (pop-up-frame-parameters
       (width . 83)
       (height . 42)
       (left . 778)
       (unsplittable)
       (tool-bar-lines . 0)
       (left-fringe . 0)
       (right-fringe . 0)
       (line-spacing . 0)
       (font . "Monaco-12")
       (top . 110)
       ))
    ("[.]"
      (display-buffer-reuse-window display-buffer-pop-up-frame)
       (pop-up-frame-parameters
       (tool-bar-lines . 1)
       (left . 1)
       (left-fringe . 2)
       (top . 0)
       (height . 46)
       (width . 80)
       (font . "SF MONO-15")
       (line-spacing . 3)
      ))))

With this, start Emacs, open a file, foo.tex say, and in the mini-buffer of the frame displaying foo.tex do occur->some text, so that the occur-buffer displays in its own frame. Now, in the mini-buffer of the frame with foo.tex do bury-buffer. Then also this frame displays the occur-buffer, so that I end up with two frames displaying the same occur-buffer.  How to solve this problem?

Konrad





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 22 Nov 2019 17:50:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 22 Nov 2019 18:49:42 +0100
[Message part 1 (text/plain, inline)]
> With this, start Emacs, open a file, foo.tex say, and in the
> mini-buffer of the frame displaying foo.tex do occur->some text, so
> that the occur-buffer displays in its own frame. Now, in the
> mini-buffer of the frame with foo.tex do bury-buffer. Then also this
> frame displays the occur-buffer, so that I end up with two frames
> displaying the same occur-buffer.  How to solve this problem?

You can't and I am to blame for that.  'switch-to-visible-buffer' is
simply too weak to handle your case.  Please apply the attached patch
and set 'switch-to-buffer-skip-visible' to 'visible or t.

Eli this was a regression in Emacs 24 that went unnoticed so far.  Any
objections to install?

martin
[switch-to-buffer-skip-visible.diffs (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Fri, 22 Nov 2019 19:23:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Fri, 22 Nov 2019 21:22:34 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Fri, 22 Nov 2019 18:49:42 +0100
> Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
> 
> Eli this was a regression in Emacs 24 that went unnoticed so far.  Any
> objections to install?

Any reasons I should consider to object?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 23 Nov 2019 01:43:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, juri <at> linkov.net, 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 23 Nov 2019 02:42:18 +0100
The patch does not do the job. With the customization from my previous mail, start Emacs, open, say, foo.tex, and then do occur->some text. In the frame with the occur buffer, do bury buffer, so that the frame with the occur-buffer becomes iconified, so everything is good up to now. But then, doing bury buffer in the frame displaying foo.tex, the message-buffer displays in that frame, then doing again bury-buffer in that frame, the occur-buffer shows up, again in the frame originally intended for foo.tex, that is in the wrong frame, i.e., not as intended with the display-buffer-alist customization.

Would it not be better to adopt a more radical approach? Say that there are two basic defaults between which a user can choose: one as it is now, and a second one where there is a strict one-to-one correspondence between buffers and frames (i.e., in the terminology of Emacs, with no “windows” at all). Given the second basis default, the user could then customize whether for some buffer-types he/she wants to have them displayed in windows, or, depending on the buffer-type, customize geometry, fonts etc. of frames.

Konrad

> Am 22.11.2019 um 20:22 schrieb Eli Zaretskii <eliz <at> gnu.org>:
> 
>> From: martin rudalics <rudalics <at> gmx.at>
>> Date: Fri, 22 Nov 2019 18:49:42 +0100
>> Cc: 37840 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
>> 
>> Eli this was a regression in Emacs 24 that went unnoticed so far.  Any
>> objections to install?
> 
> Any reasons I should consider to object?
> 
> Thanks.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 23 Nov 2019 08:16:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 23 Nov 2019 09:15:30 +0100
> Any reasons I should consider to object?

None so far.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 23 Nov 2019 08:18:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>,
 Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 23 Nov 2019 09:16:09 +0100
> The patch does not do the job. With the customization from my
> previous mail, start Emacs, open, say, foo.tex, and then do
> occur->some text. In the frame with the occur buffer, do bury
> buffer, so that the frame with the occur-buffer becomes iconified,
> so everything is good up to now. But then, doing bury buffer in the
> frame displaying foo.tex, the message-buffer displays in that frame,
> then doing again bury-buffer in that frame, the occur-buffer shows
> up, again in the frame originally intended for foo.tex, that is in
> the wrong frame, i.e., not as intended with the display-buffer-alist
> customization.

If you want to keep the occur-buffer in an iconified frame, you have
to customize 'switch-to-buffer-skip-visible' to 0 or t in order to
avoid switching to it automatically in another window.  When I do that
here, 'bury-buffer' switches between foo.tex, *scratch* and *Messages*
only.

> Would it not be better to adopt a more radical approach? Say that
> there are two basic defaults between which a user can choose: one as
> it is now, and a second one where there is a strict one-to-one
> correspondence between buffers and frames (i.e., in the terminology
> of Emacs, with no “windows” at all). Given the second basis default,
> the user could then customize whether for some buffer-types he/she
> wants to have them displayed in windows, or, depending on the
> buffer-type, customize geometry, fonts etc. of frames.

I suppose that by customizing 'switch-to-buffer-skip-visible' to t and
using a 'display-buffer-alist' that always makes a new dedicated frame
that becomes invisible when it gets buried, you can largely achieve
that.  The only problems should result from internal Emacs functions
that by default try to reuse or split the selected window.  I'm quite
sure that nothing can be done in this regard anyway.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sat, 23 Nov 2019 09:50:04 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sat, 23 Nov 2019 11:49:31 +0200
> Cc: konrad.podczeck <at> univie.ac.at, 37840 <at> debbugs.gnu.org, juri <at> linkov.net
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Sat, 23 Nov 2019 09:15:30 +0100
> 
> > Any reasons I should consider to object?
> 
> None so far.

Then please go ahead, and thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 25 Nov 2019 23:48:01 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 26 Nov 2019 00:47:43 +0100
I just noted that the ediff-control-panel does not react on any of the display-buffer-alist possibilities to customize appearance of frames.

Konrad

> Am 23.11.2019 um 09:16 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > The patch does not do the job. With the customization from my
> > previous mail, start Emacs, open, say, foo.tex, and then do
> > occur->some text. In the frame with the occur buffer, do bury
> > buffer, so that the frame with the occur-buffer becomes iconified,
> > so everything is good up to now. But then, doing bury buffer in the
> > frame displaying foo.tex, the message-buffer displays in that frame,
> > then doing again bury-buffer in that frame, the occur-buffer shows
> > up, again in the frame originally intended for foo.tex, that is in
> > the wrong frame, i.e., not as intended with the display-buffer-alist
> > customization.
> 
> If you want to keep the occur-buffer in an iconified frame, you have
> to customize 'switch-to-buffer-skip-visible' to 0 or t in order to
> avoid switching to it automatically in another window.  When I do that
> here, 'bury-buffer' switches between foo.tex, *scratch* and *Messages*
> only.
> 
> > Would it not be better to adopt a more radical approach? Say that
> > there are two basic defaults between which a user can choose: one as
> > it is now, and a second one where there is a strict one-to-one
> > correspondence between buffers and frames (i.e., in the terminology
> > of Emacs, with no “windows” at all). Given the second basis default,
> > the user could then customize whether for some buffer-types he/she
> > wants to have them displayed in windows, or, depending on the
> > buffer-type, customize geometry, fonts etc. of frames.
> 
> I suppose that by customizing 'switch-to-buffer-skip-visible' to t and
> using a 'display-buffer-alist' that always makes a new dedicated frame
> that becomes invisible when it gets buried, you can largely achieve
> that.  The only problems should result from internal Emacs functions
> that by default try to reuse or split the selected window.  I'm quite
> sure that nothing can be done in this regard anyway.
> 
> martin
> 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Tue, 26 Nov 2019 09:32:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 26 Nov 2019 10:31:36 +0100
> Then please go ahead, and thanks.

The new option is now called 'switch-to-prev-buffer-skip' and also
accepts a function as value.  Hence Konrad can write, for example,

(defun no-occur (window buffer bury-or-kill)
  (string-equal (buffer-name buffer) "*Occur*"))

(setq switch-to-prev-buffer-skip 'no-occur)

so *Occur* will never be shown automatically, even if it is not
displayed on any frame at all.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Tue, 26 Nov 2019 09:33:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 26 Nov 2019 10:32:08 +0100
> I just noted that the ediff-control-panel does not react on any of
> the display-buffer-alist possibilities to customize appearance of
> frames.

Customize 'ediff-control-frame-position-function'.  You can stuff
anything you want into the return value of that function, not just the
location.  Consult 'ediff-control-frame-parameters' in ediff-wind.el
for how ediff sets things up if you do not interfere.

And be aware that Emacs has many other frame creating packages that
disregard 'display-buffer-alist'.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Tue, 26 Nov 2019 09:43:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37840 <at> debbugs.gnu.org, konrad.podczeck <at> univie.ac.at, juri <at> linkov.net
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Tue, 26 Nov 2019 10:42:22 +0100
>  > Then please go ahead, and thanks.

And sorry for messing up the commit message.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 02 Dec 2019 01:37:02 GMT) Full text and rfc822 format available.

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

From: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 37840 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 2 Dec 2019 02:35:56 +0100
Hi,

I cannot solve the following problem with Ediff:


Suppose I have two buffers open, say fooA.tex and fooB.tex, each in its own frame. Then I invoke Ediff to compare both buffers. Now suppose I kill the buffers fooA.tex and fooB.tex _before_ I quit the Ediff control panel. If I then quit the Ediff control buffer, it happens that some of the auxiliary Ediff buffers pops up, but _not_ in the geometry customized with display-buffer-alist for *something* type buffers, but with a geometry according to default-frame-list modulo that the position is that of one of the former frames for fooA.tex or fooB.tex, depending on which was buffer A in Ediff's terminology. Thus, I can get a total frame layout which should not exist according to the customizations according to default-frame-alist and display-buffer-alist. 

How can I sole this? Or, even better, how can I manage that in the above scenario no buffer pops up if I close the Ediff control panel? Has the problem maybe something to do with the fact that the frame of the Ediff control panel has no minibuffer?

Thanks,

Konrad



> Am 26.11.2019 um 10:32 schrieb martin rudalics <rudalics <at> gmx.at>:
> 
> > I just noted that the ediff-control-panel does not react on any of
> > the display-buffer-alist possibilities to customize appearance of
> > frames.
> 
> Customize 'ediff-control-frame-position-function'.  You can stuff
> anything you want into the return value of that function, not just the
> location.  Consult 'ediff-control-frame-parameters' in ediff-wind.el
> for how ediff sets things up if you do not interfere.
> 
> And be aware that Emacs has many other frame creating packages that
> disregard 'display-buffer-alist'.
> 
> martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Mon, 02 Dec 2019 09:42:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>
Cc: 37840 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Mon, 2 Dec 2019 10:41:20 +0100
> Suppose I have two buffers open, say fooA.tex and fooB.tex, each in
> its own frame. Then I invoke Ediff to compare both buffers. Now
> suppose I kill the buffers fooA.tex and fooB.tex _before_

... but here already something must happen in any windows resp. frames
showing these buffers ...

> I quit the
> Ediff control panel. If I then quit the Ediff control buffer, it
> happens that some of the auxiliary Ediff buffers pops up, but _not_
> in the geometry customized with display-buffer-alist for *something*
> type buffers, but with a geometry according to default-frame-list
> modulo that the position is that of one of the former frames for
> fooA.tex or fooB.tex, depending on which was buffer A in Ediff's
> terminology. Thus, I can get a total frame layout which should not
> exist according to the customizations according to
> default-frame-alist and display-buffer-alist.

Note again that ediff doesn't care neither about ‘default-frame-alist’
nor 'display-buffer-alist'.  It uses its own customary settings and
sometimes relies on 'switch-to-buffer' to DTRT.  In addition, ediff
doesn't like it much when you kill one of its buffers too early, that
is before calling 'ediff-quit'.

You have two ways to interfere here: 'ediff-cleanup-hook' to clean up
the state _before_ 'ediff-quit' starts its own cleanup routine (so you
can, for example, delete frames showing buffers used by ediff) or
‘ediff-quit-hook’ which by default runs ediff's own cleanup function
'ediff-cleanup-mess' (where you will see a plethora of 'delete-window'
and 'switch-to-buffer' calls that probably cause the behavior you see
and dislike above).  If you want to change or add to the latter, it's
probably best to run 'ediff-cleanup-mess' through the debugger first
in order to understand how it works and how it messes up your
buffer/frame relationships.

> How can I sole this? Or, even better, how can I manage that in the
> above scenario no buffer pops up if I close the Ediff control panel?
> Has the problem maybe something to do with the fact that the frame
> of the Ediff control panel has no minibuffer?

You cannot give a minibuffer window to a frame that has none.  So by
all means, 'ediff-quit' should avoid reusing the control panel frame
for showing another buffer.  Does it do that in your case?

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37840; Package emacs. (Sun, 20 Sep 2020 11:13:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, juri <at> linkov.net,
 konrad.podczeck <at> univie.ac.at, 37840 <at> debbugs.gnu.org
Subject: Re: bug#37840: Missing in the Emacs manuals:
Date: Sun, 20 Sep 2020 13:12:25 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > Any reasons I should consider to object?
>> 
>> None so far.
>
> Then please go ahead, and thanks.

It looks like the patch was applied (with some changes).  Skimming the
rest of the thread, other related issues were discussed, but if I'm
reading it correctly, it seems like the described scenarios are now
possible with the patch installed.

So there doesn't seem to be anything further to be done in this bug
report, and I'm closing it.  If there are any further issues in this
area, perhaps opening a new bug report would be the way to go.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 37840 <at> debbugs.gnu.org and Konrad Podczeck <konrad.podczeck <at> univie.ac.at> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 20 Sep 2020 11:13:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Oct 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 181 days ago.

Previous Next


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