emacs-diffs
[Top][All Lists]
Advanced

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

master e06324a: Revert "Don't flash previous buffer when connecting with


From: Eli Zaretskii
Subject: master e06324a: Revert "Don't flash previous buffer when connecting with emacsclient"
Date: Thu, 7 Nov 2019 12:15:07 -0500 (EST)

branch: master
commit e06324a032e9248cb9bce0e40077a726cc4ea719
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Revert "Don't flash previous buffer when connecting with emacsclient"
    
    This reverts commit 49fc040077b33bd1e78ee425575e76329b772a41.
    It turns out that the fix for a minor aesthetical annoyance
    caused much more serious bugs: bug#31038, bug#35726, Bug#37097,
---
 lisp/server.el | 89 +++++++++++++++++++++++++---------------------------------
 1 file changed, 39 insertions(+), 50 deletions(-)

diff --git a/lisp/server.el b/lisp/server.el
index 45fa55a..14114c8 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1098,8 +1098,7 @@ The following commands are accepted by the client:
                tty-type   ; string.
                files
                filepos
-               args-left
-                create-frame-func)
+               args-left)
            ;; Remove this line from STRING.
            (setq string (substring string (match-end 0)))
            (setq args-left
@@ -1251,29 +1250,28 @@ The following commands are accepted by the client:
                 (or files commands)
                 (setq use-current-frame t))
 
-           (setq create-frame-func
-                  (lambda ()
-                   (cond
-                    ((and use-current-frame
-                          (or (eq use-current-frame 'always)
-                              ;; We can't use the Emacs daemon's
-                              ;; terminal frame.
-                              (not (and (daemonp)
-                                        (null (cdr (frame-list)))
-                                        (eq (selected-frame)
-                                            terminal-frame)))))
-                     (setq tty-name nil tty-type nil)
-                     (if display (server-select-display display)))
-                    ((or (and (eq system-type 'windows-nt)
-                              (daemonp)
-                              (setq display "w32"))
-                         (eq tty-name 'window-system))
-                     (server-create-window-system-frame display nowait proc
-                                                   parent-id
-                                                   frame-parameters))
-                    ;; When resuming on a tty, tty-name is nil.
-                    (tty-name
-                     (server-create-tty-frame tty-name tty-type proc)))))
+           (setq frame
+                 (cond
+                  ((and use-current-frame
+                        (or (eq use-current-frame 'always)
+                            ;; We can't use the Emacs daemon's
+                            ;; terminal frame.
+                            (not (and (daemonp)
+                                      (null (cdr (frame-list)))
+                                      (eq (selected-frame)
+                                          terminal-frame)))))
+                   (setq tty-name nil tty-type nil)
+                   (if display (server-select-display display)))
+                  ((or (and (eq system-type 'windows-nt)
+                            (daemonp)
+                            (setq display "w32"))
+                       (eq tty-name 'window-system))
+                   (server-create-window-system-frame display nowait proc
+                                                      parent-id
+                                                      frame-parameters))
+                  ;; When resuming on a tty, tty-name is nil.
+                  (tty-name
+                   (server-create-tty-frame tty-name tty-type proc))))
 
             (process-put
              proc 'continuation
@@ -1285,7 +1283,7 @@ The following commands are accepted by the client:
                          (if (and dir (file-directory-p dir))
                              dir default-directory)))
                    (server-execute proc files nowait commands
-                                   dontkill create-frame-func tty-name)))))
+                                   dontkill frame tty-name)))))
 
             (when (or frame files)
               (server-goto-toplevel proc))
@@ -1294,7 +1292,7 @@ The following commands are accepted by the client:
     ;; condition-case
     (t (server-return-error proc err))))
 
-(defun server-execute (proc files nowait commands dontkill create-frame-func 
tty-name)
+(defun server-execute (proc files nowait commands dontkill frame tty-name)
   ;; This is run from timers and process-filters, i.e. "asynchronously".
   ;; But w.r.t the user, this is not really asynchronous since the timer
   ;; is run after 0s and the process-filter is run in response to the
@@ -1304,29 +1302,20 @@ The following commands are accepted by the client:
   ;; including code that needs to wait.
   (with-local-quit
     (condition-case err
-        (let* ((buffers (server-visit-files files proc nowait))
-               ;; If we were told only to open a new client, obey
-               ;; `initial-buffer-choice' if it specifies a file
-               ;; or a function.
-               (initial-buffer (unless (or files commands)
-                                 (let ((buf
-                                        (cond ((stringp initial-buffer-choice)
-                                               (find-file-noselect 
initial-buffer-choice))
-                                              ((functionp 
initial-buffer-choice)
-                                               (funcall 
initial-buffer-choice)))))
-                                   (if (buffer-live-p buf) buf 
(startup--get-buffer-create-scratch)))))
-               ;; Set current buffer so that newly created tty frames
-               ;; show the correct buffer initially.
-               (frame (with-current-buffer (or (car buffers)
-                                               initial-buffer
-                                               (current-buffer))
-                        (prog1
-                            (funcall create-frame-func)
-                          ;; Switch to initial buffer in case the frame was 
reused.
-                          (when initial-buffer
-                            (switch-to-buffer initial-buffer 'norecord))))))
-
-          (mapc #'funcall (nreverse commands))
+        (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
+          ;; or a function.
+          (unless (or files commands)
+            (let ((buf
+                   (cond ((stringp initial-buffer-choice)
+                         (find-file-noselect initial-buffer-choice))
+                        ((functionp initial-buffer-choice)
+                         (funcall initial-buffer-choice)))))
+             (switch-to-buffer
+              (if (buffer-live-p buf) buf (get-buffer-create "*scratch*"))
+              'norecord)))
 
           ;; Delete the client if necessary.
           (cond



reply via email to

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