Skip to content

Commit 1dd661e

Browse files
committed
Fix testing in Github CI. Simplify compilation and testing process.
Remove Cask and its dependencies for now, and simplify the compilation/testing process. Make compile byte-compiles all files, make test runs ERT tests. Fix various imports and warnings.
1 parent 90bfd6d commit 1dd661e

File tree

11 files changed

+39
-120
lines changed

11 files changed

+39
-120
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ jobs:
2828
version: ${{ matrix.emacs_version }}
2929
- uses: conao3/setup-cask@master
3030

31+
- name: Install Gnuplot
32+
run: sudo apt update && sudo apt install gnuplot
33+
3134
- name: Run tests
3235
if: matrix.allow_failure != true
33-
run: 'cask && cask build && cask exec buttercup -L .'
36+
run: 'make && make test'
3437

3538
- name: Run tests (allow failure)
3639
if: matrix.allow_failure == true
37-
run: 'cask && cask build && cask exec buttercup -L . || true'
40+
run: 'make && make test || true'

Cask

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,21 @@
1-
# -*- mode: makefile -*-
2-
31
EMACS ?= emacs
42

5-
## You will probably not need to change anything below this line
6-
7-
BYTE = $(EMACS) -batch -q -no-site-file -l dot.el -f batch-byte-compile
8-
9-
.PHONY: all default clean pdf ps
10-
11-
default: gnuplot.elc gnuplot-gui.elc gnuplot-context.elc
12-
13-
pdf: gpelcard.pdf
14-
15-
ps: gpelcard.ps
16-
17-
all: gnuplot.elc gnuplot-gui.elc gnuplot-context.elc gpelcard.pdf gpelcard.ps
18-
19-
%.elc: %.el
20-
$(BYTE) "$<"
3+
LOAD = -l gnuplot \
4+
-l gnuplot-context \
5+
-l gnuplot-debug-context \
6+
-l gnuplot-gui \
7+
-l gnuplot-tests \
8+
-l gnuplot-test-context
219

22-
test: gnuplot.elc gnuplot-context.elc gnuplot-tests.elc gnuplot-test-context.elc
23-
$(EMACS) --batch -L . \
24-
--load=gnuplot-tests \
25-
--load=gnuplot-test-context \
26-
--eval='(ert-run-tests-batch "^gnuplot-")'
10+
.PHONY: all default clean
2711

28-
gpelcard.ps: gpelcard.dvi
29-
dvips -o gpelcard.ps gpelcard.dvi
12+
default: compile
3013

31-
gpelcard.pdf: gpelcard.tex
32-
pdflatex gpelcard.tex
14+
test:
15+
$(EMACS) -batch -L . $(LOAD) -f ert-run-tests-batch-and-exit
3316

34-
gpelcard.dvi: gpelcard.tex
35-
latex gpelcard.tex
17+
compile:
18+
$(EMACS) -batch -L . -f batch-byte-compile *.el
3619

3720
clean:
38-
rm -f *.elc gpelcard.dvi gpelcard.log gpelcard.aux
21+
rm -f *.elc

dot.el

Lines changed: 0 additions & 8 deletions
This file was deleted.

gnuplot-context.el

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,11 @@
230230

231231
;;; Code:
232232

