From c92fff80a79bccfb4933e219b763d373a0a475f2 Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Tue, 4 Oct 2022 11:53:04 -0400 Subject: [PATCH 1/2] InteractiveUtils [cosmetic]: tidy editor definitions - fix some nasty long lines and indentiation - remove unnecessary `Any` typed vectors --- stdlib/InteractiveUtils/src/editless.jl | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/stdlib/InteractiveUtils/src/editless.jl b/stdlib/InteractiveUtils/src/editless.jl index feb13be12bb86..bdc699a60b5dd 100644 --- a/stdlib/InteractiveUtils/src/editless.jl +++ b/stdlib/InteractiveUtils/src/editless.jl @@ -124,8 +124,10 @@ function define_default_editors() `$cmd $path` end # vim family - for (editors, wait) in [[Any["vim", "vi", "nvim", "mvim"], true], - [Any["\bgvim"], false]] + for (editors, wait) in [ + [["vim", "vi", "nvim", "mvim"], true], + [["\bgvim"], false], + ] define_editor(editors; wait) do cmd, path, line, column cmd = line == 0 ? `$cmd $path` : column == 0 ? `$cmd +$line $path` : @@ -135,27 +137,31 @@ function define_default_editors() define_editor("nano"; wait=true) do cmd, path, line, column cmd = `$cmd +$line,$column $path` end - # emacs (must check that emacs not running in -t/-nw before regex match for general emacs) - for (editors, wait) in [[Any[r"\bemacs"], false], - [Any[r"\bemacs\b.*\s(-nw|--no-window-system)\b", r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], true]] + # emacs (must check that emacs not running in -t/-nw + # before regex match for general emacs) + for (editors, wait) in [ + [[r"\bemacs"], false], + [[r"\bemacs\b.*\s(-nw|--no-window-system)\b", + r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], true], + ] define_editor(editors; wait) do cmd, path, line, column `$cmd +$line:$column $path` end end - # Other editors + # other editors define_editor("gedit") do cmd, path, line, column `$cmd +$line:$column $path` end - define_editor(Any["micro", "kak"]; wait=true) do cmd, path, line, column + define_editor(["micro", "kak"]; wait=true) do cmd, path, line, column `$cmd +$line $path` end - define_editor(Any["hx", "helix"]; wait=true) do cmd, path, line, column + define_editor(["hx", "helix"]; wait=true) do cmd, path, line, column `$cmd $path:$line:$column` end define_editor(["textmate", "mate", "kate"]) do cmd, path, line, column `$cmd $path -l $line` end - define_editor(Any[r"\bsubl", r"\batom", "pycharm", "bbedit"]) do cmd, path, line, column + define_editor([r"\bsubl", r"\batom", "pycharm", "bbedit"]) do cmd, path, line, column `$cmd $path:$line` end define_editor(["code", "code-insiders"]) do cmd, path, line, column From e0fa72422b99922732dc66faa9409a5631e095cc Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Tue, 4 Oct 2022 12:49:46 -0400 Subject: [PATCH 2/2] Update stdlib/InteractiveUtils/src/editless.jl --- stdlib/InteractiveUtils/src/editless.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/InteractiveUtils/src/editless.jl b/stdlib/InteractiveUtils/src/editless.jl index bdc699a60b5dd..539e9b12f4071 100644 --- a/stdlib/InteractiveUtils/src/editless.jl +++ b/stdlib/InteractiveUtils/src/editless.jl @@ -126,7 +126,7 @@ function define_default_editors() # vim family for (editors, wait) in [ [["vim", "vi", "nvim", "mvim"], true], - [["\bgvim"], false], + [[r"\bgvim"], false], ] define_editor(editors; wait) do cmd, path, line, column cmd = line == 0 ? `$cmd $path` :