GNU bug report logs -
#35602
26.1; emacsclient doesn't go to the desired line
Previous Next
Reported by: Robert Parlett <r.parlett <at> gmail.com>
Date: Mon, 6 May 2019 14:24:01 UTC
Severity: normal
Found in version 26.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 35602 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Parlett <r.parlett <at> gmail.com>
> Date: Mon, 6 May 2019 11:05:19 +0100
>
> 1 Start emacs with emacs -Q
> 2 In emacs, start the server with M-x server-start
> 3 In a shell, create some test text files :-
> $ man bash >f1.txt
> $ man top >f2.txt
> 4 Now run the following commands in the shell :-
> $ emacsclient +200 -n f1.txt
> $ emacsclient +300 -n f2.txt
> $ emacsclient +400 -n f1.txt
>
> The bug can be seen after the last emacsclient command above. The correct result would be that file f1.txt is
> made the current buffer, with the cursor on line 400. However, instead it is made the current buffer with the
> cursor remaining on line 200.
Thanks for reporting this.
This is switch-to-buffer-preserve-window-point in action. Does the
patch below fix the problem for you?
--- lisp/server.el~0 2019-01-16 06:33:00.000000000 +0200
+++ lisp/server.el 2019-05-07 17:20:14.108225200 +0300
@@ -1655,7 +1655,14 @@
(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)))))))
This bug report was last modified 6 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.