From 424c358786b11ae6ee5609164fee1e0085baec48 Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Sun, 27 Jan 2019 03:45:29 +0800 Subject: [PATCH 01/12] Add vterm layer vterm layer uses emacs-libvterm for terminal support --- init.example.el | 1 + modules/config/default/+evil-bindings.el | 3 ++ modules/emacs/vterm/autoload.el | 29 +++++++++++++ modules/emacs/vterm/config.el | 27 ++++++++++++ modules/emacs/vterm/doctor.el | 13 ++++++ modules/emacs/vterm/packages.el | 4 ++ modules/emacs/vterm/readme.org | 55 ++++++++++++++++++++++++ modules/ui/popup/config.el | 2 + 8 files changed, 134 insertions(+) create mode 100644 modules/emacs/vterm/autoload.el create mode 100644 modules/emacs/vterm/config.el create mode 100644 modules/emacs/vterm/doctor.el create mode 100644 modules/emacs/vterm/packages.el create mode 100644 modules/emacs/vterm/readme.org diff --git a/init.example.el b/init.example.el index 8789117f9..aecc8e67c 100644 --- a/init.example.el +++ b/init.example.el @@ -60,6 +60,7 @@ hideshow ; basic code-folding support imenu ; an imenu sidebar and searchable code index ;;term ; terminals in Emacs + ;;vterm ; another terminals in Emacs vc ; version-control and Emacs, sitting in a tree :tools diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index de2ccf508..b072979d3 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -689,6 +689,9 @@ (:when (featurep! :emacs term) :desc "Terminal" "t" #'+term/open :desc "Terminal in popup" "T" #'+term/open-popup-in-project) + (:when (featurep! :emacs vterm) + :desc "Terminal" "t" #'+vterm/open + :desc "Terminal in popup" "T" #'+vterm/open-popup-in-project) (:when (featurep! :emacs eshell) :desc "Eshell" "e" #'+eshell/open :desc "Eshell in popup" "E" #'+eshell/open-popup) diff --git a/modules/emacs/vterm/autoload.el b/modules/emacs/vterm/autoload.el new file mode 100644 index 000000000..4d3f7311d --- /dev/null +++ b/modules/emacs/vterm/autoload.el @@ -0,0 +1,29 @@ +;;; emacs/vterm/autoload.el -*- lexical-binding: t; -*- + +;;;###autoload +(defun +vterm/open (arg) + "Open a terminal buffer in the current window. If ARG (universal argument) is +non-nil, cd into the current project's root." + (interactive "P") + (let ((default-directory + (if arg + (or (doom-project-root) default-directory) + default-directory))) + (switch-to-buffer (save-window-excursion (vterm))))) + +;;;###autoload +(defun +vterm/open-popup (arg) + "Open a terminal popup window. If ARG (universal argument) is +non-nil, cd into the current project's root." + (interactive "P") + (let ((default-directory + (if arg + (or (doom-project-root) default-directory) + default-directory))) + (pop-to-buffer (save-window-excursion (vterm))))) + +;;;###autoload +(defun +vterm/open-popup-in-project () + "Open a terminal popup window in the root of the current project." + (interactive) + (+vterm/open-popup t)) diff --git a/modules/emacs/vterm/config.el b/modules/emacs/vterm/config.el new file mode 100644 index 000000000..32bc953ba --- /dev/null +++ b/modules/emacs/vterm/config.el @@ -0,0 +1,27 @@ +;;; emacs/vterm/config.el -*- lexical-binding: t; -*- + +(def-package! vterm + :load-path (lambda () (list (concat doom-packages-dir "/quelpa/build/vterm"))) + :init + (unless (file-executable-p (concat + (file-name-directory (locate-library "vterm")) + "vterm-module.so")) + ;; let vterm compile `vterm-modules.so' + (setq-default vterm-install t)) + :when (and (string-match-p "MODULES" system-configuration-features) + (display-graphic-p)) + :config + (set-env! "SHELL") + (add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real) + ;; Automatically kill buffer when vterm exits. + (setq-default vterm-exit-functions #'kill-buffer) + (when (featurep! :feature evil) + (evil-set-initial-state 'vterm-mode 'insert) + ;; Those keys are commonly needed by terminals. + (evil-define-key 'insert vterm-mode-map + (kbd "C-d") #'vterm--self-insert) + ;; Go back to normal state but don't move cursor backwards. + ;; Moving cursor backwards is the default Vim behavior but + ;; it is not appropriate in some cases like terminals. + (add-hook 'vterm-mode-hook #'(lambda () + (setq-local evil-move-cursor-back nil))))) diff --git a/modules/emacs/vterm/doctor.el b/modules/emacs/vterm/doctor.el new file mode 100644 index 000000000..8f8837fc8 --- /dev/null +++ b/modules/emacs/vterm/doctor.el @@ -0,0 +1,13 @@ +;;; emacs/vterm/doctor.el -*- lexical-binding: t; -*- + +(unless (executable-find "vterm-ctrl") + (warn! "Couldn't find libvterm library. Please install it on your system")) + +(unless (executable-find "make") + (warn! "Couldn't find make command. Please install it on your system")) + +(unless (executable-find "cmake") + (warn! "Couldn't find cmake command. Please install it on your system")) + +(unless (string-match-p "MODULES" system-configuration-features) + (error! "You have to compile emacs with MODULES support")) diff --git a/modules/emacs/vterm/packages.el b/modules/emacs/vterm/packages.el new file mode 100644 index 000000000..f584b6c74 --- /dev/null +++ b/modules/emacs/vterm/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; emacs/vterm/packages.el + +(package! vterm :recipe (:fetcher github :repo "akermu/emacs-libvterm")) diff --git a/modules/emacs/vterm/readme.org b/modules/emacs/vterm/readme.org new file mode 100644 index 000000000..3a8b13ba8 --- /dev/null +++ b/modules/emacs/vterm/readme.org @@ -0,0 +1,55 @@ +#+TITLE: emacs/vterm +#+DATE: January 16, 2019 +#+SINCE: {replace with next tagged release version} +#+STARTUP: inlineimages + +* Table of Contents :TOC_3:noexport: +- [[Description][Description]] +- [[Prerequisites][Prerequisites]] + - [[Emacs requirement][Emacs requirement]] + - [[Compiler requirement][Compiler requirement]] + - [[System requirement][System requirement]] + +* Description +An [[https://github.com/akermu/emacs-libvterm][emacs-libvterm]] module. + +* Prerequisites + +** Emacs requirement + +You have to compile emacs with =--with-modules= option. + +Lookat the =system-configuration-options= variable to see if your emacs has this option. + +** Compiler requirement + +Your system need to have =make= =cmake= and a c compiler to compile +=libvterm-module=, Emacs will automatically compile the module for you. + +You can also put your pre-compiled =vterm-module.so= to your vterm installation +folder, which is usually =~/.emacs.d/.local/packages/quelpa/build/vterm/=, +and make sure =vterm-module.so= file is executable, instead of let emacs compile +it for you. + +** System requirement + +You need to have =libvterm= installed in your system. + +On Ubuntu or Debian: + +#+BEGIN_SRC sh +sudo apt install libvterm-dev +#+END_SRC + +On ArchLinux or Manjaro: + +#+BEGIN_SRC sh +sudo pacman -S libvterm +#+END_SRC + +On macOS: + +#+BEGIN_SRC sh +brew install libvterm +#+END_SRC + diff --git a/modules/ui/popup/config.el b/modules/ui/popup/config.el index cb49d1e8d..088912b1c 100644 --- a/modules/ui/popup/config.el +++ b/modules/ui/popup/config.el @@ -144,6 +144,8 @@ prevent the popup(s) from messing up the UI (or vice versa)." :size 0.45 :vslot -3 :ttl 0 :quit t :select t) ("^\\*doom \\(?:term\\|eshell\\)" :size 0.25 :vslot -4 :select t :quit nil :ttl 0) + ("^vterm" + :size 0.25 :vslot -4 :select t :quit nil :ttl 0) ("^\\*doom:" :vslot -5 :size 0.35 :size bottom :autosave t :select t :modeline t :quit nil) ("^\\*\\(?:\\(?:Pp E\\|doom e\\)val\\)" From 8b867c780dea74120275ee4b5ad8b6f30f9512bd Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Tue, 29 Jan 2019 20:43:15 +0800 Subject: [PATCH 02/12] use add-hook instead of setq we can support multipule hook functions with `add-hook` --- modules/emacs/vterm/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/emacs/vterm/config.el b/modules/emacs/vterm/config.el index 32bc953ba..65cd5ed75 100644 --- a/modules/emacs/vterm/config.el +++ b/modules/emacs/vterm/config.el @@ -14,7 +14,8 @@ (set-env! "SHELL") (add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real) ;; Automatically kill buffer when vterm exits. - (setq-default vterm-exit-functions #'kill-buffer) + (add-hook 'vterm-exit-functions #'(lambda (buffer) + (when buffer (kill-buffer buffer)))) (when (featurep! :feature evil) (evil-set-initial-state 'vterm-mode 'insert) ;; Those keys are commonly needed by terminals. From 0a43819a44f11ed90df8862457fb209afcb2a5f8 Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Fri, 1 Feb 2019 22:34:49 +0800 Subject: [PATCH 03/12] bypass more keybindings to vterm --- modules/emacs/vterm/config.el | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/emacs/vterm/config.el b/modules/emacs/vterm/config.el index 65cd5ed75..221e7cdb8 100644 --- a/modules/emacs/vterm/config.el +++ b/modules/emacs/vterm/config.el @@ -20,7 +20,25 @@ (evil-set-initial-state 'vterm-mode 'insert) ;; Those keys are commonly needed by terminals. (evil-define-key 'insert vterm-mode-map - (kbd "C-d") #'vterm--self-insert) + (kbd "C-a") #'vterm--self-insert + (kbd "C-b") #'vterm--self-insert ; Should not be necessary. + (kbd "C-d") #'vterm--self-insert + (kbd "C-e") #'vterm--self-insert + (kbd "C-f") #'vterm--self-insert ; Should not be necessary. + (kbd "C-k") #'vterm--self-insert + (kbd "C-l") #'vterm--self-insert ; Should not be necessary. + (kbd "C-n") #'vterm--self-insert + (kbd "C-o") #'vterm--self-insert + (kbd "C-p") #'vterm--self-insert + (kbd "C-q") #'vterm--self-insert ; Should not be necessary. + (kbd "C-r") #'vterm--self-insert + (kbd "C-s") #'vterm--self-insert ; Should not be necessary. + (kbd "C-t") #'vterm--self-insert + (kbd "C-u") #'vterm--self-insert ; Should not be necessary. + (kbd "C-v") #'vterm--self-insert ; Should not be necessary. + (kbd "C-w") #'vterm--self-insert + (kbd "C-y") #'vterm--self-insert + (kbd "C-z") #'vterm--self-insert) ;; Go back to normal state but don't move cursor backwards. ;; Moving cursor backwards is the default Vim behavior but ;; it is not appropriate in some cases like terminals. From 1e864df8cd157130a973f552b2a73529e4365ece Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Sun, 17 Feb 2019 00:04:51 +0800 Subject: [PATCH 04/12] move vterm's popup rule to vterm layer --- modules/emacs/vterm/config.el | 2 ++ modules/ui/popup/config.el | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/emacs/vterm/config.el b/modules/emacs/vterm/config.el index 221e7cdb8..83f5eac5e 100644 --- a/modules/emacs/vterm/config.el +++ b/modules/emacs/vterm/config.el @@ -16,6 +16,8 @@ ;; Automatically kill buffer when vterm exits. (add-hook 'vterm-exit-functions #'(lambda (buffer) (when buffer (kill-buffer buffer)))) + (when (featurep! :ui popup +defaults) + (set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0)) (when (featurep! :feature evil) (evil-set-initial-state 'vterm-mode 'insert) ;; Those keys are commonly needed by terminals. diff --git a/modules/ui/popup/config.el b/modules/ui/popup/config.el index 088912b1c..cb49d1e8d 100644 --- a/modules/ui/popup/config.el +++ b/modules/ui/popup/config.el @@ -144,8 +144,6 @@ prevent the popup(s) from messing up the UI (or vice versa)." :size 0.45 :vslot -3 :ttl 0 :quit t :select t) ("^\\*doom \\(?:term\\|eshell\\)" :size 0.25 :vslot -4 :select t :quit nil :ttl 0) - ("^vterm" - :size 0.25 :vslot -4 :select t :quit nil :ttl 0) ("^\\*doom:" :vslot -5 :size 0.35 :size bottom :autosave t :select t :modeline t :quit nil) ("^\\*\\(?:\\(?:Pp E\\|doom e\\)val\\)" From d6496fc1683c33ad7de23201b57a782330460d7a Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Sun, 17 Feb 2019 00:03:36 +0800 Subject: [PATCH 05/12] rename vterm from :emacs to :tools --- init.example.el | 2 +- modules/{emacs => tools}/vterm/autoload.el | 2 +- modules/{emacs => tools}/vterm/config.el | 2 +- modules/{emacs => tools}/vterm/doctor.el | 2 +- modules/{emacs => tools}/vterm/packages.el | 2 +- modules/{emacs => tools}/vterm/readme.org | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename modules/{emacs => tools}/vterm/autoload.el (94%) rename modules/{emacs => tools}/vterm/config.el (97%) rename modules/{emacs => tools}/vterm/doctor.el (89%) rename modules/{emacs => tools}/vterm/packages.el (78%) rename modules/{emacs => tools}/vterm/readme.org (98%) diff --git a/init.example.el b/init.example.el index aecc8e67c..093fb033a 100644 --- a/init.example.el +++ b/init.example.el @@ -60,7 +60,6 @@ hideshow ; basic code-folding support imenu ; an imenu sidebar and searchable code index ;;term ; terminals in Emacs - ;;vterm ; another terminals in Emacs vc ; version-control and Emacs, sitting in a tree :tools @@ -80,6 +79,7 @@ ;;tmux ; an API for interacting with tmux ;;upload ; map local to remote projects via ssh/ftp ;;wakatime + ;;vterm ; another terminals in Emacs :lang ;;assembly ; assembly for fun or debugging diff --git a/modules/emacs/vterm/autoload.el b/modules/tools/vterm/autoload.el similarity index 94% rename from modules/emacs/vterm/autoload.el rename to modules/tools/vterm/autoload.el index 4d3f7311d..52f663a73 100644 --- a/modules/emacs/vterm/autoload.el +++ b/modules/tools/vterm/autoload.el @@ -1,4 +1,4 @@ -;;; emacs/vterm/autoload.el -*- lexical-binding: t; -*- +;;; tools/vterm/autoload.el -*- lexical-binding: t; -*- ;;;###autoload (defun +vterm/open (arg) diff --git a/modules/emacs/vterm/config.el b/modules/tools/vterm/config.el similarity index 97% rename from modules/emacs/vterm/config.el rename to modules/tools/vterm/config.el index 83f5eac5e..61ced658c 100644 --- a/modules/emacs/vterm/config.el +++ b/modules/tools/vterm/config.el @@ -1,4 +1,4 @@ -;;; emacs/vterm/config.el -*- lexical-binding: t; -*- +;;; tools/vterm/config.el -*- lexical-binding: t; -*- (def-package! vterm :load-path (lambda () (list (concat doom-packages-dir "/quelpa/build/vterm"))) diff --git a/modules/emacs/vterm/doctor.el b/modules/tools/vterm/doctor.el similarity index 89% rename from modules/emacs/vterm/doctor.el rename to modules/tools/vterm/doctor.el index 8f8837fc8..8d9a04b33 100644 --- a/modules/emacs/vterm/doctor.el +++ b/modules/tools/vterm/doctor.el @@ -1,4 +1,4 @@ -;;; emacs/vterm/doctor.el -*- lexical-binding: t; -*- +;;; tools/vterm/doctor.el -*- lexical-binding: t; -*- (unless (executable-find "vterm-ctrl") (warn! "Couldn't find libvterm library. Please install it on your system")) diff --git a/modules/emacs/vterm/packages.el b/modules/tools/vterm/packages.el similarity index 78% rename from modules/emacs/vterm/packages.el rename to modules/tools/vterm/packages.el index f584b6c74..9e6a8a837 100644 --- a/modules/emacs/vterm/packages.el +++ b/modules/tools/vterm/packages.el @@ -1,4 +1,4 @@ ;; -*- no-byte-compile: t; -*- -;;; emacs/vterm/packages.el +;;; tools/vterm/packages.el (package! vterm :recipe (:fetcher github :repo "akermu/emacs-libvterm")) diff --git a/modules/emacs/vterm/readme.org b/modules/tools/vterm/readme.org similarity index 98% rename from modules/emacs/vterm/readme.org rename to modules/tools/vterm/readme.org index 3a8b13ba8..7cc22e34a 100644 --- a/modules/emacs/vterm/readme.org +++ b/modules/tools/vterm/readme.org @@ -1,4 +1,4 @@ -#+TITLE: emacs/vterm +#+TITLE: tools/vterm #+DATE: January 16, 2019 #+SINCE: {replace with next tagged release version} #+STARTUP: inlineimages From c79a99254531e8609a9a84d8c7b974da318f8255 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 18 Feb 2019 18:49:02 -0500 Subject: [PATCH 06/12] Include all files with vterm package They are needed to compile vterm-module.so --- modules/tools/vterm/packages.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/tools/vterm/packages.el b/modules/tools/vterm/packages.el index 9e6a8a837..c0d33a1d5 100644 --- a/modules/tools/vterm/packages.el +++ b/modules/tools/vterm/packages.el @@ -1,4 +1,7 @@ ;; -*- no-byte-compile: t; -*- ;;; tools/vterm/packages.el -(package! vterm :recipe (:fetcher github :repo "akermu/emacs-libvterm")) +(package! vterm :recipe + (:fetcher github + :repo "akermu/emacs-libvterm" + :files ("*"))) From 002914c912297ca0a117199c1381862384d72e97 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 18 Feb 2019 18:50:02 -0500 Subject: [PATCH 07/12] Update SPC o t/T keybind predicate Since :emacs vterm was moved to :tools --- modules/config/default/+evil-bindings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index b072979d3..406c39c9c 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -689,7 +689,7 @@ (:when (featurep! :emacs term) :desc "Terminal" "t" #'+term/open :desc "Terminal in popup" "T" #'+term/open-popup-in-project) - (:when (featurep! :emacs vterm) + (:when (featurep! :tools vterm) :desc "Terminal" "t" #'+vterm/open :desc "Terminal in popup" "T" #'+vterm/open-popup-in-project) (:when (featurep! :emacs eshell) From 483f2a492c53f425d21bc54eee4890d59ff57424 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 18 Feb 2019 18:56:20 -0500 Subject: [PATCH 08/12] Lazy-load vterm & refactor config --- modules/tools/vterm/config.el | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/modules/tools/vterm/config.el b/modules/tools/vterm/config.el index 61ced658c..ab89ee5ee 100644 --- a/modules/tools/vterm/config.el +++ b/modules/tools/vterm/config.el @@ -1,27 +1,25 @@ ;;; tools/vterm/config.el -*- lexical-binding: t; -*- (def-package! vterm - :load-path (lambda () (list (concat doom-packages-dir "/quelpa/build/vterm"))) - :init - (unless (file-executable-p (concat - (file-name-directory (locate-library "vterm")) - "vterm-module.so")) - ;; let vterm compile `vterm-modules.so' - (setq-default vterm-install t)) - :when (and (string-match-p "MODULES" system-configuration-features) - (display-graphic-p)) + :when (fboundp 'module-load) + :defer t + :init (setq vterm-install t) :config (set-env! "SHELL") + (set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0) + (add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real) ;; Automatically kill buffer when vterm exits. - (add-hook 'vterm-exit-functions #'(lambda (buffer) - (when buffer (kill-buffer buffer)))) - (when (featurep! :ui popup +defaults) - (set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0)) + (add-to-list 'vterm-exit-functions (lambda (buffer) (if buffer (kill-buffer buffer)))) + (when (featurep! :feature evil) (evil-set-initial-state 'vterm-mode 'insert) + ;; Go back to normal state but don't move cursor backwards. Moving cursor + ;; backwards is the default Vim behavior but it is not appropriate in some + ;; cases like terminals. + (setq-hook! 'vterm-mode-hook evil-move-cursor-back nil) ;; Those keys are commonly needed by terminals. - (evil-define-key 'insert vterm-mode-map + (evil-define-key* 'insert vterm-mode-map (kbd "C-a") #'vterm--self-insert (kbd "C-b") #'vterm--self-insert ; Should not be necessary. (kbd "C-d") #'vterm--self-insert @@ -40,9 +38,4 @@ (kbd "C-v") #'vterm--self-insert ; Should not be necessary. (kbd "C-w") #'vterm--self-insert (kbd "C-y") #'vterm--self-insert - (kbd "C-z") #'vterm--self-insert) - ;; Go back to normal state but don't move cursor backwards. - ;; Moving cursor backwards is the default Vim behavior but - ;; it is not appropriate in some cases like terminals. - (add-hook 'vterm-mode-hook #'(lambda () - (setq-local evil-move-cursor-back nil))))) + (kbd "C-z") #'vterm--self-insert))) From 16b7c58da9706d8a9c61e8e080bd882ec575fbac Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Thu, 21 Feb 2019 23:22:04 +0800 Subject: [PATCH 09/12] use fboundp instead of string-match-p --- modules/tools/vterm/doctor.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tools/vterm/doctor.el b/modules/tools/vterm/doctor.el index 8d9a04b33..8b9429d0c 100644 --- a/modules/tools/vterm/doctor.el +++ b/modules/tools/vterm/doctor.el @@ -9,5 +9,5 @@ (unless (executable-find "cmake") (warn! "Couldn't find cmake command. Please install it on your system")) -(unless (string-match-p "MODULES" system-configuration-features) - (error! "You have to compile emacs with MODULES support")) +(unless (fboundp 'module-load) + (warn! "You have to compile emacs with MODULES support")) From df19747ca2ee990de7169688f5b833df1e9d5c49 Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Thu, 21 Feb 2019 23:33:21 +0800 Subject: [PATCH 10/12] change warning messages --- modules/tools/vterm/doctor.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/tools/vterm/doctor.el b/modules/tools/vterm/doctor.el index 8b9429d0c..866c4b62d 100644 --- a/modules/tools/vterm/doctor.el +++ b/modules/tools/vterm/doctor.el @@ -1,13 +1,13 @@ ;;; tools/vterm/doctor.el -*- lexical-binding: t; -*- (unless (executable-find "vterm-ctrl") - (warn! "Couldn't find libvterm library. Please install it on your system")) + (warn! "Couldn't find libvterm. Vterm module won't compile.")) (unless (executable-find "make") - (warn! "Couldn't find make command. Please install it on your system")) + (warn! "Couldn't find make command. Vterm module won't compile.")) (unless (executable-find "cmake") - (warn! "Couldn't find cmake command. Please install it on your system")) + (warn! "Couldn't find cmake command. Vterm module won't compile")) (unless (fboundp 'module-load) - (warn! "You have to compile emacs with MODULES support")) + (warn! "Your emacs don't have MODULES support. Vterm module won't work.")) From 4ac096a55d5791c90a2903cdfd7e72997de0446b Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Thu, 21 Feb 2019 23:55:08 +0800 Subject: [PATCH 11/12] Rewrite readme --- modules/tools/vterm/readme.org | 62 ++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/modules/tools/vterm/readme.org b/modules/tools/vterm/readme.org index 7cc22e34a..b1f48b587 100644 --- a/modules/tools/vterm/readme.org +++ b/modules/tools/vterm/readme.org @@ -7,8 +7,8 @@ - [[Description][Description]] - [[Prerequisites][Prerequisites]] - [[Emacs requirement][Emacs requirement]] - - [[Compiler requirement][Compiler requirement]] - [[System requirement][System requirement]] + - [[Module requirement][Module requirement]] * Description An [[https://github.com/akermu/emacs-libvterm][emacs-libvterm]] module. @@ -19,17 +19,19 @@ An [[https://github.com/akermu/emacs-libvterm][emacs-libvterm]] module. You have to compile emacs with =--with-modules= option. -Lookat the =system-configuration-options= variable to see if your emacs has this option. +Check the =system-configuration-options= variable to see if your emacs has this +option. -** Compiler requirement - -Your system need to have =make= =cmake= and a c compiler to compile -=libvterm-module=, Emacs will automatically compile the module for you. - -You can also put your pre-compiled =vterm-module.so= to your vterm installation -folder, which is usually =~/.emacs.d/.local/packages/quelpa/build/vterm/=, -and make sure =vterm-module.so= file is executable, instead of let emacs compile -it for you. +- On Archlinux or Manjaro, if you install emacs with pacman, this option is + enabled. +- On macOS: + - If you use [[https://emacsformacosx.com/][Emacs For Mac OS X]], this option is enabled. + - If you use [[https://github.com/d12frosted/homebrew-emacs-plus][emacs-plus]], this option is enabled by default. + - If you use [[https://github.com/railwaycat/homebrew-emacsmacport][emacs-mac]], this options is *not* enabled by default. You may have + to reinstall emacs with the option: + #+BEGIN_SRC sh + brew install emacs-mac --with-modules + #+END_SRC ** System requirement @@ -53,3 +55,41 @@ On macOS: brew install libvterm #+END_SRC + +** Module requirement + +You have to compile and install the requied module =vterm-module.so=. + +In order to compile it you need to have: + +- Compilation tools. This include =make=, =cmake= and a c compiler such as + =gcc=. +- Internet connection, because =cmake= will automatically download some requied + libraries from the internet. + +There are several ways to install the module: + +1. The first time you use vterm inside emacs, emacs will automatically compile + and install the module if it cannot find an executable =vterm-module.so= + file. + + *WARNING*: Emacs will hang during the compilation. It may take a while. + +2. A fully byte-compile will cause emacs to automatically compile and install + the module if it cannot find an executable =vterm-module.so= file. + +3. You can compile and install the module yourself. Go to the vterm installation + directory, which is usually + =~/.emacs.d/.local/packages/elpa/vterm-=, and run the following: + + #+BEGIN_SRC sh + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. + make + #+END_SRC + +4. You can also compile the module at other place, and install the compiled + =vterm-module.so= file to your vterm installation folder, which is usually + =~/.emacs.d/.local/packages/elpa/vterm-/=. Also make sure the module + file is executable. From f0048be7f84c41e8199eacb3975299d632a49034 Mon Sep 17 00:00:00 2001 From: SteamedFish Date: Fri, 22 Feb 2019 00:58:31 +0800 Subject: [PATCH 12/12] More specific about "use vterm" use the command to trigger vterm instead of a general "use vterm" --- modules/tools/vterm/readme.org | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/tools/vterm/readme.org b/modules/tools/vterm/readme.org index b1f48b587..077e6a668 100644 --- a/modules/tools/vterm/readme.org +++ b/modules/tools/vterm/readme.org @@ -69,9 +69,8 @@ In order to compile it you need to have: There are several ways to install the module: -1. The first time you use vterm inside emacs, emacs will automatically compile - and install the module if it cannot find an executable =vterm-module.so= - file. +1. You can use =M-x vterm-module-compile= to let emacs automatically compile and + install the module. *WARNING*: Emacs will hang during the compilation. It may take a while.