unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
@ 2017-10-28  3:30 Xiaolong Zhang
  2017-10-28  6:49 ` Eli Zaretskii
  2019-09-29  0:39 ` Stefan Kangas
  0 siblings, 2 replies; 6+ messages in thread
From: Xiaolong Zhang @ 2017-10-28  3:30 UTC (permalink / raw)
  To: 29036

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

Hi list,

I got no answer on stack-exchange for emacs (
https://emacs.stackexchange.com/questions/36434/make-emacs-recenter-the-line-for-latex-inverse-search)
so I'm asking here.


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.

Thanks.

Best,
Xiaolong

[-- Attachment #2: Type: text/html, Size: 2163 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
  2017-10-28  3:30 bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line Xiaolong Zhang
@ 2017-10-28  6:49 ` Eli Zaretskii
  2017-10-29 10:57   ` Xiaolong Zhang
  2019-09-29  0:39 ` Stefan Kangas
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-28  6:49 UTC (permalink / raw)
  To: Xiaolong Zhang; +Cc: 29036

> From: Xiaolong Zhang <xlzhang921@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
  2017-10-28  6:49 ` Eli Zaretskii
@ 2017-10-29 10:57   ` Xiaolong Zhang
  2017-10-29 11:18     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Xiaolong Zhang @ 2017-10-29 10:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29036

[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]

Hi Eli,

Thanks. You are right, vanilla ​Emacs indeed recenters a new file by
default.
I'm using spacemacs, which won't and I'm investigating the problem.


If the file is already visited in Emacs, it won't recenter. Is it possible
to make
Emacs recenter even if it's already visited? I've check with Notepad++,
which
will recenter even if it's already opened.

Best,
Xiaolong



On Sat, Oct 28, 2017 at 2:49 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Xiaolong Zhang <xlzhang921@gmail.com>
> > 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.
>

[-- Attachment #2: Type: text/html, Size: 3577 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
  2017-10-29 10:57   ` Xiaolong Zhang
@ 2017-10-29 11:18     ` Eli Zaretskii
  2017-10-29 11:20       ` Xiaolong Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-29 11:18 UTC (permalink / raw)
  To: Xiaolong Zhang; +Cc: 29036

> From: Xiaolong Zhang <xlzhang921@gmail.com>
> Date: Sun, 29 Oct 2017 18:57:36 +0800
> Cc: 29036@debbugs.gnu.org
> 
> If the file is already visited in Emacs, it won't recenter. Is it possible to make
> Emacs recenter even if it's already visited?

You can only do that by customizing the scrolling behavior in
general.  There's no special behavior for visiting a file that is
already in Emacs.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
  2017-10-29 11:18     ` Eli Zaretskii
@ 2017-10-29 11:20       ` Xiaolong Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Xiaolong Zhang @ 2017-10-29 11:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29036

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Got it. Thanks.

On Sun, Oct 29, 2017 at 7:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Xiaolong Zhang <xlzhang921@gmail.com>
> > Date: Sun, 29 Oct 2017 18:57:36 +0800
> > Cc: 29036@debbugs.gnu.org
> >
> > If the file is already visited in Emacs, it won't recenter. Is it
> possible to make
> > Emacs recenter even if it's already visited?
>
> You can only do that by customizing the scrolling behavior in
> general.  There's no special behavior for visiting a file that is
> already in Emacs.
>

[-- Attachment #2: Type: text/html, Size: 1043 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line
  2017-10-28  3:30 bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line Xiaolong Zhang
  2017-10-28  6:49 ` Eli Zaretskii
@ 2019-09-29  0:39 ` Stefan Kangas
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2019-09-29  0:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Xiaolong Zhang, 29036-done

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Xiaolong Zhang <xlzhang921@gmail.com>
>> Date: Sun, 29 Oct 2017 18:57:36 +0800
>> Cc: 29036@debbugs.gnu.org
>>
>> If the file is already visited in Emacs, it won't recenter. Is it possible to make
>> Emacs recenter even if it's already visited?
>
> You can only do that by customizing the scrolling behavior in
> general.  There's no special behavior for visiting a file that is
> already in Emacs.

It seems like the reporter got the needed answer.  I'm therefore closing
this bug report.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-29  0:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-28  3:30 bug#29036: 26.0.90; Feature Request: make "emacsclient +linenum file" rencenter line Xiaolong Zhang
2017-10-28  6:49 ` Eli Zaretskii
2017-10-29 10:57   ` Xiaolong Zhang
2017-10-29 11:18     ` Eli Zaretskii
2017-10-29 11:20       ` Xiaolong Zhang
2019-09-29  0:39 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).