]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix positioning client buffer as instructed by emacsclient
authorEli Zaretskii <eliz@gnu.org>
Wed, 8 May 2019 17:34:09 +0000 (20:34 +0300)
committerEli Zaretskii <eliz@gnu.org>
Wed, 8 May 2019 17:34:09 +0000 (20:34 +0300)
* lisp/server.el (server-switch-buffer): Let-bind
switch-to-buffer-preserve-window-point to nil when switching
to the client buffer, when the client requested a specific
position.  (Bug#35602)

lisp/server.el

index a39b1cb46d40d596d09df1de9e138a8979824e80..42329e853baea831d4de51b2988bd8f056d697c7 100644 (file)
@@ -1621,7 +1621,14 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
                              (frame-terminal))))
                'nomini 'visible (selected-window))))
            (condition-case nil
-               (switch-to-buffer next-buffer)
+                ;; If the client specified a new buffer position,
+                ;; treat that as an explicit point-move command, and
+                ;; override switch-to-buffer-preserve-window-point.
+                (let ((switch-to-buffer-preserve-window-point
+                       (if filepos
+                           nil
+                         switch-to-buffer-preserve-window-point)))
+                  (switch-to-buffer next-buffer))
              ;; After all the above, we might still have ended up with
              ;; a minibuffer/dedicated-window (if there's no other).
              (error (pop-to-buffer next-buffer)))))))