233-
234-
;; Library dependencies
235-
(eval-when-compile
236-
(require 'cl-lib)
237-
238-
;; Prevent compiler warnings about undefined functions
239-
(require 'gnuplot))
240-
241-
;; We need ElDoc support
233+
(require 'cl-lib)
234+
(require 'gnuplot)
242235
(require 'eldoc)
243-
244-
;; Compatibility for Emacs version < 23
245-
(eval-when-compile
246-
(when (not (fboundp 'string-match-p))
247-
(defmacro string-match-p (&rest args)
248-
`(save-match-data (string-match ,@args)))))
236+
(require 'info)
237+
(require 'info-look)
249238

250239

251240
;;;; The tokenizer.
@@ -498,7 +487,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME."
498487

499488
(t ; two patterns
500489
(let* ((pat1 (cadr pat))
501-
(pat2 (caddr pat))
490+
(pat2 (cl-caddr pat))
502491
(pat1-c (gnuplot-compile-pattern pat1))
503492
(pat2-c (gnuplot-compile-pattern pat2))
504493
(pat1-l (length pat1-c))
@@ -536,7 +525,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME."
536525
;; Syntactic sugar for delimited lists
537526
((delimited-list)
538527
(let* ((item (cadr pat))
539-
(sep (caddr pat)))
528+
(sep (cl-caddr pat)))
540529
(gnuplot-compile-pattern
541530
`(sequence ,item (many (sequence ,sep ,item))))))
542531

@@ -1827,7 +1816,7 @@ there."
18271816
;; (literal LITERAL NO-COMPLETE)
18281817
((literal)
18291818
(let ((expect (cadr inst))
1830-
(no-complete (caddr inst)))
1819+
(no-complete (cl-caddr inst)))
18311820
(cond (end-of-tokens
18321821
(unless no-complete
18331822
(gnuplot-trace "\tpushing \"%s\" to completions\n" expect)
@@ -1852,7 +1841,7 @@ there."
18521841
;; regexp-matches REGEXP, use NAME for completions
18531842
((keyword)
18541843
(let ((regexp (cadr inst))
1855-
(name (caddr inst)))
1844+
(name (cl-caddr inst)))
18561845
(cond (end-of-tokens
18571846
(gnuplot-trace "\tpushing \"%s\" to completions\n" name)
18581847
(push name gnuplot-completions)
@@ -1929,7 +1918,7 @@ there."
19291918
;; onto the stack
19301919
((push)
19311920
(let* ((type (cadr inst))
1932-
(value (caddr inst)))
1921+
(value (cl-caddr inst)))
19331922
(push `(,type ,value ,tokens) stack)))
19341923

19351924
;; (pop TYPE): pop something off the stack
@@ -1953,7 +1942,7 @@ there."
19531942
(record (assoc name gnuplot-captures)))
19541943
(if (not record)
19551944
(error "Gnuplot-match-tokens: no open capture group named %s" name)
1956-
(setf (caddr record) tokens)
1945+
(setf (cl-caddr record) tokens)
19571946
(gnuplot-debug (gnuplot-dump-captures)))))
19581947

19591948
;; (check-progress): make sure not stuck in an infinite loop
@@ -2003,7 +1992,7 @@ there."
20031992
(not (and gnuplot-info-at-point gnuplot-eldoc)))
20041993
(let* ((item (car stack))
20051994
(type (car item))
2006-
(position (caddr item))) ; must progress by at least one token
1995+
(position (cl-caddr item))) ; must progress by at least one token
20071996
(if (and (memq type '(info eldoc no-scan))
20081997
(not (eq position tokens)))
20091998
(cl-case type
@@ -2041,7 +2030,7 @@ there."
20412030
(let ((record (assoc name gnuplot-captures)))
20422031
(if (not record) nil
20432032
(let ((begin (cadr record))
2044-
(end (caddr record))
2033+
(end (cl-caddr record))
20452034
(accum '()))
20462035
(while (and begin (not (eq begin end)))
20472036
(push (pop begin) accum))

gnuplot-debug-context.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
;; debugging utilities for the gnuplot-mode context matcher
33
;;
44

5-
(require 'gnuplot-test-context) ; for gnuplot-simplify-tokens
5+
(require 'gnuplot-test-context) ; for gnuplot-simplify-tokens
66

77
(defun gnuplot-unload ()
88
(interactive)
@@ -65,15 +65,15 @@
6565
(if (eq (car x) 'return)
6666
x
6767
(list (car x) (cadr x)
68-
(gnuplot-simplify-tokens (caddr x)))))))
68+
(gnuplot-simplify-tokens (cl-caddr x)))))))
6969
(insert "-- end backtrace --\n"))))
7070

7171
(defun gnuplot-dump-backtrack (backtrack)
7272
(if backtrack
7373
(with-gnuplot-trace-buffer
7474
(insert "\n-- * backtrack records: * --\n")
7575
(dolist (x backtrack)
76-
(insert (format "%s\t%s\n" (caddr x) (gnuplot-simplify-tokens (cadr x)))))
76+
(insert (format "%s\t%s\n" (cl-caddr x) (gnuplot-simplify-tokens (cadr x)))))
7777
(insert "-- end backtrack records --\n\n"))))
7878

7979
(defun gnuplot-dump-progress (progress)

gnuplot-gui.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,8 +1110,8 @@ arguments."
11101110
(if (and (string= prefix (car temp-list))
11111111
(string-match "^[-0-9.]+$" (cadr temp-list)))
11121112
(let ((this-car (cadr temp-list))
1113-
(this-cdr (if (string-match "^[-0-9.]+$" (caddr temp-list))
1114-
(caddr temp-list) "")))
1113+
(this-cdr (if (string-match "^[-0-9.]+$" (cl-caddr temp-list))
1114+
(cl-caddr temp-list) "")))
11151115
(setq this-cons (cons tag (cons this-car this-cdr))
11161116
temp-list nil))
11171117
(setq temp-list (cdr temp-list))))

gnuplot-test-context.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
(defun gnuplot-simplify-tokens (tokens)
3333
(mapcar
3434
(lambda (token)
35-
(case (gnuplot-token-type token)
35+
(cl-case (gnuplot-token-type token)
3636
(number
3737
(string-to-number (gnuplot-token-id token)))
3838

gnuplot-tests.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
;;; Currently these attempt to cover the correct identification of
44
;;; string and comment syntax.
55

6-
(require 'gnuplot)
76
(require 'ert)
8-
(eval-when-compile (require 'cl-lib))
7+
(require 'cl-lib)
98

109
;; Hide an annoying interactive message during batch testing
1110
(when (require 'nadvice nil t)

gnuplot.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ updates Gnuplot with the appropriate 'set output' command."
17771777
(when (and size (> size 0))
17781778
(gnuplot-send-hiding-output "set output\n") ; Flush output file
17791779
(sit-for 0.1) ; Hack: wait for Gnuplot IO to finish
1780-
(ecase gnuplot-inline-image-mode
1780+
(cl-ecase gnuplot-inline-image-mode
17811781
(nil nil)
17821782
(inline
17831783
(ignore-errors
@@ -2324,7 +2324,7 @@ the height of the frame.
23242324
23252325
The *info* buffer should already exist when this function is
23262326
called."
2327-
(case gnuplot-info-display
2327+
(cl-case gnuplot-info-display
23282328
(window
23292329
(switch-to-buffer-other-window "*info*")
23302330
;; Adjust window height only if the frame is split

0 commit comments

Comments
 (0)