unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 16661@debbugs.gnu.org
Subject: bug#16661: 24.3.50; standalone minibuffer frame gets renamed with name of aother frame
Date: Fri, 21 Feb 2014 20:23:47 -0800 (PST)	[thread overview]
Message-ID: <16fff663-6320-4d96-a575-e3c368472a0a@default> (raw)
In-Reply-To: <<8338jd693l.fsf@gnu.org>>

> How about adding a Lisp backtrace to the info you already put there?

OK, I have some more info about this.  This is the backtrace:

000 this-cmd: nil, last-cmd: nil
	(name . "drews-lisp-20")
  backtrace()
  ad-Advice-modify-frame-parameters(#<subr modify-frame-parameters> #<frame Emacs minibuffer                         show/hide: hold CTRL + click in window 03bec000> ((name . "drews-lisp-20")))
  apply(ad-Advice-modify-frame-parameters #<subr modify-frame-parameters> (#<frame Emacs minibuffer                         show/hide: hold CTRL + click in window 03bec000> ((name . "drews-lisp-20"))))
  modify-frame-parameters(#<frame Emacs minibuffer                         show/hide: hold CTRL + click in window 03bec000> ((name . "drews-lisp-20")))
  rename-frame()
  run-hooks(window-setup-hook)

I do this in my init file:

(when (and (if (fboundp 'display-graphic-p) (display-graphic-p) window-system)
           (eq system-type 'windows-nt) (fboundp 'rename-frame))
  (add-hook 'window-setup-hook 'rename-frame))

This is `rename-frame':

(defun rename-frame (&optional old-name new-name all-named)
  "Rename a frame named OLD-NAME to NEW-NAME.
Prefix arg non-nil means rename all frames named OLD-NAME to NEWNAME.
OLD-NAME may be a frame, its name, or nil.  Default is `selected-frame'.
NEW-NAME is a string or nil.  Default NEW-NAME is current `buffer-name'."
  (interactive
   (list (read-frame
           (concat "Rename " (and current-prefix-arg  "all ")
                   "frame" (and current-prefix-arg  "s named") ": ")
           nil t)             ; Default = selected.  Must exist.
         (read-from-minibuffer "Rename to (new name): "
                               (cons (buffer-name) 1))
         current-prefix-arg))
  (setq old-name  (or old-name  (get-frame-name)) ; Batch default: current.
        new-name  (or new-name  (buffer-name))) ; Batch default: buf name.
  (let ((fr  (get-a-frame old-name))) ; Convert to frame if string.
    (if all-named
        (while fr
          (modify-frame-parameters fr (list (cons 'name new-name)))
          (setq fr  (get-a-frame old-name))) ; Get another.
      (when (string= (get-frame-name fr) (get-frame-name))
        (setq fr  (selected-frame)))
      (modify-frame-parameters fr (list (cons 'name new-name))))))

What's odd is that I never saw the minibuffer get renamed to another
buffer name before now.  And even now it happens only occasionally.

I will switch to using my function `rename-non-minibuffer-frame',
which I hope will take care of the problem I see.

But I wonder whether this might not indicate an Emacs bug.  Either
a new bug: Why should the `buffer-name' of the minibuffer frame be
different from the frame name, for the minibuffer frame?

Apparently Emacs thinks that the current buffer in the minibuffer
frame is the buffer of another frame (in this case, Dired).  And
I believe that I have seen this renaming bug happen only when
there is only one other frame, besides the minibuffer frame.
How is it possible that (buffer-name) is the name of a Dired
buffer when `window-setup-hook' is called for the minibuffer
frame?

Or perhaps some old bug was fixed, which causes me to see this
for the first time (across all Emacs versions from Emacs 20-24)?
But even in that case I have the same questions: why would
`buffer-name' be wrong when `window-setup-hook' is run?

Anyone have insight into this?  I believe I first started seeing
this in early January, but it might have been a little before or
after that.






  parent reply	other threads:[~2014-02-22  4:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<97c44b41-de36-472b-833d-3b0d1ac4c912@default>
     [not found] ` <<e1f6b83f-5c4c-4b4b-93c0-cec70e8f4198@default>
     [not found]   ` <<831tzgypbp.fsf@gnu.org>
2014-02-06 21:06     ` bug#16661: 24.3.50; standalone minibuffer frame gets renamed with name of aother frame Drew Adams
2014-02-07  7:09       ` Eli Zaretskii
     [not found]     ` <<ea23c21d-4e2d-4a93-865f-763ae2f9df19@default>
     [not found]       ` <<83zjm3xuu8.fsf@gnu.org>
2014-02-07 17:25         ` Drew Adams
2014-02-14 15:51           ` Drew Adams
2014-02-14 18:23             ` Eli Zaretskii
     [not found]         ` <<f103a66c-04d7-45f2-92a4-25687523ec8b@default>
     [not found]           ` <<e5b84d2d-38c3-49ec-be38-e91738da7c66@default>
     [not found]             ` <<83vbwhblkp.fsf@gnu.org>
2014-02-16 17:14               ` Drew Adams
2014-02-19 21:06                 ` Drew Adams
2014-02-20 16:29                   ` Eli Zaretskii
     [not found]               ` <<3febc9ab-b7b2-443c-8ec8-eaaf28ace468@default>
     [not found]                 ` <<dde01fb4-f798-45d3-9ec6-3f4f1e7d16f5@default>
     [not found]                   ` <<8338jd693l.fsf@gnu.org>
2014-02-22  4:23                     ` Drew Adams [this message]
2014-02-22  8:55                       ` Eli Zaretskii
2014-02-24 20:14                       ` Stefan Monnier
2014-02-24 21:34                         ` Drew Adams
     [not found]                     ` <<16fff663-6320-4d96-a575-e3c368472a0a@default>
     [not found]                       ` <<83a9dj4jc3.fsf@gnu.org>
2014-02-22 16:41                         ` Drew Adams
2015-12-26 13:27                           ` Lars Ingebrigtsen
2015-12-26 16:22                             ` Drew Adams
     [not found] <<6a126f7a-27e5-4ada-a6b3-1f3c1c19aca0@default>
     [not found] ` <<831tzg22wn.fsf@gnu.org>
2014-02-06  6:15   ` Drew Adams
2014-02-06 18:42     ` Drew Adams
2014-02-06 20:10       ` Eli Zaretskii
2014-02-07  1:04         ` Juanma Barranquero
2014-02-07  2:36           ` Drew Adams
2014-02-07  2:49             ` Juanma Barranquero
2014-02-07  3:08               ` Drew Adams
2014-02-07  3:21                 ` Juanma Barranquero
2014-02-05 23:33 Drew Adams
2014-02-06  6:03 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=16fff663-6320-4d96-a575-e3c368472a0a@default \
    --to=drew.adams@oracle.com \
    --cc=16661@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).