emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

difficulty creating unique frame names


From: Damon Permezel
Subject: difficulty creating unique frame names
Date: Tue, 11 Mar 2008 13:41:55 +1000

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 "<unique> %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 <switch-frame> <down-mouse-1> <mouse-movement>
<mouse-1> C-h f <return> <help-echo> C-x 1 C-x C-b
C-n SPC <down-mouse-1> <mouse-1> ( l i s t SPC C-e
) b x C-e <backspace> <backspace> 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 <switch-frame> <switch-frame> <help-echo> <down-mouse-1>
<mouse-movement> <mouse-1> 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 <backspace>
<backspace> <backspace> e t q SPC <backspace> <backspace>
<backspace> <backspace> <backspace> 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 <backspace>
<backspace> <backspace> SPC ( 1 + SPC C-y <backspace>
<backspace> C-x C-e ) ) ) ) C-x C-e <down-mouse-1>
<mouse-1> <backspace> 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-] <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> C-x
C-x A-c <menu-bar> <help-menu> <send-emacs-bug-rep
ort>

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]