Skip to content

Commit 1d209bc

Browse files
committed
Add GitHub Action
1 parent 4f01d26 commit 1d209bc

File tree

3 files changed

+151
-23
lines changed

3 files changed

+151
-23
lines changed

Diff for: .github/workflows/test.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# * test.yml --- Test libvterm using makem.sh on GitHub Actions
2+
3+
# Based on Alphapapa's makem.sh
4+
# https://github.com/alphapapa/makem.sh
5+
6+
# Based on Steve Purcell's examples at
7+
# <https://github.com/purcell/setup-emacs/blob/master/.github/workflows/test.yml>,
8+
# <https://github.com/purcell/package-lint/blob/master/.github/workflows/test.yml>.
9+
10+
# * License:
11+
12+
# This program is free software; you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License as published by
14+
# the Free Software Foundation, either version 3 of the License, or
15+
# (at your option) any later version.
16+
17+
# This program is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
22+
# You should have received a copy of the GNU General Public License
23+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
24+
25+
# * Code:
26+
27+
name: "CI"
28+
on:
29+
pull_request:
30+
push:
31+
# Comment out this section to enable testing of all branches.
32+
# branches:
33+
# - master
34+
35+
jobs:
36+
build:
37+
runs-on: ubuntu-20.04
38+
strategy:
39+
fail-fast: true
40+
matrix:
41+
emacs_version:
42+
- snapshot
43+
use_system_libvterm:
44+
- no
45+
- yes
46+
steps:
47+
- uses: purcell/setup-emacs@master
48+
with:
49+
version: ${{ matrix.emacs_version }}
50+
51+
- uses: actions/checkout@v2
52+
53+
- name: Grab makem.sh
54+
uses: wei/wget@v1
55+
with:
56+
args: https://raw.githubusercontent.com/alphapapa/makem.sh/master/makem.sh
57+
58+
- name: Initialize sandbox
59+
run: |
60+
SANDBOX_DIR=$(mktemp -d) || exit 1
61+
echo "{SANDBOX_DIR}={$SANDBOX_DIR}" >> $GITHUB_ENV
62+
bash makem.sh -vv --sandbox=$SANDBOX_DIR --install-deps --install-linters
63+
64+
- name: Install CMake
65+
run: nix-env -f "<nixpkgs>" -iA cmake
66+
67+
- name: Install libvterm
68+
if: ${{matrix.use_system_libvterm == 'yes'}}
69+
run: nix-env -f "<nixpkgs>" -iA libvterm-neovim
70+
71+
- name: Install other dependencies
72+
run: nix-env -f "<nixpkgs>" -iA libtool
73+
74+
- name: Install spell-checker
75+
run: |
76+
nix-env -f "<nixpkgs>" -iA hunspell
77+
nix-env -f "<nixpkgs>" -iA hunspellDicts.en_US
78+
79+
- name: Compile vterm
80+
if: ${{matrix.use_system_libvterm == 'no'}}
81+
run: |
82+
mkdir build
83+
cd build
84+
cmake ..
85+
make
86+
87+
- name: Require vterm
88+
run: bash makem.sh -vv --sandbox=$SANDBOX batch -- --eval "(require 'vterm)"
89+
90+
- name: Lint
91+
# We only need to lint once
92+
continue-on-error: true
93+
run: bash makem.sh -vv --sandbox=$SANDBOX_DIR --exclude makem-pre-test-conf.el lint
94+
95+
# - name: Test
96+
# if: always() # Run test even if linting fails.
97+
# run: bash makem.sh -vv --sandbox=$SANDBOX_DIR test
98+
99+
# Local Variables:
100+
# eval: (outline-minor-mode)
101+
# End:

Diff for: makem-pre-test-conf.el

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
;;; makem-pre-test-conf.el --- Configuration for tests -*- lexical-binding: t; -*-
2+
;;
3+
;; Copyright (C) 2020 Gabriele Bozzola
4+
;;
5+
;; Author: Gabriele Bozzola <http://github/sbozzolo>
6+
;; Maintainer: Gabriele Bozzola <[email protected]>
7+
;; Created: July 25, 2020
8+
;; Modified: July 25, 2020
9+
;; Version: 0.0.1
10+
;; Keywords:
11+
;; Package-Requires: ((emacs 25.1))
12+
;;
13+
;; This file is not part of GNU Emacs.
14+
;;
15+
;;; Commentary:
16+
;;
17+
;; https://github.com/alphapapa/makem.sh/issues/24
18+
;;
19+
;;; Code:
20+
21+
(setq vterm-always-compile-module t)
22+
23+
(provide 'a-makem-pre-test-conf)
24+
;;; makem-pre-test-conf.el ends here

Diff for: vterm.el

+26-23
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ confirmation before compiling."
8989
"Name of the buffer used for compiling vterm-module.")
9090

