Skip to content

Commit 6385107

Browse files
authored
Consider terminal emacs in EDITOR_CALLBACKS before graphical (#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 ""
1 parent a9dd7f3 commit 6385107

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stdlib/InteractiveUtils/src/editless.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Note that many editors are already defined. All of the following commands should
5858
already work:
5959
6060
- emacs
61+
- emacsclient
6162
- vim
6263
- nvim
6364
- nano
@@ -113,15 +114,16 @@ function define_default_editors()
113114
define_editor(r".*") do cmd, path, line
114115
`$cmd $path`
115116
end
117+
define_editor([r"\bemacs", "gedit", r"\bgvim"]) do cmd, path, line
118+
`$cmd +$line $path`
119+
end
120+
# Must check that emacs not running in -t/-nw before regex match for general emacs
116121
define_editor([
117122
"vim", "vi", "nvim", "mvim", "nano",
118123
r"\bemacs\b.*\s(-nw|--no-window-system)\b",
119124
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], wait=true) do cmd, path, line
120125
`$cmd +$line $path`
121126
end
122-
define_editor([r"\bemacs", "gedit", r"\bgvim"]) do cmd, path, line
123-
`$cmd +$line $path`
124-
end
125127
define_editor(["textmate", "mate", "kate"]) do cmd, path, line
126128
`$cmd $path -l $line`
127129
end

0 commit comments

Comments
 (0)