Skip to content
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

recently stopped working with Emacs #68

Open
archenemies opened this issue Sep 13, 2020 · 2 comments
Open

recently stopped working with Emacs #68

archenemies opened this issue Sep 13, 2020 · 2 comments

Comments

@archenemies
Copy link

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
Copy link
Owner

jlebon commented Sep 14, 2020

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

@archenemies
Copy link
Author

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.

  • Not dependent on Firefox version

  • Not dependent on GitHub, even a barebones HTML with textarea exhibits problem

  • I tried downgrading Systemd as well, no luck

  • I change my editor configuration all the time, but not in a way that should have mattered. An old configuration still exhibits the bug

  • This works (from the troubleshooting guide):

    ["sh", "-c", "echo foobar > $0"]
    

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".

  • I used git to pull the latest version of Textern, reinstall as both user and root, same problem.

  • While I am editing a textarea, I find textern is running:

    $ ps aux | grep textern
    me   14466  1.0  0.2  99532 16968 ?        SNl  11:26   0:00 python3 /home/me/.local/libexec/textern/textern.py /home/me/.mozilla/native-messaging-hosts/textern.json textern@jlebon.com
    me   14467  0.0  0.0  10640  3952 ?        SN   11:26   0:00 /bin/zsh /home/me/scripts-misc/my-x-editor +1:1 /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt
    me   14469  0.0  0.0   9556  3692 ?        SN   11:26   0:00 /bin/sh /home/me/scripts-misc/urxvtc-wait em +1:1 /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt
    me   14471  0.0  0.0   9556  3084 pts/22   SNs+ 11:26   0:00 sh -c "$@"; kill -USR1 14469 x em +1:1 /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt
    me   14473  0.0  0.0   9556  3100 pts/22   SN+  11:26   0:00 /bin/sh /home/me/scripts-misc/em +1:1 /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt
    me   14474  0.0  0.0   2360   712 pts/22   SN+  11:26   0:00 emacsclient -c -nw +1:1 /run/user/1000/textern/textern-8k75mahh/localhost%2F~me%2Fm.html-ui74e8v5.txt
    me   14510  0.0  0.0   8688  2388 pts/23   SN+  11:26   0:00 grep textern
    

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.

  • Browser console (Ctrl+Shift+J) shows the following errors:

    sendRemoveListener on closed conduit textern@jlebon.com.549755813890 ConduitsChild.jsm:108
        _send resource://gre/modules/ConduitsChild.jsm:108
        _send self-hosted:1275
        removeListener resource://gre/modules/ExtensionChild.jsm:663
        removeListener resource://gre/modules/ExtensionChild.jsm:886
        onChanged chrome://extensions/content/child/ext-storage.js:337
        removeListener resource://gre/modules/ExtensionCommon.jsm:2517
        revoke resource://gre/modules/ExtensionCommon.jsm:2539
        close resource://gre/modules/ExtensionCommon.jsm:2544
        unload resource://gre/modules/ExtensionCommon.jsm:909
        close resource://gre/modules/ExtensionContent.jsm:927
        destroyed resource://gre/modules/ExtensionContent.jsm:1005
        observe resource://gre/modules/ExtensionContent.jsm:1023
    
  • Changing the configured editor: Gedit works, "Emacs -q" works:

    ["my-x-editor", "%s"] -> doesn't work
    ["gedit"] -> works
    ["urxvtc-wait","emacs","-nw","-q"] -> works (`-q` keeps it from reading startup file)
    ["urxvtc-wait","emacs","-nw"] -> doesn't work, even when reverting to old `~/.emacs` and old `~/.emacs.d`
    
  • Original configuration works after downgrading Emacs:

    # works:
    sudo pacman -U /var/cache/pacman/pkg/emacs-26.3-2-x86_64.pkg.tar.zst
    # doesn't work:
    sudo pacman -U /var/cache/pacman/pkg/emacs-27.1-2-x86_64.pkg.tar.zst
    

@archenemies archenemies changed the title recently stopped working recently stopped working with Emacs Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants