Re: Reverse search with xdvi

2013-09-09 Thread Pavel Sanda
Fabio S. wrote:
>   direct search:
>   Tools->Preferences->Output->General
>xdvi -nofork -sourceposition "$$n $$t" $$o -editor 
> "lyxeditor.sh %f
> %l"

 "-nofork" part is needed because of the pipe?
>>>
>>> I guess: the point is that without -nofork if you have xdvi already open,
>>> lyx starts a new instance every time you execute direct search.
>>> I also addedd the -editor option.
>>
>> Have you really tried without nofork option?
>> I just tried the standard call
>> xdvi -sourceposition 445:example.tex example.dvi
>> and no new instance was opened, instead it correctly jumped in already 
>> existing
>> viewer.
>
> Yes, I really tried both and it was like I described. I am sure: I clearly 
> remember having two open instances of xdvi.
> But now I tried again and it works correctly even without the nofork 
> options.
>
> I can't understand what is happening! I am puzzled. :(

Ok. I committed the rest of changes already. Pavel


Re: Reverse search with xdvi

2013-09-09 Thread Fabio S.

direct search:
Tools->Preferences->Output->General
 xdvi -nofork -sourceposition "$$n $$t" $$o -editor 
"lyxeditor.sh %f
%l"


"-nofork" part is needed because of the pipe?


I guess: the point is that without -nofork if you have xdvi already open,
lyx starts a new instance every time you execute direct search.
I also addedd the -editor option.


Have you really tried without nofork option?
I just tried the standard call
xdvi -sourceposition 445:example.tex example.dvi
and no new instance was opened, instead it correctly jumped in already existing
viewer.


Yes, I really tried both and it was like I described. I am sure: I clearly 
remember having two open instances of xdvi.
But now I tried again and it works correctly even without the nofork 
options.


I can't understand what is happening! I am puzzled. :(

F.


Re: Reverse search with xdvi

2013-09-07 Thread Pavel Sanda
Fabio S. wrote:
>>> direct search:
>>> Tools->Preferences->Output->General
>>>  xdvi -nofork -sourceposition "$$n $$t" $$o -editor 
>>> "lyxeditor.sh %f 
>>> %l"
>>
>> "-nofork" part is needed because of the pipe?
>
> I guess: the point is that without -nofork if you have xdvi already open, 
> lyx starts a new instance every time you execute direct search.
> I also addedd the -editor option.

Have you really tried without nofork option?
I just tried the standard call
xdvi -sourceposition 445:example.tex example.dvi
and no new instance was opened, instead it correctly jumped in already existing
viewer.

Pavel


Re: Reverse search with xdvi

2013-09-06 Thread Fabio S.

If you can comment what and why was changed I can include it into docs as well.



ok.



xdvi:
inverse search:
Tools->Preferences->File Handling->File formats
 xdvi -editor "lyxeditor.sh %f %l"


In the docs: xdvi -editor 'lyxeditor.sh %f %l'
With single quotes it doesn't work (at least, for me)


direct search:
Tools->Preferences->Output->General
 xdvi -nofork -sourceposition "$$n $$t" $$o -editor "lyxeditor.sh %f 
%l"


"-nofork" part is needed because of the pipe?


I guess: the point is that without -nofork if you have xdvi already open, 
lyx starts a new instance every time you execute direct search.

I also addedd the -editor option.


okular:
inverse search:
Tools->Preferences->File Handling->File formats
 okular --unique


I'm not using okular, --unique should be default for inverse search purposes?


The default just says "okular" and the same in the following: I don't know 
wether it adds any option or not, but to have the correct behaviour 
without multiple instances of okular I had to specify these by hand.





direct search:
Tools->Preferences->Output->General
 okular --unique "$$o#src:$$n $$f"


Pavel



Thanks

Fabio


Re: Reverse search with xdvi

2013-09-05 Thread Pavel Sanda
Fabio Stumbo wrote:
>> Anyway does changing the line
>> read < "${LYXPIPE}".out || exit
>> into
>> read TMP < "${LYXPIPE}".out || exit
>>
>> work for you?
>> Pavel
>
> Yes this works. Thanks.

Ok, I committed this to 2.1 docs.

> But is there any difference with regards to simply comment it?

I didn't write this script but seems to be the way to keep pipe
clean in case other clients are using it for their own work.


> To answer your previous question:
>
> yes, there is a reason for I want to use named pipe. The reason is that I 
> often edit tex files via vim and so my Xresource for xdvi.editor is setted 
> to vim: using pipe I thought I could be able to use reverse search 
> regardless of the way xdvi is invoked and indeed that seems the case to me, 
> by the tests I did.
>
> Finally, I will collect all the necessary commands which work in my case 
> for inverse/direct search, for reference just in case somebody else will 
> need them since they are a little bit different from the ones listed in the 
> documentation:

If you can comment what and why was changed I can include it into docs as well.

> xdvi:
>   inverse search:
>   Tools->Preferences->File Handling->File formats
>xdvi -editor "lyxeditor.sh %f %l"
>   direct search:
>   Tools->Preferences->Output->General
>xdvi -nofork -sourceposition "$$n $$t" $$o -editor 
> "lyxeditor.sh %f %l"

"-nofork" part is needed because of the pipe?

> okular:
>   inverse search:
>   Tools->Preferences->File Handling->File formats
>okular --unique

I'm not using okular, --unique should be default for inverse search purposes?

>   direct search:
>   Tools->Preferences->Output->General
>okular --unique "$$o#src:$$n $$f"

Pavel


Re: Reverse search with xdvi

2013-09-05 Thread Fabio Stumbo

Anyway does changing the line
read < "${LYXPIPE}".out || exit
into
read TMP < "${LYXPIPE}".out || exit

work for you?
Pavel


Yes this works. Thanks.
But is there any difference with regards to simply comment it?


To answer your previous question:

yes, there is a reason for I want to use named pipe. The reason is that I 
often edit tex files via vim and so my Xresource for xdvi.editor is setted 
to vim: using pipe I thought I could be able to use reverse search 
regardless of the way xdvi is invoked and indeed that seems the case to 
me, by the tests I did.


Finally, I will collect all the necessary commands which work in my case 
for inverse/direct search, for reference just in case somebody else will 
need them since they are a little bit different from the ones listed in 
the documentation:


xdvi:
inverse search:
Tools->Preferences->File Handling->File formats
 xdvi -editor "lyxeditor.sh %f %l"
direct search:
Tools->Preferences->Output->General
 xdvi -nofork -sourceposition "$$n $$t" $$o -editor "lyxeditor.sh %f 
%l"

okular:
inverse search:
Tools->Preferences->File Handling->File formats
 okular --unique
direct search:
Tools->Preferences->Output->General
 okular --unique "$$o#src:$$n $$f"

The executable lyxeditor.sh should contain

#!/bin/sh
LYXPIPE="$HOME/.lyx/lyxpipe"
COMMAND="LYXCMD:revdvi:server-goto-file-row:$1 $2"
echo "$COMMAND" > "${LYXPIPE}".in || exit
read TMP < "${LYXPIPE}".out || exit



F.


Re: Reverse search with xdvi

2013-09-04 Thread Pavel Sanda
Fabio Stumbo wrote:

Anyway does changing the line
read < "${LYXPIPE}".out || exit
into 
read TMP < "${LYXPIPE}".out || exit

work for you?
Pavel


Re: Reverse search with xdvi

2013-09-04 Thread Pavel Sanda
Fabio Stumbo wrote:
> and I created, as suggested, a lyxeditor.sh 

Is there reason why you want to use named pipe?
xdvi should work via sockets out of the box (almost:)

Pavel