aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md15
-rw-r--r--vterm.el38
2 files changed, 27 insertions, 26 deletions
diff --git a/README.md b/README.md
index d7fb825..bb7671c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![MELPA](https://melpa.org/packages/vterm-badge.svg)](https://melpa.org/#/vterm)
+
# Introduction
This emacs module implements a bridge to libvterm to display a terminal in a
@@ -16,6 +18,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 +39,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..ff75478 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)
@@ -169,7 +164,7 @@ for different shell"
(define-key vterm-mode-map [tab] #'vterm--self-insert)
(define-key vterm-mode-map [backspace] #'vterm--self-insert)
(define-key vterm-mode-map [M-backspace] #'vterm--self-insert)
-(define-key vterm-mode-map [return] #'vterm--self-insert)
+(define-key vterm-mode-map [return] #'vterm-send-return)
(define-key vterm-mode-map [left] #'vterm--self-insert)
(define-key vterm-mode-map [right] #'vterm--self-insert)
(define-key vterm-mode-map [up] #'vterm--self-insert)
@@ -228,6 +223,11 @@ for different shell"
(interactive)
(vterm-send-key "_" nil nil t))
+(defun vterm-send-return ()
+ "Sends C-m to the libvterm."
+ (interactive)
+ (process-send-string vterm--process "\C-m"))
+
(defun vterm-yank ()
"Implementation of `yank' (paste) in vterm."
(interactive)
@@ -300,10 +300,12 @@ Argument BUFFER the terminal buffer."
Then triggers a redraw from the module."
(let ((inhibit-redisplay t)
- (inhibit-read-only t))
- (with-current-buffer (process-buffer process)
- (vterm--write-input vterm--term input)
- (vterm--update vterm--term))))
+ (inhibit-read-only t)
+ (buf (process-buffer process)))
+ (when (buffer-live-p buf)
+ (with-current-buffer buf
+ (vterm--write-input vterm--term input)
+ (vterm--update vterm--term)))))
(defun vterm--sentinel (process event)
"Sentinel of vterm PROCESS.