From 1863fc6e00e9b53fa68dcf56034cdc3b428a59a3 Mon Sep 17 00:00:00 2001 From: jixiufeng Date: Mon, 13 May 2019 00:58:20 +0800 Subject: trying auto compile emacs-libvterm if require vterm-module failed --- README.md | 13 +++++-------- vterm.el | 21 ++++++++------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d7fb825..1cd9900 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ Clone the repository: git clone https://github.com/akermu/emacs-libvterm.git ``` +Before install emacs-libvterm,you need make sure you have +installed + 1. cmake (>=3.0.2) + 2. libtool-bin related issues: [#66](https://github.com/akermu/emacs-libvterm/issues/66) [#85](https://github.com/akermu/emacs-libvterm/issues/85#issuecomment-491845136) + Run the build: ``` @@ -32,14 +37,6 @@ And add this to your `init.el`: (require 'vterm) ``` -If you want to have the module compiled, wrap the call to `require` as follows: - -``` -(add-to-list 'load-path "path/to/emacs-libvterm") -(let (vterm-install) - (require 'vterm)) -``` - # Debugging and testing If you have successfully build the module, you can test the module by executing diff --git a/vterm.el b/vterm.el index 1789c1b..f6eb80f 100644 --- a/vterm.el +++ b/vterm.el @@ -39,13 +39,6 @@ ;; (require 'vterm) ;; ``` -;; If you want to have the module compiled, wrap the call to `require` as follows: - -;; ``` -;; (add-to-list 'load-path "path/to/emacs-libvterm") -;; (let (vterm-install) -;; (require 'vterm)) -;; ``` ;;; Code: @@ -61,20 +54,22 @@ (let ((default-directory (file-name-directory (locate-library "vterm")))) (unless (file-executable-p (concat default-directory "vterm-module.so" )) (let* ((buffer (get-buffer-create vterm-install-buffer-name)) - (status (call-process "sh" nil buffer t "-c" + status) + (pop-to-buffer vterm-install-buffer-name) + (setq status (call-process "sh" nil buffer t "-c" "mkdir -p build; \ cd build; \ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..; \ - make"))) + make") ) (if (eq status 0) (message "Compilation of emacs-libvterm module succeeded") - (pop-to-buffer vterm-install-buffer-name) (error "Compilation of emacs-libvterm module failed!")))))) -(when (boundp 'vterm-install) - (vterm-module-compile)) -(require 'vterm-module) +(unless (require 'vterm-module nil t) + (vterm-module-compile) + (require 'vterm-module)) + (require 'subr-x) (require 'cl-lib) (require 'color) -- cgit v1.0