Comments on "Edit externally" feature

Scott Kostyshak skostysh at lyx.org
Wed Dec 2 16:13:56 UTC 2020


On Wed, Dec 02, 2020 at 10:56:16AM -0500, Richard Kimberly Heck wrote:
> On 12/2/20 10:46 AM, Scott Kostyshak wrote:
> > I just remembered this feature exists and it is fun to test it. I have a
> > few questions/comments:
> > 
> > 1. After I exit my text editor, should LyX detect that the process
> >     exited and automatically reload and unlock the inset in LyX?
> >     Currently I need to manually go to "End Editing Externally".
> 
> I don't know any way to do this automatically. Probably there is one, but
> inter-process stuff is not something I really understand.

Fair enough. I guess ideally it would behave as follows:

1. On any file change (e.g., save from the external editor), LyX would
   update the contents (but does not unlock the chunk).
2. When the process exits, LyX updates the contents and unlocks the
   chunk.

For (1) I suppose we would need to use our FileMonitor class. For (2) it
seems it should be easy to check when a process exits. That said, if I
claim this is easy I should be willing to look into it and I'm not
volunteering :)

There is still a corner case to deal with: the user might close the file
in the editor, but not exit the editor. (2) above would not pick this
up. I guess to handle this case we would need to use whatever Qt
abstraction tells us if a file is opened by a process.

> > 2. It might be nice to show visually that the inset is "locked". Perhaps
> >     we could grey it out somehow, and/or put a "lock" symbol on the inset
> >     label.
> 
> Yes, that's an excellent idea!
> 
> 
> > 3. There are problems when the inset has arguments. For example, open
> >     the file 'lib/examples/Modules/Rnw_%28knitr%29.lyx'. Edit something
> >     in the chunk inset, save, and click on "End Editing Externally".
> >     Notice that the "show-off" is now outside of the argument (it was
> >     originally in the argument "options"). Should we omit arguments when
> >     giving the inset contents to the text editor?
> 
> I'll have a look at this case.
> 
> 
> > 4. I expected "Edit externally" to show up in the context menu when
> >     clicking on the inset label (which currently has "close inset" and
> >     "dissolve inset"). Would it make sense to additionally add it there?
> 
> Certainly.
> 
> > Regardless of the above comments, I was able to use the feature and find
> > it useful. Thanks for the work on it! (I think it was Riki?).
> 
> The original work was done by Georg. I just adapted it.

In that case, thanks to both you and Georg!

And thanks for the quick reply.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201202/d99a6118/attachment.asc>


More information about the lyx-devel mailing list