jlebon / textern

A Firefox add-on for editing text in your favourite external editor!
GNU General Public License v3.0
138 stars 21 forks source link

recently stopped working with Emacs #68

Open archenemies opened 4 years ago

archenemies commented 4 years ago

I noticed that recently on various websites (including GitHub), Textern no longer works. I can open an editor, and any existing text in the text area shows up in the editor. However, changes made in the external editor are lost - they don't show up in the text area (and they don't seem to be preserved in any backup file).

jlebon commented 4 years ago

Did you change your editor configuration? Can you try the troubleshooting steps?

archenemies commented 4 years ago

OK thanks, you motivated me to do some troubleshooting. Below are my notes, but the summary is that the problem seems to have been caused by a recent Emacs upgrade (from 26.3 to 27.1). Unfortunately it is also dependent on my Emacs configuration, because when I start 27.1 with "-q", which skips reading my configuration, then Textern still works.

I wasn't sure about $0 so I also checked that this works:

  ["sh", "-c", "echo foobar > %s"]

I use a custom script that invokes Emacs via "emacsclient -nw" in an X terminal window. It doesn't exit until I close the editor. I get the same behavior with either of these configured as the Textern editor:

["my-x-editor", "+%l:%c"]
["my-x-editor", "+%l:%c", "%s"]
["my-x-editor", "%s"]

In "about:debugging > Textern" I find "Uncaught (in promise) Error: Missing host permission for the tab, and any iframes".

After saving, I find that the file /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt contains the desired text. But it doesn't show up in the textarea.