Comments on "Edit externally" feature

Richard Kimberly Heck rikiheck at lyx.org
Sun Dec 6 15:54:46 UTC 2020


On 12/6/20 9:21 AM, Scott Kostyshak wrote:
> On Sun, Dec 06, 2020 at 12:31:28AM -0500, Richard Kimberly Heck wrote:
>> On 12/5/20 11:27 PM, Scott Kostyshak wrote:
>>> On Sat, Dec 05, 2020 at 09:32:46PM -0500, Richard Kimberly Heck wrote:
>>>> On 12/2/20 12:11 PM, Scott Kostyshak wrote:
>>>>> On Wed, Dec 02, 2020 at 11:56:26AM -0500, Richard Kimberly Heck wrote:
>>>>>> On 12/2/20 11:13 AM, Scott Kostyshak wrote:
>>>>>>> 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.
>>>>>> Yes, I think this is the case I had in mind that requires manual unlocking.
>>>>>> For the other case, I had in mind some version where you open the file in
>>>>>> one editor, then somehow open it again in another one and close the
>>>>>> original. Then I wouldn't want to unlock. But maybe that's also a weird
>>>>>> case.
>>>>> Interesting, I didn't think of that situation. Maybe the user would
>>>>> indeed try to do that if the file didn't open in their preferred editor
>>>>> if they're not sure how to change the editor in preferences.
>>>> Of course, the file is a temporary in the LyX user directory, so maybe
>>>> that's unlikely.
>>>>
>>>> I've added a LOCK symbol when the inset is being edited.
>>>>
>>>> Are there other insets that should have this feature activated?
>>> Thanks, tested and works well for listing. A couple of issues:
>>>
>>> 1. Go to Help > Specific manuals > Knitr
>>>
>>> Look at the "Chunk" inset. Note that you can still edit it externally even though the document is opened as read only. I guess we should disable that LFUN?
>> Should be fixed.
> Looks good. Now, though, it is removed from the context menu. I expected it to be greyed out, but I forget what our policy is as far as when to remove and when to grey out.

I'm not sure there is a consistent policy here. If there is, I don't
know what it is. But we can change the OptItem to an Item easily enough.


>>> 2. I don't see the lock appear.
>> Should also be fixed.
> Strange, I still don't see the lock. Which commit fixed this?

I see it after 16834a32ad.

Riki




More information about the lyx-devel mailing list