Re: server-goto-file-row goes to line 1

2009-07-16 Thread Sam Liddicott
* rgheck wrote, On 15/07/09 17:28:

> Here's what the docs say:
> 
> LFUN_SERVER_GOTO_FILE_ROW
> 
> * Action Sets the cursor position based on the row number of generated
> TeX file.
> 
> * Notion This can be useful for DVI inverse-search or detection of the
> problematic line from LaTeX compilation. Note that before this function
> can be used export to LaTeX output must occur (in order to map the row
> numbers).
> 
> * Syntax server-goto-file-row  
> 
> * Params : the filename. Environment variables are expaned in the
> path. In case this LFUN does not work make sure you are giving correct
> path to the file.If the file is located inside LyX temporary directory
> it will be mapped back into the appropriate opened buffer (e.g. for the
> case of generated .tex file). .ext: extensions will be automatically
> replaced by .lyx.
> 
> Note that the row number is that of the LaTeX output file, NOT the LyX
> file on screen.


atm this isn't working as you say either (for me)...

I fired up a fresh invocation of Lyx, CTRL+N and typed:
now is the time
for all good men
to drink lemonade
at the party

CTRL+S to save as /tmp/file.lyx

I then did a dvi preview, In /tmp/lyx_tmpdir.J19856/lyx_tmpbuf0 I can
see the files that were generated. file.tex shows:

--8<-8<-8<---
\batchmode
\makeatletter
\def\in...@path{{/tmp//}}
\makeatother
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\usepackage{babel}

\begin{document}
now is the time

for all good men

to drink lemonade

at the party
\end{document}
--8<-8<-8<---

and in the command buffer I type (to jump to "for all good men"):

server-goto-file-row /tmp/file.lyx 14

but the cursor just goes back to line 1 again...

I even tried (for good luck):
server-goto-file-row /tmp/lyx_tmpdir.J19856/lyx_tmpbuf0/file.tex 14

but the cursor jumps to line 1 still.

I've tried lines 1-17 but still it won't do anything apart from jump
back to line 1.


I then switched to "Article (noweb)".

I note that a .nw is created as an intermediate file - is this the file
used for the line number mappings or is it the text file generated by
noweave? This question really concerns me because I am trying to map
from source files back to the lyx document, not from the dvi back to the
lyx document.

Sam



Re: server-goto-file-row goes to line 1

2009-07-16 Thread rgheck

On 07/16/2009 09:16 AM, Sam Liddicott wrote:

* rgheck wrote, On 16/07/09 13:51:
   

On 07/16/2009 06:23 AM, Pavel Sanda wrote:
 

Richard Heck wrote:

   

So are you doing this from outside LyX with calls to the lyxserver? If
so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow
and stupid, but it'll work.

 

ouch, this will be dependent on the window resolution. navigate in .lyx
file is a bad idea anyway.


   

Yes, I had the same thought. But from what I can tell, that's what he
wants to do: Go to a particular line of the displayed LyX file.

Or did you want to go to a line of the LyX file, as it is saved on disk?
 


As saved on disk, as this is what gcc is complaining about (I've been
using notangle directly on the lyx file).

I'm resigned that it is impossible and wont easily be possible.

   
As saved on disk will indeed be difficult. We don't have that 
information in the Buffer structure.


rh



Re: server-goto-file-row goes to line 1

2009-07-16 Thread Sam Liddicott
* rgheck wrote, On 16/07/09 13:51:
> On 07/16/2009 06:23 AM, Pavel Sanda wrote:
>> Richard Heck wrote:
>>   
>>> So are you doing this from outside LyX with calls to the lyxserver? If
>>> so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow
>>> and stupid, but it'll work.
>>>  
>>
>> ouch, this will be dependent on the window resolution. navigate in .lyx
>> file is a bad idea anyway.
>>
>>
> Yes, I had the same thought. But from what I can tell, that's what he
> wants to do: Go to a particular line of the displayed LyX file.
> 
> Or did you want to go to a line of the LyX file, as it is saved on disk?

As saved on disk, as this is what gcc is complaining about (I've been
using notangle directly on the lyx file).

I'm resigned that it is impossible and wont easily be possible.

Sam


Re: server-goto-file-row goes to line 1

2009-07-16 Thread rgheck

On 07/16/2009 06:23 AM, Pavel Sanda wrote:

Richard Heck wrote:
   

So are you doing this from outside LyX with calls to the lyxserver? If
so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow
and stupid, but it'll work.
 


ouch, this will be dependent on the window resolution. navigate in .lyx
file is a bad idea anyway.

   
Yes, I had the same thought. But from what I can tell, that's what he 
wants to do: Go to a particular line of the displayed LyX file.


Or did you want to go to a line of the LyX file, as it is saved on disk?

rh



Re: server-goto-file-row goes to line 1

2009-07-16 Thread Pavel Sanda
Richard Heck wrote:
> So are you doing this from outside LyX with calls to the lyxserver? If 
> so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow 
> and stupid, but it'll work.

ouch, this will be dependent on the window resolution. navigate in .lyx
file is a bad idea anyway.
pavel


Re: server-goto-file-row goes to line 1

2009-07-16 Thread Sam Liddicott
* rgheck wrote, On 15/07/09 21:46:
> On 07/15/2009 03:42 PM, Sam Liddicott wrote:
>> My C sources aren't generated via the tex files (partly because it's
>> not simple to get Lyx to export a tex file from a noweb document
>> without running noweb).
>>
>> I really need to be able to navigate to a line (and column even) in
>> the Lyx file.
>>
> So are you doing this from outside LyX with calls to the lyxserver? If
> so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow
> and stupid, but it'll work.

Thanks for the advice.

I've filed an enhancement request 6087 in trac.

Sam


Re: server-goto-file-row goes to line 1

2009-07-15 Thread rgheck

On 07/15/2009 03:42 PM, Sam Liddicott wrote:
My C sources aren't generated via the tex files (partly because it's 
not simple to get Lyx to export a tex file from a noweb document 
without running noweb).


