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

Consider terminal emacs in EDITOR_CALLBACKS before graphical #36346

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

@rfourquet rfourquet Jun 18, 2020

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

`$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