help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding switch to *scratch* buffer after creating new frame with


From: Stefan Monnier
Subject: Re: Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c'
Date: Thu, 20 Dec 2012 12:06:54 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

   > (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)))

> It would be better w/o local vars and ‘setq’, though.

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-choice)
             (t "*scratch*"))))
       (switch-to-buffer (get-buffer-create buf) 'norecord)))


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]