I really need to be able to navigate to a line (and column even) in 
the Lyx file.


So are you doing this from outside LyX with calls to the lyxserver? If 
so, then use a for loop or something and call LFUN_DOWN repeatedly. Slow 
and stupid, but it'll work.


rh



Re: server-goto-file-row goes to line 1

2009-07-15 Thread Sam Liddicott

rgheck wrote:

On 07/15/2009 10:25 AM, Sam Liddicott wrote:

If I type: server-goto-file-row THISFILENAME.lyx 20
into the Lyx command buffer, it always goes to the top of the document.

(I'm using Lyx 1.6.2).

Am I using the command wrongly...?

   

Probably. I suspect you haven't run LaTeX on the file yet.

Here's what the docs say:

LFUN_SERVER_GOTO_FILE_ROW

* Action Sets the cursor position based on the row number of generated 
TeX file.


gah! thats horrific!

I mean it's excellent that it can do the reverse mapping of a tex file

but it means there is no way to navigate the Lyx file - even if the 
specified filename ended in .lyx and not .tex


My C sources aren't generated via the tex files (partly because it's not 
simple to get Lyx to export a tex file from a noweb document without 
running noweb).



I really need to be able to navigate to a line (and column even) in the 
Lyx file.


Sam


Re: server-goto-file-row goes to line 1

2009-07-15 Thread rgheck

On 07/15/2009 10:25 AM, Sam Liddicott wrote:

If I type: server-goto-file-row THISFILENAME.lyx 20
into the Lyx command buffer, it always goes to the top of the document.

(I'm using Lyx 1.6.2).

Am I using the command wrongly...?

   

Probably. I suspect you haven't run LaTeX on the file yet.

Here's what the docs say:

LFUN_SERVER_GOTO_FILE_ROW

* Action Sets the cursor position based on the row number of generated 
TeX file.


* Notion This can be useful for DVI inverse-search or detection of the 
problematic line from LaTeX compilation. Note that before this function 
can be used export to LaTeX output must occur (in order to map the row 
numbers).


* Syntax server-goto-file-row  

* Params : the filename. Environment variables are expaned in the 
path. In case this LFUN does not work make sure you are giving correct 
path to the file.If the file is located inside LyX temporary directory 
it will be mapped back into the appropriate opened buffer (e.g. for the 
case of generated .tex file). .ext: extensions will be automatically 
replaced by .lyx.


Note that the row number is that of the LaTeX output file, NOT the LyX 
file on screen.


Richard




server-goto-file-row goes to line 1

2009-07-15 Thread Sam Liddicott
If I type: server-goto-file-row THISFILENAME.lyx 20
into the Lyx command buffer, it always goes to the top of the document.

(I'm using Lyx 1.6.2).

Am I using the command wrongly or are there other known problems that
someone can comment on?

Thanks

Sam