all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: martin rudalics <rudalics@gmx.at>, 28978@debbugs.gnu.org
Subject: bug#28978: 26.0; Regression: separate, dedicated `*Completions*' frame no longer has parameter `minibuffer'
Date: Thu, 26 Oct 2017 07:01:51 -0700 (PDT)	[thread overview]
Message-ID: <c9d0a177-87ff-4bfd-9d1c-80a8cb9af061@default> (raw)
In-Reply-To: <59F1957F.80900@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 5018 bytes --]

>  > I don't call `make-frame' to create frame `*Completions*'.
>  > It is created when ` 1on1-display-*Completions*-frame' is
>  > called, and that is done by `special-display-function'.
>  > I showed the code for that in my previous message.
> 
> The 'minibuffer' parameter must be set up specially by whoever calls
> ‘make-frame’.  If this is not done, you can't change it afterwards.  The
> default value of ‘special-display-function’ is
> ‘special-display-popup-frame’ and I don't see the latter setting up the
> 'minibuffer' parameter anywhere.

I use the default value of `special-display-function',
`special-display-popup-frame'.

I don't call `make-frame' for `*Completions*'.  I just
provide an alist to `special-display-buffer-names'.
That alist includes, as its second element, function
`1on1-display-*Completions*-frame', which displays the
frame.

This is `special-display-buffer-names':

(("*Completions*" 1on1-display-*Completions*-frame
  ((background-color . "LavenderBlush2")
   (mouse-color . "VioletRed")
   (cursor-color . "VioletRed")
   (menu-bar-lines . 0)
   (tool-bar-lines . 0)
   (width . 100)))
 ("*Help*" 1on1-display-*Help*-frame
  ((background-color . "Thistle")
   (mouse-color . "Blue Violet")
   (cursor-color . "Blue Violet")
   (height . 40))))

The only thing that matters there is
`1on1-display-*Completions*-frame'.

>  > I don't ever set parameter `minibuffer' explicitly for
>  > *Completions*.  I'm guessing that it has always gotten
>  > set automatically when frame input was redirected from
>  > frame *Completions* to the standalone minibuffer.
>  >
>  > (It is redirected to `completion-reference-buffer' if
>  > the minibuffer is not active (and if `c-r-b' is not
>  > frame *Completions*)).
> 
> Maybe you mean "focus redirection" here which is something
> different from setting up the 'minibuffer' parameter.

Yes, I mean input/focus redirection, with
`redirect-frame-focus'.  I'm guessing that redirecting
focus is somehow behind the changed value of parameter
`minibuffer' for frame `*Completions*'.  The redirection
of frame focus is the only connection I'm aware of
between those two frames.

I don't change parameter `minibuffer' for *Completions*,
that I'm aware of.  Frame *Completions* is created by
the special-display code, just by my using
`special-display-buffer-names'.  I don't create it
directly - I don't call `make-frame' for it.  If it
is now getting the wrong value of parameter `minibuffer'
I don't see how it could be my code that is doing
that.
 
> I understand that you want that parameter to have a non-nil value there.
> So make sure that it is.  For this you will have to debug your earlier
> version to see how they set up the 'miniuffer' parameter and compare
> them with the current version to see how it fails to do that.

I have no idea what part of the special-display code might
have managed parameter `minibuffer' before vs now, or
whether that is done in Emacs C code or Emacs Lisp code.
I don't know what has changed in the Emacs code.

However, I realize now that I reported the exact opposite
of the real problem.  Apologies for that.

The problem is NOT that (1) PREVIOUSLY, frame *Completions*
had a `minibuffer' parameter whose value was the active
minibuffer window (on the minibuffer frame) and (2) NOW,
frame *Completions* has a nil `minibuffer' parameter.

The problem is that (1) PREVIOUSLY, frame *Completions*
had a nil `minibuffer' and (2) NOW, frame *Completions*
has a `minibuffer' parameter whose value is the active
minibuffer window (on the minibuffer frame).

IOW, the problem is that the separate, dedicated frame
*Completions* somehow gets a `minibuffer' parameter
(whose value is the minibuffer window on the minibuffer
frame).

`*Completions*' is not a minibuffer frame.  The only
minibuffer frame has a `minibuffer' parameter whose
value is `only' - the value is not a minibuffer
_window_.

Does the problem description make more sense now?
Sorry for the confusion.

I am not setting parameter `minibuffer'.  The only
connection I know of between the *Completions* frame
and the standalone minibuffer frame is the focus
redirection.  Is it possible that that redirection
code now mistakenly gives a non-nil `minibuffer'
parameter to the frame whose input focus is
redirected to the minibuffer frame?

