Skip to content

Commit

Permalink
Consider terminal emacs in EDITOR_CALLBACKS before graphical (#36346)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
non-Jedi authored and rfourquet committed Jul 26, 2020
1 parent 98df0d5 commit 4455454
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stdlib/InteractiveUtils/src/editless.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Note that many editors are already defined. All of the following commands should
already work:
- emacs
- emacsclient
- vim
- nvim
- nano
Expand Down Expand Up @@ -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
`$cmd +$line $path`
end
# Must check that emacs not running in -t/-nw before regex match for general emacs
define_editor([
"vim", "vi", "nvim", "mvim", "nano",
r"\bemacs\b.*\s(-nw|--no-window-system)\b",
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], wait=true) do cmd, path, line
`$cmd +$line $path`
end
define_editor([r"\bemacs", "gedit", r"\bgvim"]) do cmd, path, line
`$cmd +$line $path`
end
define_editor(["textmate", "mate", "kate"]) do cmd, path, line
`$cmd $path -l $line`
end
Expand Down

0 comments on commit 4455454

Please sign in to comment.