From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Damon Permezel Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: difficulty creating unique frame names Date: Tue, 11 Mar 2008 13:41:55 +1000 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v919.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1205207978 15273 80.91.229.12 (11 Mar 2008 03:59:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Mar 2008 03:59:38 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 11 05:00:06 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JYven-0001w6-DI for ged-emacs-devel@m.gmane.org; Tue, 11 Mar 2008 05:00:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYveF-0000DH-4G for ged-emacs-devel@m.gmane.org; Mon, 10 Mar 2008 23:59:31 -0400 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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 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: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:92125 gmane.emacs.pretest.bugs:21521 Archived-At: 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