blob: 2287edd46ad3141094cc4a1e5ec3e35143d37c96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# DP: Use `command -v editor`, as an editor, if available.
Index: b/bashline.c
===================================================================
--- a/bashline.c
+++ b/bashline.c
@@ -927,8 +927,8 @@ operate_and_get_next (count, c)
command being entered (if no explicit argument is given), otherwise on
a command from the history file. */
-#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-vi}}\""
-#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-emacs}}\""
+#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-$(command -v editor || echo vi)}}\""
+#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-$(command -v editor || echo emacs)}}\""
#define POSIX_VI_EDIT_COMMAND "fc -e vi"
static int
Index: b/builtins/fc.def
===================================================================
--- a/builtins/fc.def
+++ b/builtins/fc.def
@@ -161,11 +161,11 @@ set_verbose_flag ()
}
/* String to execute on a file that we want to edit. */
-#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
+#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-$(command -v editor || echo vi)}}"
#if defined (STRICT_POSIX)
# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-ed}"
#else
-# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-ed}}"
+# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-$(command -v editor || echo ed)}}"
#endif
int
|