[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 157c14b18e 092/153: Include tab (\t) as whitesp
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 157c14b18e 092/153: Include tab (\t) as whitespace delimiter for comments. |
Date: |
Sat, 29 Jan 2022 08:02:21 -0500 (EST) |
branch: elpa/forth-mode
commit 157c14b18ef3afd8bb1494af7c5c5c44ccf3f941
Author: Helmut Eller <helmut@msibook>
Commit: Lars Brinkhoff <lars@nocrew.org>
Include tab (\t) as whitespace delimiter for comments.
* test/tests.el (forth-backslash-comment-font-lock)
(forth-paren-comment-font-lock): New tests.
* forth-mode.el (forth--syntax-propertize): Handle the new test cases.
---
forth-mode.el | 8 +++++---
test/tests.el | 30 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/forth-mode.el b/forth-mode.el
index db8da1756d..dfab314b24 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -87,14 +87,16 @@
(not (forth--ppss-in-comment-p (1- (point)))))
(cond ((save-excursion
(goto-char (1- (point)))
- (not (looking-at "\\([ \n]\\|\\\`\\)\\((\\|\\\\\\)[ \n]")))
+ (not (looking-at
+ "\\([ \n\t]\\|\\\`\\)\\((\\|\\\\\\)[ \n\t]")))
(put-text-property (point) (forth-symbol-end)
'syntax-table (string-to-syntax "_")))
((and (looking-at "(")
(re-search-forward ")" nil t))
- (put-text-property (point) (1+ (point))
+ (put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "!")))))
- (forward-char))))
+ (unless (eobp)
+ (forward-char)))))
(defun forth-expand-symbol ()
(let ((list (forth-words)))
diff --git a/test/tests.el b/test/tests.el
index 6ceceaf1ea..4ef212b9fb 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -15,3 +15,33 @@
(should (eq major-mode 'forth-mode))
(should (and (boundp 'forth-block-mode) forth-block-mode))
(kill-buffer))
+
+(defmacro forth-with-temp-buffer (contents &rest body)
+ (declare (indent 1) (debug t))
+ `(with-temp-buffer
+ (insert ,contents)
+ (forth-mode)
+ ,@body))
+
+(defun forth-assert-face (content pos face)
+ (forth-with-temp-buffer content
+ (font-lock-fontify-buffer)
+ (should (eq face (get-text-property pos 'face)))))
+
+(ert-deftest forth-paren-comment-font-lock ()
+ (forth-assert-face "( )" 1 font-lock-comment-delimiter-face)
+ (forth-assert-face ".( )" 1 nil)
+ (forth-assert-face "( )" 3 font-lock-comment-delimiter-face)
+ (forth-assert-face " ( )" 2 font-lock-comment-delimiter-face)
+ (forth-assert-face "\t( )" 2 font-lock-comment-delimiter-face)
+ (forth-assert-face "(\t)" 1 font-lock-comment-delimiter-face)
+ (forth-assert-face "(foo) " 3 nil)
+ (forth-assert-face "( foo) " 3 font-lock-comment-face)
+ (forth-assert-face "( a b --
+ x y )" 1 font-lock-comment-delimiter-face))
+
+(ert-deftest forth-backslash-comment-font-lock ()
+ (forth-assert-face "\\ " 1 font-lock-comment-delimiter-face)
+ (forth-assert-face " \\ " 2 font-lock-comment-delimiter-face)
+ (forth-assert-face "\t\\ " 2 font-lock-comment-delimiter-face)
+ (forth-assert-face "a\\b " 2 nil))
- [nongnu] elpa/forth-mode 2d30ca8eaa 142/153: Use add-to-list in installation instructions instead of pushnew., (continued)
- [nongnu] elpa/forth-mode 2d30ca8eaa 142/153: Use add-to-list in installation instructions instead of pushnew., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 8c0e519c57 148/153: Add restart-forth to source window menu, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5e99586c1e 065/153: Remove prompt from Forth output., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6bc035fd90 040/153: Fix missing argument to define-key., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode fbd2c51cea 070/153: Initialize pseudo terminal window size, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 38f0ccbfc8 027/153: Rename to run-forth, forth-ensure, and forth-parse.el., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ccb14b4a47 136/153: Indentation rule for :noname, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d711fd5200 130/153: Remove tabs in wercker.yml, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode dd450e6a01 120/153: Remove debugging code, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b3c1e62e5a 151/153: The Emacs 25 package can't coexist with Emacs-snapshot., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 157c14b18e 092/153: Include tab (\t) as whitespace delimiter for comments.,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 93c90ebf97 129/153: Install gforth in wercker, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode eaeac02b6d 082/153: Disable warning about cl., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 3ef42c825a 101/153: Emacs 23: indenting doesn't work well., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9440f2a5af 121/153: Add test for comment-dwim, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 66f7a2dc97 060/153: Add tests for various Forth block and non-block files., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 3fa933d556 123/153: Test comment-region, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 17e58ab993 102/153: Test with Emacs snapshot., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 885407ebc5 047/153: Automated build., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9f9b5cdf86 089/153: Don't send output as input, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2e65a80a3b 110/153: Fontify buffer before testing word movement commands., ELPA Syncer, 2022/01/29