[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 9440f2a5af 121/153: Add test for comment-dwim
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 9440f2a5af 121/153: Add test for comment-dwim |
Date: |
Sat, 29 Jan 2022 08:02:25 -0500 (EST) |
branch: elpa/forth-mode
commit 9440f2a5af5b8ccd92096592f97c4a1972800a61
Author: Helmut Eller <helmut@msibook>
Commit: Helmut Eller <eller.helmut@gmail.com>
Add test for comment-dwim
That's the command run by M-;.
Not sure what we actually want it to do but the test case is not
entirely unreasonable.
* test/tests.el (forth-comment-dwim): New test.
(forth-paren-comment-font-lock): Changing some of the comment-* variables
also changed the some of font-lock-comment-delimiter-face into
font-lock-comment-face. Odd.
* forth-mode.el (forth-mode): Use a shy group in the
comment-start-skip regexp, as the non-shy group has some special
meaning (I couldn't quite decipher the docstring) and the test case
seems to work fine with shy groups.
Also, use setq-local as the comment-* variables are not permanently local.
---
forth-mode.el | 9 ++++-----
test/tests.el | 22 ++++++++++++++++++----
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/forth-mode.el b/forth-mode.el
index 631849fe95..e46326f9fb 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -136,11 +136,10 @@
(setq-local parse-sexp-lookup-properties t)
(forth-smie-setup)
(setq-local fill-paragraph-function #'forth-fill-paragraph)
- (setq ;; font-lock-defaults
- comment-start-skip "\\((\\*?\\|\\\\\\) *"
- comment-start "("
- comment-end ")"
- imenu-generic-expression
+ (setq-local comment-start-skip "\\(?:(\\*\\|\\\\\\) *")
+ (setq-local comment-start "(")
+ (setq-local comment-end ")")
+ (setq imenu-generic-expression
'(("Words"
"^\\s-*\\(:\\|code\\|defer\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 2)
("Variables"
diff --git a/test/tests.el b/test/tests.el
index 9b20953fe3..555c9b6e6c 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -89,12 +89,12 @@ The whitespace before and including \"|\" on each line is
removed."
(should (= (point) point-after))))))
(ert-deftest forth-paren-comment-font-lock ()
- (forth-assert-face "→( )" font-lock-comment-delimiter-face)
+ (forth-assert-face "→( )" font-lock-comment-face)
(forth-assert-face "→.( )" font-lock-comment-face)
(forth-assert-face "( →)" font-lock-comment-delimiter-face)
- (forth-assert-face " →( )" font-lock-comment-delimiter-face)
- (forth-assert-face "\t→( )" font-lock-comment-delimiter-face)
- (forth-assert-face "→(\t)" font-lock-comment-delimiter-face)
+ (forth-assert-face " →( )" font-lock-comment-face)
+ (forth-assert-face "\t→( )" font-lock-comment-face)
+ (forth-assert-face "→(\t)" font-lock-comment-face)
(forth-assert-face "(fo→o) " nil)
(forth-assert-face "(fo→o)" nil)
(forth-assert-face "(→) " nil)
@@ -257,3 +257,17 @@ The whitespace before and including \"|\" on each line is
removed."
"\\ foo bar baz→
|: frob ( x y -- z ) ;"
#'fill-paragraph))
+
+;; FIXME: maybe insert "( )" instead of "()".
+(ert-deftest forth-comment-dwim ()
+ (forth-should-before/after
+ ": frob
+ | begin ( x y )
+ | swap→
+ | again ;"
+ ": frob
+ | begin ( x y )
+ | swap (→)
+ | again ;"
+ (lambda ()
+ (call-interactively #'comment-dwim))))
- [nongnu] elpa/forth-mode fbd2c51cea 070/153: Initialize pseudo terminal window size, (continued)
- [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, 2022/01/29
- [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 <=
- [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
- [nongnu] elpa/forth-mode f44fa6481f 152/153: Forth 200x core.html is no longer there., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate Open Firmware indentation style, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5076a08abc 057/153: Make C-c C-k work in all Forth modes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 7cbb60f1d7 143/153: Highlight +field and friends, ELPA Syncer, 2022/01/29