Subject: bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line

From: Eli Zaretskii <[email-masked]>
Date: Sat, 28 Oct 2017 09:49:44 +0300

> From: Xiaolong Zhang <[email-masked]>
> Date: Sat, 28 Oct 2017 11:30:27 +0800
> 
> I'm using emacs for LaTeX file editing and emacsclient support the nice command line option "+linenum file"
> to "visit file using find-file, then go to line number linenum in it", which works well. 
> 
> Is it possible to recenter to linenum at the sametime? This is the default behavior for Notepad++ and I've tried
> the "--eval" option, but it won't switch focus to  emacs automatically.

Emacs recenters by default, so unless you have some customizations
which disable that as side effect, it should already do what you
want.  I just tried the command

  emacsclient +150 configure.ac

and got line 150 centered in the window where Emacs shows the file.
If that doesn't work for you, please show the exact recipe.  You seem
to invoke emacsclient from another program (I tried from the shell
prompt), so perhaps there's something in that context which affects
the issue; I'm not familiar with "SumatraPDF" and the "inverse search
feature".

Another possible reason for not recentering is that the file whose
name is passed to emacsclient is already visited in Emacs, and the
line whose number you pass to emacsclient is already visible in some
window, but not at the center of that window.  In that case, Emacs
will not recenter.