help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Problem setting frame title on startup


From: XeCycle
Subject: Re: Problem setting frame title on startup
Date: Mon, 18 Mar 2013 13:40:42 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux)

Ian van der Neut <ivdneut@gmail.com> writes:

[...]

> In normal mode (just starting 'emacs filename' from the command line, rather
> than emacsclient) it doesn't show the project name until I open a new frame,
> then both frames get the right frame title.

If Emacs is started as `emacs --daemon`, there would be no frame
while executing .emacs.  If not started as a daemon, there would
be one, but after-make-frame-functions won't be executed for this
frame.

Therefore I wrote this macro:

(require 'cl)
(defmacro do-frames (&rest body)
  (let ((frame (gensym)))
    `(progn
       (dolist (,frame (frame-list))
         (select-frame ,frame)
         ,@body)
       (add-hook 'after-make-frame-functions
                 (lambda (new-frame)
                   (select-frame new-frame)
                   ,@body)))))

And (do-frames (what-ever you-like)) would work for all frames,
either started as daemon or not.

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

Attachment: pgpq9KoBrJFdS.pgp
Description: PGP signature


reply via email to

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