From unknown Sun Aug 10 10:54:45 2025 X-Loop: don@donarmstrong.com Subject: bug#51: difficulty creating unique frame names Reply-To: Damon Permezel , 51@debbugs.gnu.org Resent-From: Damon Permezel Original-Sender: emacs-devel-bounces+monnier=iro.umontreal.ca@gnu.org Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 11 Mar 2008 17:55:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 51 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.120525766517958 (code B ref -1); Tue, 11 Mar 2008 17:55:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=0.1 required=4.0 tests=AWL,FOURLA,FVGT_m_MULTI_ODD autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 11 Mar 2008 17:47:45 +0000 Received: from mercure.iro.umontreal.ca (mercure.iro.umontreal.ca [132.204.24.67]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m2BHlb77017952 for ; Tue, 11 Mar 2008 10:47:38 -0700 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 42D032CF9EB for ; Tue, 11 Mar 2008 13:47:17 -0400 (EDT) Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 65D7A3FE1 for ; Tue, 11 Mar 2008 13:47:09 -0400 (EDT) Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 4A8466CAA2; Tue, 11 Mar 2008 13:47:09 -0400 (EDT) Resent-Message-ID: Resent-To: submit@debbugs.gnu.org Resent-From: Stefan Monnier Resent-Date: Tue, 11 Mar 2008 13:47:09 -0400 X-Original-To: monnier@iro.umontreal.ca Delivered-To: monnier@iro.umontreal.ca Received: from pinpin.iro.umontreal.ca (pinpin.iro.umontreal.ca [132.204.24.52]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 0DE7D2CEFDB for ; Mon, 10 Mar 2008 23:59:53 -0400 (EDT) Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by pinpin.iro.umontreal.ca (Postfix) with ESMTP id 8578C3B8B43 for ; Mon, 10 Mar 2008 23:59:45 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYveS-0000DH-Oa for monnier@iro.umontreal.ca; Mon, 10 Mar 2008 23:59:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JYvNW-0003p3-OY for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JYvNS-0003nF-HJ for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYvNS-0003mu-B4 for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:10 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JYvNR-0002vr-Qj for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:09 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JYvNQ-0000Rt-Cn for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:08 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JYvNN-0002v7-CH for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:08 -0400 Received: from smtpoutm.mac.com ([17.148.16.79]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JYvNM-0002ul-So for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:05 -0400 Received: from mac.com (asmtp009-s [10.150.69.72]) by smtpoutm.mac.com (Xserve/smtpout016/MantshX 4.0) with ESMTP id m2B3g2oi028863 for ; Mon, 10 Mar 2008 20:42:02 -0700 (PDT) Received: from [192.168.1.40] (60-240-83-144.static.tpgi.com.au [60.240.83.144]) (authenticated bits=0) by mac.com (Xserve/asmtp009/MantshX 4.0) with ESMTP id m2B3fuc1021499 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 10 Mar 2008 20:41:58 -0700 (PDT) Message-Id: From: Damon Permezel To: emacs-pretest-bug@gnu.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Tue, 11 Mar 2008 13:41:55 +1000 X-Mailer: Apple Mail (2.919.2) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (1) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Mon, 10 Mar 2008 23:59:26 -0400 Cc: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-devel-bounces+monnier=iro.umontreal.ca@gnu.org Errors-To: emacs-devel-bounces+monnier=iro.umontreal.ca@gnu.org X-DIRO-MailScanner: Found to be clean, Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-1.94, requis 5, BAYES_00 -2.60, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00), n'est pas un polluriel, SpamAssassin (score=0.659, requis 5, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner-From: monnier@iro.umontreal.ca The default naming scheme for certain emacs implementations is to use the string in the frame-title-format which defaults to "%b". It is thus quite easy to create many frames with the same name. Just start emacs and hit ^x-5-2 repeatedly. The Buffers>Frames menu thus presents a list of buffers many with the same names. Also, any command for manipulating frames by frame names really cannot use the name to distinguish between the frames. Note that the Buffers>Frames cannot be used to select all the frames with the same name when there are more than 2 with the same name. This is a bug! In order to avoid this bug, one has to have unique frame names. I wish to retain the "%b" functionality in the frame-title-format, so I have attempted to construct a FORM that will be evaluated when the frame title is desired to provide some unique element --- in this case a F%d where the %d is the index of the frame within the (frame-list), say. I find that it is not possible to calculate this correctly, as I have no means, from elisp, at the time the FORM is being evaluated, to obtain the frame in question. I have also tried setting a :zz-count property on the frames to uniquely identify them, however there is no means I know of to retrieve this property again as the frame in question is not available to me. I do not want to set the 'name property for the frame, as I wish to retain the "%b" functionality, and I note that this does not work. IE: I could arrange to set each frame's 'name to " %b" readily enough, but then the %b is not expanded. Also, cannot set name to anything by a string. I have tried setting the 'frame-title-format property in a frame, given that this is rumoured to create frame-local-variables, but this does not seem to influence the global frame-title-format. (setq zz-frame-count 0) ;; ;; this will put a unique :zz-count in each frame's properties ;; (add-hook 'after-make-frame-functions '(lambda (frame) (progn (modify-frame-parameters frame (list (cons :zz-count (setq zz- frame-count (1+ zz-frame-count))))) (message "%S" (frame-parameters frame))))) ;; ;; this attempts to set F%d to the index of the frame in the ;; frame-list, but it just does so for the current frame. ;; (setq frame-title-format (cons :eval '((let ((f (next-frame (previous-frame))) (x nil)) (format "F%d:%%b - %%F" (apply '+ (mapcar (lambda (_) (if x 0 (setq x (eq _ f)) 1)) (frame-list)))))) ;; try the above, and then a a slew of ^x-5-2 and then cycle thru the frames and look at the names. I would either like to be able to have (current-frame) return the frame for which the frame-title-format is being expanded, or I would like to have a '%Z[pname]' (or something less revolting) expand out to a named property for the implicit frame, just as '%F' expands the implicit frame's name. (setq frame-title-format "F%Z[:zz-count]:%b") would give me "F1:*scratch*", "F2:*scratch*", ... for example. Another solution would be to use the per-frame frame-title-format. In GNU Emacs 22.1.50.1 (i386-apple-darwin8.11.1, Carbon Version 1.6.0) of 2008-01-18 on seijiz.local Windowing system distributor `Apple Inc.', version 10.5.2 configured using `configure '--prefix=/Applications/Emacs.app/ Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/ Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CFLAGS=-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DUSE_ATSUI - DUSE_MAC_TSM'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil locale-coding-system: iso-8859-1 default-enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: shell-dirtrack-mode: t encoded-kbd-mode: t show-paren-mode: t mac-key-mode: t display-time-mode: t mac-print-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: c o u n t ) C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b c o n s SPC C-e C-x C-e C-] C-p C-p C-p C-p C-p C-p C-x C-e C-n C-n C-n C-n C-n C-n C-e C-x C-e ) C-n C-n C-b C-b C-x C-e C-] C-e C-x C-e C-x C-e C-x 5 2 C-h f C-x 1 C-x C-b C-n SPC ( l i s t SPC C-e ) b x C-e C-x C-e C-] C-b C-x C-e C-n C-n C-x C-e C-p C-p C-p C-p C-p C-p C-a C-k C-k C-y C-y C-p C-p C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d ( s e t q SPC C-e SPC n i l ) C-a ; C-e C-x C-e C-n C-n C-n C-n C-n C-n C-n C-n C-p C-x C-e C-x 5 2 C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b ( s r t q e t q SPC C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f ( s e t q SPC C-k C-y SPC ( 1 + SPC C-y C-x C-e ) ) ) ) C-x C-e C-e C-b C-x C-e C-x C-e C-n C-n C-p C-p C-p C-p C-p C-p C-p C-x C-e C-n C-n C-n C-n C-n C-n C-n C-x C-e C-n C-n C-n C-n C-n C-n C-] C-x C-x A-c Recent messages: 1 Entering debugger... ((:zz-count . 1)) ((:zz-count . 2)) nil ((lambda (frame) (progn (select-frame-set-input-focus frame) (modify- frame-parameters frame (list (cons :zz-count (setq zz-frame-count (1+ zz-frame-count))))) (message "%S" (frame-parameters frame)) (mwm)))) Auto-saving...done Quit Auto-saving... Loading emacsbug...done From unknown Sun Aug 10 10:54:45 2025 X-Loop: don@donarmstrong.com Subject: bug#51: difficulty creating unique frame names Reply-To: Stefan Monnier , 51@debbugs.gnu.org Resent-From: Stefan Monnier Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 11 Mar 2008 21:45:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 51 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 51-submit@emacsbugs.donarmstrong.com id=B51.120527134516768 (code B ref 51); Tue, 11 Mar 2008 21:45:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-0.5 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 51) by emacsbugs.donarmstrong.com; 11 Mar 2008 21:35:45 +0000 Received: from mercure.iro.umontreal.ca (mercure.iro.umontreal.ca [132.204.24.67]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m2BLZd4D016762 for <51@emacsbugs.donarmstrong.com>; Tue, 11 Mar 2008 14:35:40 -0700 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 96A292CF7CA; Tue, 11 Mar 2008 17:35:19 -0400 (EDT) Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id A55933FE1; Tue, 11 Mar 2008 17:35:09 -0400 (EDT) Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 8F0D96CAA2; Tue, 11 Mar 2008 17:35:09 -0400 (EDT) From: Stefan Monnier To: 51@debbugs.gnu.org Message-ID: References: Date: Tue, 11 Mar 2008 17:35:09 -0400 In-Reply-To: (Damon Permezel's message of "Tue, 11 Mar 2008 13:41:55 +1000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca retitle 51 frame-title-format run with wrong selected-frame thanks > The Buffers>Frames menu thus presents a list of buffers many with the > same names. Indeed. I don't think there's much we can do about that for now. > Also, any command for manipulating frames by frame names > really cannot use the name to distinguish between the frames. Note that > the Buffers>Frames cannot be used to select all the frames with the same > name when there are more than 2 with the same name. This is a bug! Indeed, thanks. Should be fixed now on the trunk. > I wish to retain the "%b" functionality in the frame-title-format, so > I have attempted to construct a FORM that will be evaluated when the > frame title is desired to provide some unique element --- in this case > a F%d where the %d is the index of the frame within the (frame-list), say. > I find that it is not possible to calculate this correctly, as I have > no means, from elisp, at the time the FORM is being evaluated, to > obtain the frame in question. Indeed, I expected `selected-frame' to return the right frame, but it doesn't. That's also a bug. But it's not fixed yet. Stefan From unknown Sun Aug 10 10:54:45 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: don@donarmstrong.com From: help-debbugs@gnu.org (Emacs bug Tracking System) To: Damon Permezel Subject: bug#51 closed by Stefan Monnier (frame-title-format is built with wrong selected-frame) Message-ID: References: X-Emacs-PR-Message: they-closed 51 X-Emacs-PR-Package: emacs Reply-To: 51@debbugs.gnu.org Content-Type: multipart/mixed; boundary="----------=_1205939405-2992-1" This is a multi-part message in MIME format... ------------=_1205939405-2992-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is an automatic notification regarding your bug report which was filed against the emacs package: #51: frame-title-format is built with wrong selected-frame It has been closed by Stefan Monnier . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Stefan Monnier by replying to this email. --=20 51: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D51 Emacs Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1205939405-2992-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit >From monnier@iro.umontreal.ca Wed Mar 19 08:04:42 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=0.5 required=4.0 tests=AWL autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 51-done) by emacsbugs.donarmstrong.com; 19 Mar 2008 15:04:42 +0000 Received: from ironport2-out.pppoe.ca (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m2JF4YsU001567 for <51-done@emacsbugs.donarmstrong.com>; Wed, 19 Mar 2008 08:04:36 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAD/I4EdMCrTo/2dsb2JhbACqPIEH X-IronPort-AV: E=Sophos;i="4.25,524,1199682000"; d="scan'208";a="16233064" Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 19 Mar 2008 11:04:00 -0400 Received: from pastel.home ([76.10.180.232]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id ZSX25300 for <51-done@emacsbugs.donarmstrong.com>; Wed, 19 Mar 2008 11:04:00 -0400 Received: by pastel.home (Postfix, from userid 20848) id 0B5F68168; Wed, 19 Mar 2008 11:04:00 -0400 (EDT) From: Stefan Monnier To: 51-done@debbugs.gnu.org Subject: frame-title-format is built with wrong selected-frame Message-ID: Date: Wed, 19 Mar 2008 11:04:00 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I believe this is now fixed for Emacs-23, so you can use `selected-window' and `selected-frame' in your `frame-title-format' and get the right window/frame out of it. 2008-03-19 Stefan Monnier * xdisp.c (format_mode_line_unwind_data): Add window argument. (unwind_format_mode_line): Restore selected window. (x_consider_frame_title, Fformat_mode_line): Set selected window. -- Stefan ------------=_1205939405-2992-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit >From monnier@iro.umontreal.ca Tue Mar 11 10:47:45 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=0.1 required=4.0 tests=AWL,FOURLA,FVGT_m_MULTI_ODD autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 11 Mar 2008 17:47:45 +0000 Received: from mercure.iro.umontreal.ca (mercure.iro.umontreal.ca [132.204.24.67]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m2BHlb77017952 for ; Tue, 11 Mar 2008 10:47:38 -0700 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 42D032CF9EB for ; Tue, 11 Mar 2008 13:47:17 -0400 (EDT) Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 65D7A3FE1 for ; Tue, 11 Mar 2008 13:47:09 -0400 (EDT) Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 4A8466CAA2; Tue, 11 Mar 2008 13:47:09 -0400 (EDT) Resent-Message-ID: Resent-To: submit@debbugs.gnu.org Resent-From: Stefan Monnier Resent-Date: Tue, 11 Mar 2008 13:47:09 -0400 X-Original-To: monnier@iro.umontreal.ca Delivered-To: monnier@iro.umontreal.ca Received: from pinpin.iro.umontreal.ca (pinpin.iro.umontreal.ca [132.204.24.52]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 0DE7D2CEFDB for ; Mon, 10 Mar 2008 23:59:53 -0400 (EDT) Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by pinpin.iro.umontreal.ca (Postfix) with ESMTP id 8578C3B8B43 for ; Mon, 10 Mar 2008 23:59:45 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYveS-0000DH-Oa for monnier@iro.umontreal.ca; Mon, 10 Mar 2008 23:59:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JYvNW-0003p3-OY for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JYvNS-0003nF-HJ for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYvNS-0003mu-B4 for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:10 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JYvNR-0002vr-Qj for emacs-devel@gnu.org; Mon, 10 Mar 2008 23:42:09 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JYvNQ-0000Rt-Cn for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:08 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JYvNN-0002v7-CH for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:08 -0400 Received: from smtpoutm.mac.com ([17.148.16.79]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JYvNM-0002ul-So for emacs-pretest-bug@gnu.org; Mon, 10 Mar 2008 23:42:05 -0400 Received: from mac.com (asmtp009-s [10.150.69.72]) by smtpoutm.mac.com (Xserve/smtpout016/MantshX 4.0) with ESMTP id m2B3g2oi028863 for ; Mon, 10 Mar 2008 20:42:02 -0700 (PDT) Received: from [192.168.1.40] (60-240-83-144.static.tpgi.com.au [60.240.83.144]) (authenticated bits=0) by mac.com (Xserve/asmtp009/MantshX 4.0) with ESMTP id m2B3fuc1021499 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 10 Mar 2008 20:41:58 -0700 (PDT) Message-Id: From: Damon Permezel To: emacs-pretest-bug@gnu.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Tue, 11 Mar 2008 13:41:55 +1000 X-Mailer: Apple Mail (2.919.2) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (1) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Mon, 10 Mar 2008 23:59:26 -0400 Cc: Subject: difficulty creating unique frame names X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-devel-bounces+monnier=iro.umontreal.ca@gnu.org Errors-To: emacs-devel-bounces+monnier=iro.umontreal.ca@gnu.org X-DIRO-MailScanner: Found to be clean, Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-1.94, requis 5, BAYES_00 -2.60, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00), n'est pas un polluriel, SpamAssassin (score=0.659, requis 5, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner-From: monnier@iro.umontreal.ca The default naming scheme for certain emacs implementations is to use the string in the frame-title-format which defaults to "%b". It is thus quite easy to create many frames with the same name. Just start emacs and hit ^x-5-2 repeatedly. The Buffers>Frames menu thus presents a list of buffers many with the same names. Also, any command for manipulating frames by frame names really cannot use the name to distinguish between the frames. Note that the Buffers>Frames cannot be used to select all the frames with the same name when there are more than 2 with the same name. This is a bug! In order to avoid this bug, one has to have unique frame names. I wish to retain the "%b" functionality in the frame-title-format, so I have attempted to construct a FORM that will be evaluated when the frame title is desired to provide some unique element --- in this case a F%d where the %d is the index of the frame within the (frame-list), say. I find that it is not possible to calculate this correctly, as I have no means, from elisp, at the time the FORM is being evaluated, to obtain the frame in question. I have also tried setting a :zz-count property on the frames to uniquely identify them, however there is no means I know of to retrieve this property again as the frame in question is not available to me. I do not want to set the 'name property for the frame, as I wish to retain the "%b" functionality, and I note that this does not work. IE: I could arrange to set each frame's 'name to " %b" readily enough, but then the %b is not expanded. Also, cannot set name to anything by a string. I have tried setting the 'frame-title-format property in a frame, given that this is rumoured to create frame-local-variables, but this does not seem to influence the global frame-title-format. (setq zz-frame-count 0) ;; ;; this will put a unique :zz-count in each frame's properties ;; (add-hook 'after-make-frame-functions '(lambda (frame) (progn (modify-frame-parameters frame (list (cons :zz-count (setq zz- frame-count (1+ zz-frame-count))))) (message "%S" (frame-parameters frame))))) ;; ;; this attempts to set F%d to the index of the frame in the ;; frame-list, but it just does so for the current frame. ;; (setq frame-title-format (cons :eval '((let ((f (next-frame (previous-frame))) (x nil)) (format "F%d:%%b - %%F" (apply '+ (mapcar (lambda (_) (if x 0 (setq x (eq _ f)) 1)) (frame-list)))))) ;; try the above, and then a a slew of ^x-5-2 and then cycle thru the frames and look at the names. I would either like to be able to have (current-frame) return the frame for which the frame-title-format is being expanded, or I would like to have a '%Z[pname]' (or something less revolting) expand out to a named property for the implicit frame, just as '%F' expands the implicit frame's name. (setq frame-title-format "F%Z[:zz-count]:%b") would give me "F1:*scratch*", "F2:*scratch*", ... for example. Another solution would be to use the per-frame frame-title-format. In GNU Emacs 22.1.50.1 (i386-apple-darwin8.11.1, Carbon Version 1.6.0) of 2008-01-18 on seijiz.local Windowing system distributor `Apple Inc.', version 10.5.2 configured using `configure '--prefix=/Applications/Emacs.app/ Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/ Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CFLAGS=-Os -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DUSE_ATSUI - DUSE_MAC_TSM'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil locale-coding-system: iso-8859-1 default-enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: shell-dirtrack-mode: t encoded-kbd-mode: t show-paren-mode: t mac-key-mode: t display-time-mode: t mac-print-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: c o u n t ) C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b c o n s SPC C-e C-x C-e C-] C-p C-p C-p C-p C-p C-p C-x C-e C-n C-n C-n C-n C-n C-n C-e C-x C-e ) C-n C-n C-b C-b C-x C-e C-] C-e C-x C-e C-x C-e C-x 5 2 C-h f C-x 1 C-x C-b C-n SPC ( l i s t SPC C-e ) b x C-e C-x C-e C-] C-b C-x C-e C-n C-n C-x C-e C-p C-p C-p C-p C-p C-p C-a C-k C-k C-y C-y C-p C-p C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d C-d ( s e t q SPC C-e SPC n i l ) C-a ; C-e C-x C-e C-n C-n C-n C-n C-n C-n C-n C-n C-p C-x C-e C-x 5 2 C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b C-b ( s r t q e t q SPC C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f ( s e t q SPC C-k C-y SPC ( 1 + SPC C-y C-x C-e ) ) ) ) C-x C-e C-e C-b C-x C-e C-x C-e C-n C-n C-p C-p C-p C-p C-p C-p C-p C-x C-e C-n C-n C-n C-n C-n C-n C-n C-x C-e C-n C-n C-n C-n C-n C-n C-] C-x C-x A-c Recent messages: 1 Entering debugger... ((:zz-count . 1)) ((:zz-count . 2)) nil ((lambda (frame) (progn (select-frame-set-input-focus frame) (modify- frame-parameters frame (list (cons :zz-count (setq zz-frame-count (1+ zz-frame-count))))) (message "%S" (frame-parameters frame)) (mwm)))) Auto-saving...done Quit Auto-saving... Loading emacsbug...done ------------=_1205939405-2992-1--