unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: XeCycle <XeCycle@Gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Problem setting frame title on startup
Date: Mon, 18 Mar 2013 13:40:42 +0800	[thread overview]
Message-ID: <87a9q1jmed.fsf@xc.laptop> (raw)
In-Reply-To: CANyFcg0YbUN-64R=SdWW5vWKkz9mBdNZgYDB5sLd4y5f=PXN5w@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

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 #2: Type: application/pgp-signature, Size: 489 bytes --]

      reply	other threads:[~2013-03-18  5:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 19:24 Problem setting frame title on startup Ian van der Neut
2013-03-15 19:51 ` Mark Skilbeck
2013-03-16  9:47   ` Ian van der Neut
2013-03-16 10:24     ` Mark Skilbeck
2013-03-16 11:04       ` Ian van der Neut
2013-03-16 11:26         ` Ian van der Neut
2013-03-18  5:40           ` XeCycle [this message]

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=87a9q1jmed.fsf@xc.laptop \
    --to=xecycle@gmail.com \
    --cc=help-gnu-emacs@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.
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).