Closed Nekroze closed 1 year ago
I just brushed up on what VISUAL
is actually for. I had assumed it was for modern GUI vs terminal editors, but it looks like it's older than that, at least according to this StackOverflow answer:
The
EDITOR
editor should be able to work without use of "advanced" terminal functionality (like olded
orex
mode ofvi
). It was used on teletype terminals.
The main takeaway I got from it is that in order to properly support VISUAL
, we need to try it first, and then fall back to EDITOR
if it fails, not just prefer VISUAL
.
to try it first, and then fall back to
EDITOR
if it fails
Yeah, even better! I'll get that updated.
tested with various versions of running make tag with VISUAL and EDITOR set or not set to valid editors or false
to fail for testing and behaved as expected, VISUAL is tried first if defined and EDITOR used only if VISUAL fails, if VISUAL is not defined only editor is ever tried.
This does not affect the abort on no change behaviour which uses a diff and not the editor calls themselves.
Protip for future PRs - since you're a member of the org, if you create a branch on the main repo instead of a fork, anyone can try it out more easily by running rm -rf .makefiles && MF_BRANCH=<branch> make makefiles
.
Feel free to hit the merge button whenever you're happy.
Protip for future PRs - since you're a member of the org, if you create a branch on the main repo instead of a fork, anyone can try it out more easily by running
rm -rf .makefiles && MF_BRANCH=<branch> make makefiles
.
Very pro, cheers didn't know about MF_BRANCH!
$VISUAL is the canonical store for an editor with with a graphical interface and while often set to the same value as EDITOR it may differ and most well behaving software will look for $VISUAL before looking for $EDITOR.