-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Consider terminal emacs in EDITOR_CALLBACKS before graphical #36346
Conversation
Since the regex r"\bemacs" matches the cmd `emacs -nw`, the regex r"\bemacs\b.*\s(-nw|--no-window-system)\b" should be considered in the EDITOR_CALLBACKS list before it. Without this change, when JULIA_EDITOR="emacs -nw", julia tries to open the editor with run(...; wait=false) which causes the error: emacs: standard input is not a tty or for emacsclient: emacsclient: could not get terminal name emacsclient: error executing alternate editor ""
@@ -113,15 +114,16 @@ function define_default_editors() | |||
define_editor(r".*") do cmd, path, line | |||
`$cmd $path` | |||
end | |||
define_editor([r"\bemacs", "gedit", r"\bgvim"]) do cmd, path, line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, changing r"\bemacs"
to r"\bemacs\b"
would also work as a fix, right?
EDIT: yeah, my experiments seem to indicate that this also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That still matches emacs -nw
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we changed this to r"\bemacs\b"
, then graphical emacsclient would no longer be matched, so it would end up being caught by the fallback r".*"
regex which doesn't jump to line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, thank you both.
For people seeing this issue and wanting a fix for Julia 1.4 and 1.5, you can put the following in startup.jl:
(this is copy-pasted and could be simplified but I didn't bother). |
…ng#36346) Since the regex r"\bemacs" matches the cmd `emacs -nw`, the regex r"\bemacs\b.*\s(-nw|--no-window-system)\b" should be considered in the EDITOR_CALLBACKS list before it. Without this change, when JULIA_EDITOR="emacs -nw", julia tries to open the editor with run(...; wait=false) which causes the error: emacs: standard input is not a tty or for emacsclient: emacsclient: could not get terminal name emacsclient: error executing alternate editor ""
Since the regex r"\bemacs" matches the cmd `emacs -nw`, the regex r"\bemacs\b.*\s(-nw|--no-window-system)\b" should be considered in the EDITOR_CALLBACKS list before it. Without this change, when JULIA_EDITOR="emacs -nw", julia tries to open the editor with run(...; wait=false) which causes the error: emacs: standard input is not a tty or for emacsclient: emacsclient: could not get terminal name emacsclient: error executing alternate editor "" (cherry picked from commit 6385107)
…ng#36346) Since the regex r"\bemacs" matches the cmd `emacs -nw`, the regex r"\bemacs\b.*\s(-nw|--no-window-system)\b" should be considered in the EDITOR_CALLBACKS list before it. Without this change, when JULIA_EDITOR="emacs -nw", julia tries to open the editor with run(...; wait=false) which causes the error: emacs: standard input is not a tty or for emacsclient: emacsclient: could not get terminal name emacsclient: error executing alternate editor ""
Since the regex
r"\bemacs"
matches the cmdemacs -nw
, the regexr"\bemacs\b.*\s(-nw|--no-window-system)\b"
should be considered in theEDITOR_CALLBACKS
list before it.Without this change, when
JULIA_EDITOR="emacs -nw"
, julia tries toopen the editor with
run(...; wait=false)
which causes the error:or for emacsclient:
cc @rfourquet