From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?0JrQvtC90YHRgtCw0L3RgtC40L0g0JrRg9C70LjQutC+0LI=?= Newsgroups: gmane.emacs.devel Subject: Re: Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c' Date: Thu, 20 Dec 2012 15:13:58 +0300 Message-ID: References: <50D2F0FD.30804@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b414e8c6c6eb604d147aab4 X-Trace: ger.gmane.org 1356005649 8265 80.91.229.3 (20 Dec 2012 12:14:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Dec 2012 12:14:09 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 20 13:14:24 2012 Return-path: Envelope-to: ged-emacs-devel@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 1Tlf13-0002mS-N3 for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 13:14:21 +0100 Original-Received: from localhost ([::1]:50735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlf0q-0006K7-23 for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2012 07:14:08 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlf0l-0006K0-67 for emacs-devel@gnu.org; Thu, 20 Dec 2012 07:14:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tlf0i-0006PH-B8 for emacs-devel@gnu.org; Thu, 20 Dec 2012 07:14:03 -0500 Original-Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:58843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlf0i-0006PD-0e for emacs-devel@gnu.org; Thu, 20 Dec 2012 07:14:00 -0500 Original-Received: by mail-wg0-f41.google.com with SMTP id ds1so856595wgb.4 for ; Thu, 20 Dec 2012 04:13:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=D8TkkajoJYC27oUXvWs678JhHJ+we1aBcVqeGWJpGXg=; b=snTefu1ns68DJGM97waOMagR1YTpGfXuQp5/b8UkdZwVs42kt1XySv+libpqOLxmrA RVsURiB3drb2dJGKVhNwKC1PWv2tLASf5TvQsEIfY8nGJEvCaho566Vn5i7ie/tZGt6Q +TYXevVAHZRFJ1wtRBGT9q1ajcEaKUTyeCUs1oDdbbsvjqnwLFSyudDhpD0vXAj91vjF 4RAeI7vRIlvTRVlLLF3rJtEr6qsjz9aXUTvntvIyPPzdeTunV3Jx5cHWemUKlSU2ysLq ddyhDf5uXXO054nbFzcZsDVXz/imSV1q1C2JrogqxgfoxqYJU32AhlqdXdhWrc1FXXr+ gyJw== Original-Received: by 10.194.23.37 with SMTP id j5mr17162595wjf.28.1356005638958; Thu, 20 Dec 2012 04:13:58 -0800 (PST) Original-Received: by 10.217.47.138 with HTTP; Thu, 20 Dec 2012 04:13:58 -0800 (PST) In-Reply-To: <50D2F0FD.30804@gmx.at> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:155683 Archived-At: --047d7b414e8c6c6eb604d147aab4 Content-Type: text/plain; charset=UTF-8 //sorry, for send you double ;p >We probably should verify that the buffer is live yes, it's reasonable >file a bug report for this only after discussion on this mail-list :) >which buffer you want to show here in practice it's could be just *any* buffer >set to such a buffer and that buffer does not exist? then, I think that we could fall back to *scratch* >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... >It doesn't sound like a good idea, in particular so 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. 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))) --047d7b414e8c6c6eb604d147aab4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
//sor= ry, for send you double ;p

>We probably should verify = that the buffer is live
yes, it's reasonable

>file a bug report for this
only after discussion on = this mail-list :)

>which buffer you want to show here in practice
it's could be just *any* buffer

>se= t to such a buffer and that buffer does not exist?
then, I think that we could fall back to *scratch*


>add an appropriate customization type for `initial-buffer-choice'
I don't think that it's will be useful for users to cus= tomise, but who knows...
>It doesn't soun= d like a good idea, in particular so
Here the scenario:
I wa= nt new frames to switch to some buffer so I added hook to
`after-make-fr= ame-functions'.
Inside this hook I do `(switch-to-buffer <s= ome-buffer>)' the window on this
frame is switched to that <some-buffer> at first, but after a short t= ime it's
switched to *scratch*. So as I think it would be bett= er that
`after-make-frame-functions' will be called after this '= default switching to
*scratch* behaviour' is performed. And than will be no need for me to
add code to server.el.
// New version:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (unless (or files = commands)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((t= ype (type-of initial-buffer-choice))
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (buf "*scratch*"))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cond
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((eq 'string = type) (setq buf (find-file-noselect initial-buffer-choice)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ((eq 'buffer type) (when (buffer-live-p initial-buffer-choice= )
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (setq buf initial-buffer-choice))))
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (switch-to-= buffer (get-buffer-create buf) 'norecord)))

--047d7b414e8c6c6eb604d147aab4--