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

edit-with-external-editor does not work with trailing space in $VISUAL #3589

Closed
brosasaki opened this issue Feb 1, 2025 · 4 comments
Closed
Assignees

Comments

@brosasaki
Copy link

Describe the bug
edit-with-external-editor does not work when $VISUAL (therefore external-editor-program) is set to emacsclient: it creates a new buffer, but saving that buffer or typing 'C-x C-#' does not enter the text you typed.

Also, there are various errors if $VISUAL has arguments, e.g. for 'emacsclient --timeout=3 --create-frame --', the command fails with the following message:

<WARN> [06:32:06] Warning: Failed editing: Subprocess #&lt;UIOP/LAUNCH-PROGRAM:PROCESS-INFO {100A7E4013}&gt;
 with command (&quot;emacsclient&quot; &quot;--timeout=3&quot; &quot;--create-frame&quot; &quot;--&quot; &quot;&quot;
               &quot;/home/wong/.local/share/nyxt/tmpT1XM84SD.tmp&quot;)
 exited with error code 1. See `external-editor-program' slot.

'emacsclient --create-frame --':

<WARN> [06:35:03] Warning: Failed editing: Couldn't execute &quot;~/.guix-home/profile/bin/emacsclient&quot;: No such file or directory. See `external-editor-program' slot.

I also noticed that with $VISUAL set to 'emacs', the text is not entered until emacs exits. My guess is that nyxt wrongly assumes that editing is complete when the process exits, and since emacsclient doesn't really "exit", the text is never entered.

Precise recipe to reproduce the issue
emacs --bg-daemon; VISUAL=emacsclient nyxt, then execute edit-with-external-editor when in an input field. Type in the opened buffer, then type C-x C-# to finish editing. Notice how the text is not input.

