jwilk-archive / djvusmooth

graphical editor for DjVu
GNU General Public License v2.0
12 stars 2 forks source link

Customizable external content list editor #18

Closed trufanov-nok closed 6 years ago

trufanov-nok commented 6 years ago

Would be great as vim is awful. Also I didn't find any notes on expected content list format and was forced to look into existing djvu file to get some example.

jwilk commented 6 years ago

There are already two ways to select editor for djvusmooth:

1) By default, djvusmooth uses the mailcap system. You can add your preferred editor to the ~/.mailcap file. For example, if you want nano, add this:

text/plain; edit=nano %s; needsterminal

2) Select "SettingsExternal editor…" from menu. (Note that this doesn't spawn a terminal automatically.)

P.S. vim is awesome. :-P

jwilk commented 6 years ago

I didn't find any notes on expected content list format

I've filed #19 about this.

trufanov-nok commented 6 years ago

Select "Settings → External editor…" from menu.

Ha, indeed. Looks like i need to work less at night time.

trufanov-nok commented 6 years ago

I've just tried to set nano or /bin/nano as external editor and it wasn't invoked. Although works from terminal. No errors reported. And with empty setting vim launches properly.

trufanov-nok commented 6 years ago

kate launches but complains that the file was already deleted with external program when I try to save it.

mailcap approach works

jwilk commented 5 years ago

I've just tried to set nano or /bin/nano as external editor and it wasn't invoked.

As I hinted earlier, in Settings → External editor…, if the editor requires a terminal, you need to take care about launching terminal emulator yourself. So using something like xterm -e nano should do the trick. (I admit this is not user friendly. I should probably add a checkbox to this dialog for automatic launching terminal emulator, or something…)

kate launches but complains that the file was already deleted with external program when I try to save it.

Some editors fork into background, making djvusmooth think that they finished editing the file immediately. (For example gvim, GUI version of Vim, does that unless you use the -f option.) That would explain the symptoms you're seeing, but… For me Kate (18.04.0) works without any issues. What is your version of Kate?

trufanov-nok commented 5 years ago

Yep, xterm -e nano does the trick. I'm not sure regarding checkbox as xterm wasn't in my system by default - i need to apt get it first. Probably a hint might be enough. As for kate it's latest 17.12.3 for Kubuntu 18.04.

I would point to one more problem. In case the command specified in external editor setting is wrong or application is missing it'll cause "[Error 2] No such file or directory" error. And when user clicks Ok in error message the Ui keeps to be blocked so you have to kill the process and restart the app to continue.

jwilk commented 5 years ago

Yep, xterm -e nano does the trick. I'm not sure regarding checkbox as xterm wasn't in my system by default - i need to apt get it first.

On Debian-based systems, we could use x-terminal-emulator (in Kubuntu it should run Konsole by default). I've opened #21 for this.

As for kate it's latest 17.12.3 for Kubuntu 18.04.

I reproduced this on Kubuntu. It seems to happen only if Kate is already running before you try to edit something in djvusmooth. Passing the -n option to kate should fix this.