From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c' Date: Fri, 21 Dec 2012 14:10:31 +0100 Message-ID: <87y5grmtyw.fsf@zigzag.favinet> References: <50D2F0FD.30804@gmx.at> <50D3181F.6010008@gmx.at> <8738z0ok7k.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1356095391 15054 80.91.229.3 (21 Dec 2012 13:09:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Dec 2012 13:09:51 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 21 14:10: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 1Tm2MW-00088t-38 for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Dec 2012 14:10:04 +0100 Original-Received: from localhost ([::1]:53504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm2MI-0006Os-9X for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Dec 2012 08:09:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm2M5-0006NK-58 for help-gnu-emacs@gnu.org; Fri, 21 Dec 2012 08:09:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tm2Lw-0000KU-Nl for help-gnu-emacs@gnu.org; Fri, 21 Dec 2012 08:09:37 -0500 Original-Received: from smtp206.alice.it ([82.57.200.102]:38397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tm2Lw-0000KE-DL for help-gnu-emacs@gnu.org; Fri, 21 Dec 2012 08:09:28 -0500 Original-Received: from zigzag.favinet (79.21.65.89) by smtp206.alice.it (8.6.058.01) id 508F91B907B7205F; Fri, 21 Dec 2012 14:09:26 +0100 Original-Received: from ttn by zigzag.favinet with local (Exim 4.72) (envelope-from ) id 1Tm2N6-0005Ou-QU; Fri, 21 Dec 2012 14:10:40 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 20 Dec 2012 12:06:54 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.102 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:88273 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable () Stefan Monnier () Thu, 20 Dec 2012 12:06:54 -0500 You mean like (unless (or files commands) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) ((buffer-live-p initial-buffer-choice) initial-buffer-choic= e) (t "*scratch*")))) (switch-to-buffer (get-buffer-create buf) 'norecord))) Almost. To rid ourselves of the last local var: (unless (or files commands) (switch-to-buffer=20 (get-buffer-create=20 (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) ((buffer-live-p initial-buffer-choice)=20 initial-buffer-choice) (t "*scratch*"))) 'norecord)) or (hewing closer to OP approach): (unless (or files commands) (switch-to-buffer=20 (get-buffer-create=20 (or (case (type-of initial-buffer-choice) (string (find-file-noselect initial-buffer-choice)) (buffer (when (buffer-live-p initial-buffer-choice) initial-buffer-choice))) "*scratch*")) 'norecord)) Same difference; more stack, less state... Since we're talking style, i'd say the most important thing is sane indentation, but luckily we have Emacs for that. :-D =2D-=20 Thien-Thi Nguyen ..................................... GPG key: 4C807502 . NB: ttn at glug dot org is not me . . (and has not been since 2007 or so) . . ACCEPT NO SUBSTITUTES . ........... please send technical questions to mailing lists ........... --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAlDUX8kACgkQZwMiJEyAdQKvkACeI2MCiXh0i+eCKk0xKQUZkXKE 4uQAoKzjRm2d/6WGae6SNn9mnb5zvJud =rXXP -----END PGP SIGNATURE----- --=-=-=--