Subject: bug#16661: 24.3.50; standalone minibuffer frame gets renamed with name of aother frame

From: Drew Adams <[email-masked]>
Date: Sun, 16 Feb 2014 09:14:56 -0800 (PST)

> > > > Perhaps advising modify-frame-parameters and modify-frame-
> > > > parameter, to record their changes in some buffer, could
> > > > find out the answer.
> You could use a separate buffer for that.

I tried that and got lucky (the problem arose), but it didn't
give me any info that is useful, I'm afraid.  Perhaps you have
a suggestion of something better/additional to print out?

Here is the info that was printed:

000 this-cmd: nil, last-cmd: nil
	(name . "drews-lisp-20")
 111 this-cmd: nil, last-cmd: nil
	(name . "drews-lisp-20")

All that tells us is that (a) it was `modify-frame-parameters',
not `set-frame-parameter', that caused the name change, and
(b) both `this-command' and `last-command' were nil when that
happened.

`drews-lisp-20' is a Dired buffer in a separate frame - the only
frame that existed at the time, apart from the minibuffer frame.
(I think that I have seen this bug only when there is only one
other frame besides the minibuffer frame.)

This is the code that printed that debug info:

(defadvice modify-frame-parameters (around mini-debug activate)
  (when (and (eq (ad-get-arg 0) 1on1-minibuffer-frame)
             (assoc 'name (ad-get-arg 1))) 
    (with-current-buffer (get-buffer-create "*MINI-DEBUG*")
      (let ((str  (format "000 this-cmd: %S, last-cmd: %S\n\t%S\n"
                          this-command last-command
                          (assoc 'name (ad-get-arg 1)))))
        (insert str))))
  ad-do-it
  (when (and (eq (ad-get-arg 0) 1on1-minibuffer-frame)
             (assoc 'name (ad-get-arg 1)))
    (with-current-buffer (get-buffer-create "*MINI-DEBUG*")
      (let ((str  (format " 111 this-cmd: %S, last-cmd: %S\n\t%S\n"
                          this-command last-command
                          (assoc 'name (ad-get-arg 1)))))
        (insert str)))))

(defadvice set-frame-parameter (around mini-debug activate)
  (when (and (eq (ad-get-arg 0) 1on1-minibuffer-frame)
             (eq 'name (ad-get-arg 1))) 
    (with-current-buffer (get-buffer-create "*MINI-DEBUG*")
      (let ((str  (format "333 this-cmd: %S, last-cmd: %S\n\t%S\n"
                          this-command last-command (ad-get-arg 2))))
        (insert str))))
  ad-do-it
  (when (and (eq (ad-get-arg 0) 1on1-minibuffer-frame)
             (eq 'name (ad-get-arg 1)))
    (with-current-buffer (get-buffer-create "*MINI-DEBUG*")
      (let ((str  (format " 444 this-cmd: %S, last-cmd: %S\n\t%S\n"
                          this-command last-command (ad-get-arg 2))))
        (insert str)))))