From: martin rudalics <rudalics@gmx.at>
To: "Константин Куликов" <zxnotdead@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c'
Date: Thu, 20 Dec 2012 14:52:31 +0100 [thread overview]
Message-ID: <50D3181F.6010008@gmx.at> (raw)
In-Reply-To: <CAFkz2ypcP-fmRH7jJWdhYRaRVB-VEtn0=5qWYQ_S+QCTmZ=TRQ@mail.gmail.com>
>> add an appropriate customization type for `initial-buffer-choice'
> I don't think that it's will be useful for users to customise, but who
> knows...
`initial-buffer-choice' _is_ an option specified via `defcustom' in
startup.el. We cannot implicitly ignore this fact in `command-line-1'.
But we could, for example, allow a function here and you could specify a
function to provide the buffer of your choice here.
> Here the scenario:
> I want new frames to switch to some buffer so I added hook to
> `after-make-frame-functions'.
> Inside this hook I do `(switch-to-buffer <some-buffer>)' the window on this
> frame is switched to that <some-buffer> at first, but after a short time
> it's
> switched to *scratch*. So as I think it would be better that
> `after-make-frame-functions' will be called after this 'default switching to
> *scratch* behaviour' is performed.
I'm afraid that this would mean a quite intrusive change to the sequence
of operations performed by the startup code. Are there any reasons why
you can't use `emacs-startup-hook' or `term-setup-hook' instead?
> And than will be no need for me to
> add code to server.el.
> // New version:
> (unless (or files commands)
> (let ((type (type-of initial-buffer-choice))
> (buf "*scratch*"))
> (cond
> ((eq 'string type) (setq buf (find-file-noselect
> initial-buffer-choice)))
> ((eq 'buffer type) (when (buffer-live-p
> initial-buffer-choice)
> (setq buf initial-buffer-choice))))
> (switch-to-buffer (get-buffer-create buf) 'norecord)))
Looks good to me.
martin
next parent reply other threads:[~2012-12-20 13:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFkz2yroLhknptDnWyC9B1fbZKEwTCV-T0VttHQiwZoaAW-j6A@mail.gmail.com>
[not found] ` <CAFkz2yrZ3wuMiyNY2edNLDG4jTAfNKXb5mvC6OYqu+0xE94Qgg@mail.gmail.com>
[not found] ` <50D2F0FD.30804@gmx.at>
[not found] ` <CAFkz2ypcP-fmRH7jJWdhYRaRVB-VEtn0=5qWYQ_S+QCTmZ=TRQ@mail.gmail.com>
2012-12-20 13:52 ` martin rudalics [this message]
2012-12-20 14:46 ` Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c' Thien-Thi Nguyen
2012-12-20 17:06 ` Stefan Monnier
2012-12-21 13:10 ` Thien-Thi Nguyen
2012-12-21 15:43 ` Constantin Kulikov
2012-12-22 17:46 ` Stefan Monnier
2012-12-20 9:59 martin rudalics
-- strict thread matches above, loose matches on Subject: below --
2012-12-19 13:14 Константин Куликов
2012-12-20 0:43 ` Константин Куликов
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=50D3181F.6010008@gmx.at \
--to=rudalics@gmx.at \
--cc=help-gnu-emacs@gnu.org \
--cc=zxnotdead@gmail.com \
/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).