aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2019-01-10 08:17:52 +0100
committerEinhard Leichtfuß <alguien@respiranto.de>2019-01-10 08:17:52 +0100
commit9e34fc04c31fa00f97a889be2d41fb43d44deeb0 (patch)
tree5f4a59747a5f32b2d0dc397bc05c7915f8045537
parent0f8ac72b86937513bf10c3ce21ac445724e9a13a (diff)
downloadctct-9e34fc04c31fa00f97a889be2d41fb43d44deeb0.tar.gz
ctct-9e34fc04c31fa00f97a889be2d41fb43d44deeb0.tar.xz
Honor $VISUAL
It does now take precedence over $EDITOR when editing files. You probably do not want to edit contact entries with ed.
-rw-r--r--CHANGELOG1
-rw-r--r--TODO1
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac3
-rw-r--r--ctct.1.in9
-rw-r--r--ctct.in7
-rw-r--r--ctct_config.5.in9
7 files changed, 23 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a3437fc..83602c8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,7 @@ General:
`- This allows for example (sed -E 's/\s+/ /') as output_program.
- Fix --search-by-data (case $output_program != cat).
- Use `-mindepth 1' in addition to `-maxdepth 1' for find.
+- Honor $VISUAL.
Manual:
diff --git a/TODO b/TODO
index c533ed0..bd4f607 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
TODO file for ctct
[GENERAL]
-* Honor $VISUAL.
* Honor XDG user dirs.
* Use git tags for future versions.
* [consider] Remove character restriction except '.', '/'.
diff --git a/configure b/configure
index e02d7b6..563f4cc 100755
--- a/configure
+++ b/configure
@@ -1264,7 +1264,7 @@ Some influential environment variables:
default_datadir
'directory to store contact data in'
default_fallback_editor
- 'editor to use if EDITOR is unset'
+ 'editor to use if both $VISUAL AND $EDITOR are unset'
default_input_program
'the program that newly created or edited contact files get
passed to on stdin'
diff --git a/configure.ac b/configure.ac
index 1c99b13..4390787 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,8 @@ AC_SUBST([default_user_config_file], ['$HOME/.config/ctct_config'])
AC_ARG_VAR([default_datadir], ['directory to store contact data in'])
test -z "$default_datadir" && default_datadir='$HOME/.ctct'
-AC_ARG_VAR([default_fallback_editor], ['editor to use if EDITOR is unset'])
+AC_ARG_VAR([default_fallback_editor],
+ ['editor to use if both $VISUAL AND $EDITOR are unset'])
test -z "$default_fallback_editor" && default_fallback_editor=vi
AC_ARG_VAR([default_input_program],
diff --git a/ctct.1.in b/ctct.1.in
index 3ac3cb8..d8b51e7 100644
--- a/ctct.1.in
+++ b/ctct.1.in
@@ -194,9 +194,16 @@ An unexpected error occurred, for example due to missing permissions in
.\"
.SH ENVIROMENT
.TP
-.B EDITOR
+.B VISUAL
The editor to use when \fBctct\fP is called with the \fB\-\-edit\fP
option and \fBdefault_editor\fP is not set in \fBctct_config\fP(5)\.
+Supersedes $\fBEDITOR\fP, if set\.
+.\"
+.TP
+.B EDITOR
+The editor to use when \fBctct\fP is called with the \fB\-\-edit\fP
+option and neither \fBdefault_editor\fP is set in \fBctct_config\fP(5),
+nor the environment variable $\fBEDITOR\fP\.
.\"
.\"
.SH SEE ALSO
diff --git a/ctct.in b/ctct.in
index d03112f..af880e2 100644
--- a/ctct.in
+++ b/ctct.in
@@ -26,7 +26,7 @@ sysconfdir="@sysconfdir_expanded@"
user_config_file="@default_user_config_file@"
datadir="@default_datadir@"
fallback_editor=("@default_fallback_editor@")
-default_editor=() # none - use $EDITOR
+default_editor=() # none - use $VISUAL / $EDITOR
input_program=("@default_input_program@")
output_program=("@default_output_program@")
visual_program=("@default_visual_program@")
@@ -316,7 +316,10 @@ function edit_contact()
if test -n "${default_editor[*]}"
then
editor=( "${default_editor[@]}" )
- elif test -n "$EDITOR" && which "${EDITOR% *}" >/dev/null 2>&1
+ elif test -n "$VISUAL"
+ then
+ editor=( $VISUAL )
+ elif test -n "$EDITOR"
then
editor=( $EDITOR )
else
diff --git a/ctct_config.5.in b/ctct_config.5.in
index 198683f..e1cb570 100644
--- a/ctct_config.5.in
+++ b/ctct_config.5.in
@@ -73,16 +73,19 @@ is called with the
.B \-\-edit
option\.
If set, supersedes both the
+environment variables
+.RB $ VISUAL ,
.RB $ EDITOR
-environment variable
and the
.BR fallback_editor \.
By default, unset\.
.\"
.TP
.BR fallback_editor "=(\fIprogram\fP [\|\fIarg\fP \.\.\.\|])"
-The editor to fall back to if neither the environment variable
-.RB $ EDITOR
+The editor to fall back to if neither any of the environment variables
+.RB $ VISUAL
+and
+.RB $ EDITOR ,
nor
.B default_editor
is set\.