Attached is the debug output that I see, in case it
helps.  The cause of my problem seems to be that
somehow frame `*Completions*' is getting a non-nil
parameter `minibuffer' - the value being the
minibuffer window (on the minibuffer frame).
Or do you interpret the attached debug info
differently?

Hoping you can set me straight about this.
I don't think I should need to do anything
different in my code, but if I need to make
some minor adjustment for some change in
Emacs, please let me know what I'll need to do.

So far, this seems like an Emacs bug, to me.


[-- Attachment #2: throw-bug-28978.el --]
[-- Type: application/octet-stream, Size: 2837 bytes --]

(defun icicle-delete-windows-on (buffer)
  "Delete all windows showing BUFFER.
If such a window is alone in its frame, then delete the frame - unless
it is the only frame or a standalone minibuffer frame."
  (interactive
   (list (let ((enable-recursive-minibuffers  t))
           (read-buffer "Remove all windows showing buffer: " (current-buffer) 'existing))))
  (setq buffer  (get-buffer buffer))
  (message "111, BUF: %S" buffer)
  (when buffer
    ;; Avoid error message "Attempt to delete minibuffer or sole ordinary window".
    (message "222, this-buf-frs: %S, this fr: %S" (icicle-frames-on buffer) (car (icicle-frames-on buffer)))
    (let* ((this-buffer-frames  (icicle-frames-on buffer))
           (this-frame          (car this-buffer-frames))
           mini-param)
      (message "333, fr-visib: %S, only-1: %S, miniparam: %S, eq: %S"
               (frame-visible-p this-frame)
               (null (cdr this-buffer-frames))
               (cdr (assoc 'minibuffer (frame-parameters this-frame)))
               (eq (cdr (assoc 'minibuffer (frame-parameters this-frame))) (active-minibuffer-window))
               )
      (unless (and this-frame
                   (frame-visible-p this-frame)
                   (null (cdr this-buffer-frames)) ; Only one frame shows BUFFER.
                   (setq mini-param ; <==========================
                         (cdr (assoc 'minibuffer (frame-parameters this-frame))))
                   (eq mini-param (active-minibuffer-window)) ; Has an active minibuffer.
                   (save-window-excursion
                     (select-frame this-frame)
                     (one-window-p t 'SELECTED-FRAME-ONLY))) ; Only one window.
        (message "444, must be one win")
        (let (win)
          (dolist (fr  this-buffer-frames)
            (setq win  (get-buffer-window buffer fr))
            (select-window win)
            (message "555, one-win: %S, not-1-fr: %S" (one-window-p t) (cdr (visible-frame-list)))
            (if (and (one-window-p t)  (cdr (visible-frame-list))) ; Sole window but not sole frame.
                (delete-frame)
              (delete-window (selected-window)))))))))

In Emacs 24.5 I see this debug output:

111, BUF: #<buffer *Completions*>
222, this-buf-frs: (#<frame *Completions* 052d3778>), this fr: #<frame *Completions* 052d3778>
333, fr-visib: t, only-1: t, miniparam: nil, eq: nil
444, must be one win
555, one-win: t, not-1-fr: (#<frame drews-lisp-20 014b3420> #<frame *scratch* 047b6360> #<frame *Messages* 015c8588> #<frame *Completions* 052d3778>)

But in Emacs 26 pretest 1 I see this output:

111, BUF: #<buffer *Completions*>
222, this-buf-frs: (#<frame *Completions* 000000000cacf6c8>), this fr: #<frame *Completions* 000000000cacf6c8>
333, fr-visib: t, only-1: t, miniparam: #<window 6 on  *Minibuf-1*>, eq: t

  reply	other threads:[~2017-10-26 14:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 20:20 bug#28978: 26.0; Regression: separate, dedicated `*Completions*' frame no longer has parameter `minibuffer' Drew Adams
2017-10-25  7:45 ` martin rudalics
2017-10-25 14:47   ` Drew Adams
2017-10-26  7:57     ` martin rudalics
2017-10-26 14:01       ` Drew Adams [this message]
2017-10-27  8:25         ` martin rudalics
2017-10-27 14:19           ` Drew Adams
2017-10-28  8:45             ` martin rudalics
2017-10-28 19:15               ` Drew Adams
2017-10-29 11:18                 ` martin rudalics
2017-10-29 15:59                   ` Drew Adams
2017-10-29 18:13                     ` martin rudalics
2017-10-29 23:56                       ` Drew Adams
2017-10-30  8:24                         ` martin rudalics
2017-10-30 14:32                           ` Drew Adams
2017-10-30 19:00                             ` martin rudalics
2017-10-30 19:16                               ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9d0a177-87ff-4bfd-9d1c-80a8cb9af061@default \
    --to=drew.adams@oracle.com \
    --cc=28978@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.