Hi,
I'm using Emacs 26.1 and when using emacsclient to visit files I noticed that sometimes the buffer is displayed but not with the requested line visible. I've tracked this down to the server-switch-buffer function in server.el. Near the end of this function the code handles the case where the buffer was not already being displayed in an existing window:
(condition-case nil
(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)))))))
(when server-raise-frame
(select-frame-set-input-focus (window-frame)))))
This code is missing a call to the
server-goto-line-column function that is called earlier in the function if the buffer is already being displayed in an existing window. I changed the above lines as follows to get it to work as expected:
(condition-case nil
(progn
(switch-to-buffer next-buffer)
(when filepos
(server-goto-line-column filepos)))
;; 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)))))))
(when server-raise-frame
(select-frame-set-input-focus (window-frame)))))
--
Glenn