New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] edit notes in external editor #611

Closed
tessus opened this Issue Jun 13, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@tessus
Collaborator

tessus commented Jun 13, 2018

Operating system

  • Windows
  • macOS
  • Linux

Application

  • Desktop

Summary

The native Joplin editor misses some crucial editing capabilities like block editing, sorting of lines, selecting (and editing) all occurrences of a word throughout a note, … I’m aware that such features might be hard to implement, but giving users the option to edit a note in an external editor would go a long way to alleviate the lack of functionality.

/ref https://discourse.joplin.cozic.net/t/edit-notes-in-external-editor/180

@rcrx

This comment has been minimized.

rcrx commented Jun 14, 2018

This is already enabled in the CLI app (on Linux, at least). One workaround would be to close the GUI and run joplin --profile ~/.config/joplin-desktop, modify the note with your text editor and :exit, then reopen the desktop client.

I know it's not ideal, but it's also not that much of a hassel. What I would really like to see is better integration between the CLI and GUI.

@tessus

This comment has been minimized.

Collaborator

tessus commented Jun 14, 2018

This is already enabled in the CLI app

Yep (I know), that's why I opened this feature requests for the desktop apps:

Application

  • Desktop

The template is there for a reason. ;-)

One workaround...

Well, a bit awkward, isn't it? I'm not willing to close Joplin.

Currently I copy and paste the entire note into Sublime Text, do all the fancy editing, and copy and paste it back to Joplin. Luckily, fancy editing is not always necessary.

@laurent22

This comment has been minimized.

Owner

laurent22 commented Jun 14, 2018

One issue when opening a file in an external editor is the calling app cannot know when the user has finished editing. For example if I open a file in Sublime Text, then close the tab, I'm done editing, however Joplin has no way to know that. So that's the main difficulty and I'm not sure how this is handled in other apps - do you have any example by any chance?

@tessus

This comment has been minimized.

Collaborator

tessus commented Jun 14, 2018

I believe other apps do something like this:

  • create a temp file
  • watch this file (inotify)
  • open temp file in external app
  • watch PID of external app
  • if PID no longer exists or inotify triggers, callback to Jopiln
@laurent22

This comment has been minimized.

Owner

laurent22 commented Jun 14, 2018

if PID no longer exists or inotify triggers, callback to Jopiln

Yes that's the problem, most GUI apps remain open after closing a file (a tab) so the PID still exists. Watching the file for deletion also wouldn't work since the temp file still exists after closing the tab.

@tessus

This comment has been minimized.

Collaborator

tessus commented Jun 14, 2018

Yes that's the problem, most GUI apps remain open after closing a file (a tab) so the PID still exists.

True, I totally ignored that fact.

Watching the file for deletion also wouldn't work since the temp file still exists after closing the tab.

Right, but it should be possible to find out if no longer a lock exists on that file. Or if that PID is still accessing that file.

@laurent22

This comment has been minimized.

Owner

laurent22 commented Jun 14, 2018

Right, but it should be possible to find out if no longer a lock exists on that file. Or if that PID is still accessing that file.

Yes, maybe something to look at, but not sure if text editors lock files in general. For example a file can still be deleted while Sublime Text is editing it.

As a first attempt, I'll simply maintain a list of watched files (a new one added every time a note is opened in text editor) and not worry whether they've been closed or not. I think it should work, although it means there will be a bunch of temp files that will stay behind and that will need to be deleted when the app starts.

@tessus

This comment has been minimized.

Collaborator

tessus commented Jun 22, 2018

@laurent22 it works great, unfortunately it opens Xcode on my machine.
I would have assumed that one could enter a command to invoke when clicking on the Edit in external editor button.
The problem is that even if I associated Sublime Text with .md files, the external file would be opened in an existing (most likely the last used) Sublime Text window. This is highly inconvenient, especially if the Sublime Text windows are on the different desktop spaces.
That's why I hoped I could enter subl -n in settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment