]> code.delx.au - gnu-emacs/commitdiff
* lisp/server.el (server-execute): Respect initial-buffer-choice
authorChong Yidong <cyd@gnu.org>
Fri, 20 Apr 2012 10:04:19 +0000 (18:04 +0800)
committerChong Yidong <cyd@gnu.org>
Fri, 20 Apr 2012 10:04:19 +0000 (18:04 +0800)
if it is a string and there are no files to open.
(server-create-window-system-frame, server-create-tty-frame):
Don't switch buffers here.

Fixes: debbugs:2825
etc/NEWS
lisp/ChangeLog
lisp/server.el

index 16b9f75c5039764ce3e7d3f8004b190846b4db41..b2c487ba15b345edfc1d00acc417e7e5b126ed9e 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -53,6 +53,10 @@ automatically when setting `imagemagick-types-inhibit'.
 *** Setting `imagemagick-types-inhibit' to t now disables the use of
 ImageMagick to view images, set
 
+** String values for `initial-buffer-choice' also apply to emacsclient
+frames, if emacsclient is only told to open a new frame without
+specifying any file to visit or expression to evaluate.
+
 \f
 * Editing Changes in Emacs 24.2
 
index c9cece95445ec10aec4d1188186260217bf7603a..947ae6f17f69332d0d4e4532be393dc7cb8a6d66 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * server.el (server-execute): Respect initial-buffer-choice if it
+       is a string and there are no files to open (Bug#2825).
+       (server-create-window-system-frame, server-create-tty-frame):
+       Don't switch buffers here.
+
 2012-04-20  Dan Nicolaescu  <dann@gnu.org>
 
        * battery.el (battery-echo-area-format): Display remaining time
index 123fea3743ac1c896da81b5aabc072f0031de843..f9c8ea5c5771e03d5cd093d8a37a302f68c028fb 100644 (file)
@@ -821,10 +821,6 @@ This handles splitting the command if it would be bigger than
     (select-frame frame)
     (process-put proc 'frame frame)
     (process-put proc 'terminal (frame-terminal frame))
-
-    ;; Display *scratch* by default.
-    (switch-to-buffer (get-buffer-create "*scratch*") 'norecord)
-
     frame))
 
 (defun server-create-window-system-frame (display nowait proc parent-id
@@ -857,9 +853,6 @@ This handles splitting the command if it would be bigger than
       (select-frame frame)
       (process-put proc 'frame frame)
       (process-put proc 'terminal (frame-terminal frame))
-
-      ;; Display *scratch* by default.
-      (switch-to-buffer (get-buffer-create "*scratch*") 'norecord)
       frame)))
 
 (defun server-goto-toplevel (proc)
@@ -1230,12 +1223,17 @@ The following commands are accepted by the client:
   ;; including code that needs to wait.
   (with-local-quit
     (condition-case err
-        (let* ((buffers
-                (when files
-                  (server-visit-files files proc nowait))))
-
+        (let ((buffers (server-visit-files files proc nowait)))
           (mapc 'funcall (nreverse commands))
 
+         ;; If we were told only to open a new client, obey
+         ;; `initial-buffer-choice' if it specifies a file.
+         (unless (or files commands)
+           (if (stringp initial-buffer-choice)
+               (find-file initial-buffer-choice)
+             (switch-to-buffer (get-buffer-create "*scratch*")
+                               'norecord)))
+
           ;; Delete the client if necessary.
           (cond
            (nowait