Re: Reverse search with xdvi
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
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
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
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
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
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
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
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
Reverse search with xdvi
Hi all, I configured reverse search as explained in section 5.6.3 of the "Additional features manual". In particular, I setted Preferences->File Handling->File formats to xdvi -editor "lyxeditor.sh %f %l" and I created, as suggested, a lyxeditor.sh executable file in my $HOME/bin which contains #!/bin/sh LYXPIPE="$HOME/.lyx/lyxpipe" COMMAND="LYXCMD:revdvi:server-goto-file-row:$1 $2" echo "$COMMAND" > "${LYXPIPE}".in || exit read < "${LYXPIPE}".out || exit Now, when I produce a dvi if I ctrl+click then every time I get in xdvi the following error message Command "lyxeditor.sh /tmp/lyx_tmpdir.MT4824/lyx_tmpbuf2/test.tex 1534" exited with error code 2 $HOME/bin/lyxeditor.sh: 5: read: arg count Nevertheless, I in the lyx source file I am correctly positioned in the intended line. So, all in all it works, but getting allways the error message is a bit annoying... Is there a fix to this? What is wrong in "lyxeditor.sh"? Please note that if I comment out the last line, I don't get the error any longer and it still works: so is the last line necessary? Thanks a lot F.