aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriele Bozzola <sbozzolator@gmail.com>2020-04-28 21:28:04 -0700
committerGitHub <noreply@github.com>2020-04-28 21:28:04 -0700
commite63bd65eece7c5de3a534b7e2fdbe58256ec2da0 (patch)
treeb96f8c69d40c81997940c8728e719bd264bb8f20
parent3d12d39df1fd0469d6aaec2eecd265f780569c26 (diff)
parent3b5c98570767c7de41369e2b2d7772df8f1868b3 (diff)
Merge pull request #307 from Sbozzolo/ask_for_compilation
Ask users for permission to compile module
-rw-r--r--README.md7
-rw-r--r--vterm.el16
2 files changed, 21 insertions, 2 deletions
diff --git a/README.md b/README.md
index 9881667..a3c140c 100644
--- a/README.md
+++ b/README.md
@@ -304,6 +304,13 @@ end
See [zsh and bash](http://tldp.org/HOWTO/Xterm-Title-4.html) and (fish
documentations)[https://fishshell.com/docs/current/#programmable-title].
+## `vterm-always-compile-module`
+
+Vterm needs `vterm-module` to work. This can be compiled externally, or `vterm`
+will ask the user whether to build the module when `vterm` is first called. To
+avoid this question and always compile the module, set
+`vterm-always-compile-module` to `t`.
+
## Keybindings
If you want a key to be sent to the terminal, bind it to `vterm--self-insert`,
diff --git a/vterm.el b/vterm.el
index f634ac3..4893872 100644
--- a/vterm.el
+++ b/vterm.el
@@ -63,6 +63,14 @@ is `-DUSE_SYSTEM_LIBVTERM=yes'."
:type 'string
:group 'vterm)
+(defcustom vterm-always-compile-module nil
+ "If not nil, if `vterm-module' is not found, compile it without asking.
+
+When `vterm-always-compile-module' is nil, vterm will ask for
+confirmation before compiling."
+ :type 'boolean
+ :group 'vterm)
+
(defvar vterm-install-buffer-name " *Install vterm* "
"Name of the buffer used for compiling vterm-module.")
@@ -101,8 +109,12 @@ the executable."
;; If the vterm-module is not compiled yet, compile it
(unless (require 'vterm-module nil t)
- (vterm-module-compile)
- (require 'vterm-module))
+ (if (or vterm-always-compile-module
+ (y-or-n-p "Vterm needs `vterm-module' to work. Compile it now? "))
+ (progn
+ (vterm-module-compile)
+ (require 'vterm-module))
+ (error "Vterm will not work until `vterm-module' is compiled!")))
;; Silence compiler warnings by informing it of what functions are defined
(declare-function display-line-numbers-update-width "display-line-numbers")