Overhaul and simplify single_kboard API. Allow calls to `recursive-edit' in process...
[bpt/emacs.git] / lisp / server.el
index 40806a1..382befd 100644 (file)
@@ -322,8 +322,8 @@ message."
     (when (and (frame-live-p frame)
               proc
               ;; See if this is the last frame for this client.
-              (< 1 (let ((frame-num 0))
-                     (dolist ((f (frame-list)))
+              (>= 1 (let ((frame-num 0))
+                     (dolist (f (frame-list))
                        (when (eq proc (frame-parameter f 'client))
                          (setq frame-num (1+ frame-num))))
                      frame-num)))
@@ -755,9 +755,17 @@ The following commands are accepted by the client:
                (with-selected-frame frame
                  (switch-to-buffer (or (car buffers)
                                        (get-buffer-create "*scratch*")))
+                 (display-startup-echo-area-message)
                  (unless inhibit-splash-screen
-                   (display-splash-screen))
-                 (display-startup-echo-area-message)))
+                   (condition-case err
+                       ;; This looks scary because `fancy-splash-screens'
+                       ;; will call `recursive-edit' from a process filter.
+                       ;; However, that should be safe to do now.
+                       (display-splash-screen)
+                     ;; `recursive-edit' will throw an error if Emacs is
+                     ;; already doing a recursive edit elsewhere.  Catch it
+                     ;; here so that we can finish normally.
+                     (error nil)))))
 
              ;; Delete the client if necessary.
              (cond