9191
(defun vterm-module--cmake-is-available ()
92-
"Return t if cmake is available.
92+
"Return t if CMake is available.
9393
CMake is needed to build vterm, here we check that we can find
9494
the executable."
9595

@@ -129,7 +129,7 @@ the executable."
129129
;; If the vterm-module is not compiled yet, compile it
130130
(unless (require 'vterm-module nil t)
131131
(if (or vterm-always-compile-module
132-
(y-or-n-p "Vterm needs `vterm-module' to work. Compile it now? "))
132+
(y-or-n-p "Vterm needs `vterm-module' to work. Compile it now? "))
133133
(progn
134134
(vterm-module-compile)
135135
(require 'vterm-module))
@@ -141,16 +141,16 @@ the executable."
141141
(declare-function display-line-numbers-update-width "display-line-numbers")
142142

143143
;; Generate this list with:
144-
;; awk -F\" '/bind_function*/ {print "(declare-function", $2, "\"vterm-module\")"}' vterm-module.c
145-
(declare-function vterm--new "vterm-module")
146-
(declare-function vterm--update "vterm-module")
147-
(declare-function vterm--redraw "vterm-module")
148-
(declare-function vterm--write-input "vterm-module")
149-
(declare-function vterm--set-size "vterm-module")
150-
(declare-function vterm--set-pty-name "vterm-module")
151-
(declare-function vterm--get-pwd-raw "vterm-module")
152-
(declare-function vterm--reset-point "vterm-module")
153-
(declare-function vterm--get-icrnl "vterm-module")
144+
;; awk -F\" '/bind_function*/ {print "(declare-function", $2, "\"ext:vterm-module\" t t)"}' vterm-module.c
145+
(declare-function vterm--new "ext:vterm-module" t t)
146+
(declare-function vterm--update "ext:vterm-module" t t)
147+
(declare-function vterm--redraw "ext:vterm-module" t t)
148+
(declare-function vterm--write-input "ext:vterm-module" t t)
149+
(declare-function vterm--set-size "ext:vterm-module" t t)
150+
(declare-function vterm--set-pty-name "ext:vterm-module" t t)
151+
(declare-function vterm--get-pwd-raw "ext:vterm-module" t t)
152+
(declare-function vterm--reset-point "ext:vterm-module" t t)
153+
(declare-function vterm--get-icrnl "ext:vterm-module" t t)
154154

155155
(require 'subr-x)
156156
(require 'cl-lib)
@@ -233,8 +233,8 @@ Each function is called with two arguments: the vterm buffer of
233233
the process if any, and a string describing the event passed from
234234
the sentinel.
235235
236-
This hook applies only to new vterms, created after setting this
237-
value with `add-hook'.
236+
This hook applies only to new vterm buffers, created after
237+
setting this value with `add-hook'.
238238
239239
Note that this hook will not work if another package like
240240
`shell-pop' sets its own sentinel to the `vterm' process."
@@ -324,8 +324,8 @@ used to set the current directory and prompt location. This
324324
detection method is the most-reliable. To use it, you have
325325
to change your shell prompt to print 51;A.
326326
327-
The second method is using a regular expression. This method does
328-
not require any shell-side configuration. See
327+
The second method is using a regular expression. This method does
328+
not require any shell-side configuration. See
329329
`term-prompt-regexp', for more information."
330330
:type 'boolean
331331
:group 'vterm)
@@ -434,7 +434,7 @@ Only background is used."
434434
(defvar vterm-timer-delay 0.1
435435
"Delay for refreshing the buffer after receiving updates from libvterm.
436436
437-
A larger delary improves performance when receiving large bursts
437+
A larger delay improves performance when receiving large bursts
438438
of data. If nil, never delay. The units are seconds.")
439439

440440
;;; Keybindings
@@ -463,7 +463,7 @@ of data. If nil, never delay. The units are seconds.")
463463

464464
;; Function keys and most of C- and M- bindings
465465
(defun vterm--exclude-keys (map exceptions)
466-
"Remove EXCEPTIONS from the keys bound by `vterm-define-keys'.
466+
"Remove EXCEPTIONS from MAP the keys bound by `vterm-define-keys'.
467467
468468
Exceptions are defined by `vterm-keymap-exceptions'."
469469
(mapc (lambda (key)
@@ -598,7 +598,7 @@ Exceptions are defined by `vterm-keymap-exceptions'."
598598
;; mode can break this, leading to segmentation faults.
599599
(add-hook 'change-major-mode-hook
600600
(lambda () (interactive)
601-
(user-error "You cannot change major mode in vterm buffers")) nil t)
601+
(user-error "You cannot change major mode in vterm buffers")) nil t)
602602

603603
(vterm--set-pty-name vterm--term (process-tty-name vterm--process))
604604
(process-put vterm--process 'adjust-window-size-function
@@ -1016,13 +1016,13 @@ Argument EVENT process event."
10161016
(setq width (+ width (or display-line-numbers-width 0) 4)))
10171017
width))
10181018

1019-
(defun vterm--delete-lines (line-num count &optional delete-whole-line)
1020-
"Delete COUNT lines from LINE-NUM.
1021-
If LINE-NUM is negative backward-line from end of buffer.
1019+
(defun vterm--delete-lines (line-number count &optional delete-whole-line)
1020+
"Delete COUNT lines from LINE-NUMBER.
1021+
If LINE-NUMBER is negative backward-line from end of buffer.
10221022
If option DELETE-WHOLE-LINE is non-nil, then this command kills
10231023
the whole line including its terminating newline"
10241024
(save-excursion
1025-
(when (vterm--goto-line line-num)
1025+
(when (vterm--goto-line line-number)
10261026
(delete-region (point) (point-at-eol count))
10271027
(when (and delete-whole-line
10281028
(looking-at "\n"))
@@ -1261,3 +1261,6 @@ can find them and remove them."
12611261

12621262
(provide 'vterm)
12631263
;;; vterm.el ends here
1264+
1265+
;;; LocalWords: vterm libvterm CMake scrollback arg
1266+
;;; LocalWords: zsh html tldp http whitelisted

0 commit comments

Comments
 (0)