From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c' Date: Thu, 20 Dec 2012 14:52:31 +0100 Message-ID: <50D3181F.6010008@gmx.at> References: <50D2F0FD.30804@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356011571 30534 80.91.229.3 (20 Dec 2012 13:52:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Dec 2012 13:52:51 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: =?UTF-8?B?0JrQvtC90YHRgtCw0L3RgtC40L0g0JrRg9C70LjQutC+0LI=?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 20 14:53:06 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TlgYU-0004wK-9X for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Dec 2012 14:52:58 +0100 Original-Received: from localhost ([::1]:42770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlgYG-0001p3-JN for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Dec 2012 08:52:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlgY9-0001no-Te for help-gnu-emacs@gnu.org; Thu, 20 Dec 2012 08:52:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlgY8-0005XG-Kf for help-gnu-emacs@gnu.org; Thu, 20 Dec 2012 08:52:37 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:60638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlgY8-0005X0-9y for help-gnu-emacs@gnu.org; Thu, 20 Dec 2012 08:52:36 -0500 Original-Received: from mailout-de.gmx.net ([10.1.76.19]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MBHjf-1TvLiY17TB-00AFjE for ; Thu, 20 Dec 2012 14:52:35 +0100 Original-Received: (qmail invoked by alias); 20 Dec 2012 13:52:35 -0000 Original-Received: from 62-47-36-61.adsl.highway.telekom.at (EHLO [62.47.36.61]) [62.47.36.61] by mail.gmx.net (mp019) with SMTP; 20 Dec 2012 14:52:35 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18Uc+wUnuwUG2HuukUAWz6Z+YqVvTwUzoXScw+zV4 cXZeHb6LNw+3ID In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.19 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88247 Archived-At: >> 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 )' the window on this > frame is switched to that 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