[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode f3d76c12c1 125/153: Test completion-at-point
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode f3d76c12c1 125/153: Test completion-at-point |
Date: |
Sat, 29 Jan 2022 08:02:25 -0500 (EST) |
branch: elpa/forth-mode
commit f3d76c12c180f98b5cbb73aba0f93bc8d04c9f04
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Helmut Eller <eller.helmut@gmail.com>
Test completion-at-point
.travis.yml: Install pforth Using pForth as that is less likely
to create conflicts with gforth.el.
* test/tests.el (forth-completion-at-point): New test.
(forth-with-pforth): New helper.
* forth-mode.el (forth-symbol-start, forth-symbol-end): Don't break
at beginning/end of buffer.
(forth-interaction-sentinel): Can't use comint-output-filter with
killed processes.
* forth-syntax.el (forth-syntax-whitespace): Renamed from
forth-syntax--whitespace
(forth-syntax-non-whitespace): Idem.
---
.travis.yml | 2 +-
forth-interaction-mode.el | 6 +++++-
forth-mode.el | 8 ++++----
forth-syntax.el | 8 ++++----
test/tests.el | 23 +++++++++++++++++++++++
5 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 955735c36f..9337a8837b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ env:
install:
- sudo add-apt-repository -y ppa:ubuntu-elisp
- sudo apt-get update -y
- - sudo apt-get install emacs23 emacs24 emacs-snapshot
+ - sudo apt-get install emacs23 emacs24 emacs-snapshot pforth
script: make EMACS=$EMACS
notifications:
email: lars@nocrew.org
diff --git a/forth-interaction-mode.el b/forth-interaction-mode.el
index 1368e1c96c..9c5373d258 100644
--- a/forth-interaction-mode.el
+++ b/forth-interaction-mode.el
@@ -59,7 +59,11 @@
(defun forth-interaction-sentinel (proc arg)
(message "Forth: %s" arg)
- (comint-output-filter proc (format "\nForth: %s\n" arg)))
+ ;;FIXME: Can't do this because it calls process-mark, which
+ ;; errors out in killed processes. Still, would be nice to see
+ ;; something in the *forth* buffer.
+ ;;(comint-output-filter proc (format "\nForth: %s\n" arg))
+ )
(defvar forth-executable nil)
diff --git a/forth-mode.el b/forth-mode.el
index 9b014c54e1..11e02e18ab 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -65,13 +65,13 @@
(defun forth-symbol-start ()
(save-excursion
- (re-search-backward "[^[:graph:]]")
- (1+ (point))))
+ (skip-chars-backward forth-syntax-non-whitespace)
+ (point)))
(defun forth-symbol-end ()
(save-excursion
- (re-search-forward "[^[:graph:]]")
- (1- (point))))
+ (skip-chars-forward forth-syntax-non-whitespace)
+ (point)))
(defun forth-word-at-point ()
(buffer-substring (forth-symbol-start) (forth-symbol-end)))
diff --git a/forth-syntax.el b/forth-syntax.el
index f77ca819dc..11f4156d8e 100644
--- a/forth-syntax.el
+++ b/forth-syntax.el
@@ -8,15 +8,15 @@
;;; Helpers
-(defvar forth-syntax--whitespace " \t\n\f\r")
-(defvar forth-syntax--non-whitespace (concat "^" forth-syntax--whitespace))
+(defvar forth-syntax-whitespace " \t\n\f\r")
+(defvar forth-syntax-non-whitespace (concat "^" forth-syntax-whitespace))
;; Skip forward over whitespace and the following word. Return the
;; start position of the word.
(defun forth-syntax--skip-word ()
- (skip-chars-forward forth-syntax--whitespace)
+ (skip-chars-forward forth-syntax-whitespace)
(let ((start (point)))
- (skip-chars-forward forth-syntax--non-whitespace)
+ (skip-chars-forward forth-syntax-non-whitespace)
start))
;; Return the whitespace-delimited word at position POS.
diff --git a/test/tests.el b/test/tests.el
index b954667bcd..0f8bb26427 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -88,6 +88,7 @@ The whitespace before and including \"|\" on each line is
removed."
(should (string= after (substring-no-properties (buffer-string))))
(should (= (point) point-after))))))
+
(defun forth-should-region-before/after (before after fun)
(destructuring-bind (before start1 end1) (forth-strip-|-and-¹² before)
(destructuring-bind (after point-after) (forth-strip-|-and-→ after)
@@ -99,6 +100,21 @@ The whitespace before and including \"|\" on each line is
removed."
(should (string= after (substring-no-properties (buffer-string))))
(should (= (point) point-after))))))
+(defmacro forth-with-gforth (&rest body)
+ (declare (indent 0))
+ `(let* ((proc (get-buffer-process forth-interaction-buffer)))
+ ;; FIXME: there should be a better way to do this. Probably a
+ ;; callback function.
+ (while (not (processp proc))
+ (run-forth)
+ (message "Waiting for pforth to start ...")
+ (accept-process-output nil 0.3)
+ (setq proc (get-buffer-process forth-interaction-buffer)))
+ (unwind-protect
+ (progn . ,body)
+ (kill-process proc))))
+>>>>>>> Test completion-at-point
+
(ert-deftest forth-paren-comment-font-lock ()
(forth-assert-face "→( )" font-lock-comment-delimiter-face)
(forth-assert-face "→.( )" font-lock-comment-face)
@@ -327,3 +343,10 @@ The whitespace before and including \"|\" on each line is
removed."
|→"
(lambda ()
(call-interactively #'comment-dwim))))
+
+(ert-deftest forth-completion-at-point ()
+ (forth-with-forth
+ (forth-should-before/after
+ "2C→"
+ "2Constant→"
+ #'completion-at-point)))
- [nongnu] elpa/forth-mode c8103312c3 041/153: Fix typo., (continued)
- [nongnu] elpa/forth-mode c8103312c3 041/153: Fix typo., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b83ff1274b 054/153: Type C-c C-s to SEE a word., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2f5d87f3c5 126/153: No 64-bit build for pForth in Ubuntu. Try Gforth., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2813a7bf3d 090/153: Introduce a hook to initialize backends, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c64035c209 073/153: Add backends for Forth implementations., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d1498037a2 107/153: Add simple tests for forward-sexp, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 83a62c82c4 030/153: Move all package metadata to forth-mode.el., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 186bae4853 083/153: Fix set-process-window-size parameter order., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 48bcf41d63 058/153: Cache words from interactive Forth., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode f418b9aac2 087/153: Set process coding system for SwiftForth., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode f3d76c12c1 125/153: Test completion-at-point,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 4dc1ff0f3b 086/153: Include backend files in make dependencies., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2779ca61ab 075/153: Improve building of backend files., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 71016700dc 095/153: Emacs 23: use cl library instead of cl-lib., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 715d813c83 062/153: Clean up tests., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e35317f2f7 093/153: Improve syntax-propertize function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 76e3885c0b 150/153: Remove obsolete Wercker CI build., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 443193e02f 071/153: Auto-detect Forth implementation., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode a7a5d4ba05 137/153: Use defcustom to define forth-smie-basic-indent, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 522256d98d 145/153: Adding support for ?of, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 08d891c907 026/153: Use LOCAL argument to add-hook., ELPA Syncer, 2022/01/29