For website-specific issues:
Can you reproduce this issue with Epiphany / GNOME Web (https://wiki.gnome.org/Apps/Web)?

Information

  • OS name+version: GNU Guix d48da2d (channel aadcg cb6faa5)
  • Graphics card and driver: AMD Radeon RX 7900XTX, radv Mesa 24.3.2
  • Desktop environment / Window manager name+version: Hyprland 0.47.0
  • Installation method (Flatpak, Guix, package manager, build from source): Guix, package aadcg-nyxt
  • Output of nyxt --system-information:
Nyxt version: 3.12.0
Renderer: GI-GTK
Operating system kernel: Linux 6.12.11
Lisp implementation: SBCL 2.4.10 (Dynamic space size: 3221225472)
Features: (:NYXT-GI-GTK :NYXT-GTK :NYXT-GI-GTK :NYXT-GTK :NYXT-3.12 :NYXT-3 :NYXT-3.12.0
 :CLIPBOARD-CONTENT-METHOD :SWANK :SLYNK :PLUMP-UTF-32 :PARENSCRIPT :NSYMBOLS
 :FSET-EXT-STRINGS :SBCL+SAFE-STANDARD-READTABLE :NAMED-READTABLES :GLOBAL-VARS
 :CL-FAD :LPARALLEL :21BIT-CHARS :CUSTOM-HASH-TABLE-NATIVE :CL-PPCRE-UNICODE
 :CL-UNICODE :CL-JSON-DOUBLE-FLOAT-IS-SUBSUMED
 :CL-JSON-SINGLE-FLOAT-IS-SUBSUMED :CHUNGA :FLEXI-STREAMS :CL-PPCRE :WEBKIT2
 :WEBKIT-2.44.1 :WEBKIT-2.44 :WEBKIT-2 :WEBKIT2-CORS-ALLOWLIST
 :WEBKIT2-PASTE-PLAINTEXT :WEBKIT2-TRACKING :WEBKIT2-MUTE :WEBKIT2-EMOJI
 :WEBKIT2-MEDIA :WEBKIT2-SANDBOXING :GTK-3-22 :GTK-3-20 :GTK-3-18 :GTK-3-16
 :GTK-3-14 :GTK-3-12 :GTK-3-10 :GTK-3-8 :GTK-3-6 :GTK-3-4 :GTK :GDK-3-22
 :GDK-3-20 :GDK-3-18 :GDK-3-16 :GDK-3-14 :GDK-3-12 :GDK-3-10 :GDK-3-8 :GDK-3-6
 :GDK-3-4 :CAIRO-1-10 :CAIRO-1-12 :GDK-PIXBUF :CLOSER-MOP :GLIB-2-30 :GLIB-2-32
 :GLIB-2-34 :GLIB-2-36 :GLIB-2-38 :GLIB-2-40 :GLIB-2-42 :GLIB-2-44 :GLIB-2-46
 :GLIB-2-48 :GLIB-2-50 :GLIB-2-52 :GLIB-2-54 :GLIB-2-56 :GLIB-2-58 :GLIB
 :BORDEAUX-THREADS :LPARALLEL.WITH-CLTL2 :LPARALLEL.WITH-CAS
 :LPARALLEL.WITH-STEALING-SCHEDULER :SPLIT-SEQUENCE
 CFFI-FEATURES:FLAT-NAMESPACE CFFI-FEATURES:X86-64 CFFI-FEATURES:UNIX :CFFI
 CFFI-SYS::FLAT-NAMESPACE ALEXANDRIA::SEQUENCE-EMPTYP :FAST-IO-SV :FAST-IO
 :CL-JSON-CLOS :CL-JSON :SBCL-USES-SB-ROTATE-BYTE CHIPZ-SYSTEM:GRAY-STREAMS
 :THREAD-SUPPORT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT
 :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN
 :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
 :SB-THREAD :SB-UNICODE :SBCL :UNIX)

ASDF version: 3.3.7
ASDF registries: (NYXT-SOURCE-REGISTRY ENVIRONMENT-SOURCE-REGISTRY)
Critical dependencies: (/tmp/guix-build-aadcg-nyxt-3.12.0.drv-0/source/_build/cl-cffi-gtk/gtk/cl-cffi-gtk.asd
 /tmp/guix-build-aadcg-nyxt-3.12.0.drv-0/source/_build/cl-gobject-introspection/cl-gobject-introspection.asd
 /tmp/guix-build-aadcg-nyxt-3.12.0.drv-0/source/_build/cl-webkit/webkit2/cl-webkit2.asd)

Guix version:

Output when started from a shell

guix 🮲🮳 nyxt -I
Nyxt version 3.12.0
<INFO> [05:53:09] Source location: #P"/gnu/store/hd7mgl09glflizslbvjn5qffgdjbi349-aadcg-nyxt-3.12.0/share/nyxt/"
<INFO> [05:53:09] Nyxt already started.
guix 🮲🮳 nyxt
Nyxt version 3.12.0
<INFO> [05:53:25] Source location: #P"/gnu/store/hd7mgl09glflizslbvjn5qffgdjbi349-aadcg-nyxt-3.12.0/share/nyxt/"
<INFO> [05:53:25] Loading Lisp file #P"/home/wong/.config/nyxt/auto-config.3.lisp".
<INFO> [05:53:25] Loading Lisp file #P"/home/wong/.config/nyxt/config.lisp".
<INFO> [05:53:25] Listening to socket: #P"/run/user/1000/nyxt/nyxt.socket"

(process:2): Gtk-WARNING **: 10:53:26.125: Locale not supported by C library.
        Using the fallback 'C' locale.

(WebKitWebProcess:2): Gdk-WARNING **: 10:53:26.129: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface ?org.freedesktop.portal.Settings? on object at path /org/freedesktop/portal/desktop
<INFO> [05:53:26] Loading #P"/home/wong/.local/share/nyxt/history/default.lisp".

(process:2): Gtk-WARNING **: 10:53:26.645: Locale not supported by C library.
        Using the fallback 'C' locale.

(WebKitWebProcess:2): Gdk-WARNING **: 10:53:26.648: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface ?org.freedesktop.portal.Settings? on object at path /org/freedesktop/portal/desktop
<INFO> [05:53:26] Loading #P"/home/wong/.local/share/nyxt/auto-rules.lisp".
<INFO> [05:53:26] Loading #P"/home/wong/.local/share/nyxt/hostlist-stevenblack.txt".
<INFO> [05:53:26] Restoring 6 buffers from history.

(process:2): Gtk-WARNING **: 10:53:27.435: Locale not supported by C library.
        Using the fallback 'C' locale.

(WebKitWebProcess:2): Gdk-WARNING **: 10:53:27.437: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface ?org.freedesktop.portal.Settings? on object at path /org/freedesktop/portal/desktop
<INFO> [05:53:27] Loading "https://github.com/Novum/vkQuake/issues/769".

(process:2): Gtk-WARNING **: 10:53:27.595: Locale not supported by C library.
        Using the fallback 'C' locale.

(WebKitWebProcess:2): Gdk-WARNING **: 10:53:27.598: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface ?org.freedesktop.portal.Settings? on object at path /org/freedesktop/portal/desktop
<INFO> [05:53:28] Deleting socket #P"/run/user/1000/nyxt/nyxt.socket".
@aadcg
Copy link
Member

aadcg commented Feb 1, 2025

Can you share the output of echo $VISUAL and which emacsclient?

@brosasaki
Copy link
Author

~ 🮲🮳 echo $VISUAL
emacsclient --timeout=3 --create-frame --
~ 🮲🮳 which emacsclient
/home/wong/.guix-home/profile/bin/emacsclient

@aadcg
Copy link
Member

aadcg commented Feb 3, 2025

I can't reproduce any of these reports. I set external-editor-program to emacsclient -r.

$ echo $VISUAL
emacsclient -r

Note that you need to hit C-x # from Emacs, not C-x C-#. Saving the buffer doesn't work since you need to signal that you're done editing.

@brosasaki
Copy link
Author

I've figured it out!
Try between these two commands:

  1. EDITOR='emacsclient --timeout=3 --tty -- ' nyxt
  2. EDITOR='emacsclient --timeout=3 --tty --' nyxt
    Command 1 gives a nyxt session that cannot launch an external editor:
WARN - Warning: Failed editing: Subprocess #&lt;UIOP/LAUNCH-PROGRAM:PROCESS-INFO {100AEC4133}&gt;
 with command (&quot;emacsclient&quot; &quot;--timeout=3&quot; &quot;--create-frame&quot; &quot;--&quot; &quot;&quot;
               &quot;/home/wong/.local/share/nyxt/tmpT1XM84SD.tmp&quot;)
 exited with error code 1. See `external-editor-program' slot.

...while command 2 does not have such an issue. Though it's a mistake on my part to configure EDITOR that way, should trailing space be significant for such a thing?

@brosasaki brosasaki changed the title edit-with-external-editor does not work with emacsclient edit-with-external-editor does not work with trailing space in $VISUAL Feb 3, 2025
@aadcg aadcg closed this as completed in ad07b4d Feb 4, 2025
@aadcg aadcg self-assigned this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants