[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate O
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate Open Firmware indentation style |
Date: |
Sat, 29 Jan 2022 08:02:26 -0500 (EST) |
branch: elpa/forth-mode
commit 5502816e37c543f1771404e243575a02d25dd60a
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Helmut Eller <eller.helmut@gmail.com>
Make it easier to emulate Open Firmware indentation style
By setting forth-smie-basic-indent to 3, indentation should look more
like what Mitch Bradley uses in Open Firmware.
* forht-smie.el (forth-smie-basic-indent): Rename from
forth-smie--basic-indent.
(forth-smie--indentation-rules): Indent colon definitions like
begin-structure.
* test/tests.el (forth-indent-colon-definition): Add test for
forth-smie-basic-indent = 3.
---
forth-smie.el | 20 ++++++++++----------
test/tests.el | 8 +++++++-
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/forth-smie.el b/forth-smie.el
index d242ec8035..f008c30f48 100644
--- a/forth-smie.el
+++ b/forth-smie.el
@@ -22,28 +22,28 @@
(":noname" words ";"))
(words)))))
-(defvar forth-smie--basic-indent 2)
+(defvar forth-smie-basic-indent 2)
(unless (fboundp 'pcase)
(defmacro pcase (form &rest forms)
0))
(defun forth-smie--indentation-rules (kind token)
- (pcase (cons kind token)
- (`(:elem . basic) forth-smie--basic-indent)
- (`(:elem . args)
- (cond ((smie-rule-prev-p "begin-structure")
+ (pcase (list kind token)
+ (`(:elem basic) forth-smie-basic-indent)
+ (`(:elem args)
+ (cond ((smie-rule-prev-p ":" "begin-structure")
(- (+ (save-excursion
(forth-smie--backward-token)
(current-column))
- forth-smie--basic-indent)
+ forth-smie-basic-indent)
(current-column)))
(t 0)))
- (`(:after . "begin-structure")
- (* 2 forth-smie--basic-indent))
- (`(:list-intro . "begin-structure")
+ (`(:after ,(or ":" "begin-structure"))
+ (* 2 forth-smie-basic-indent))
+ (`(:list-intro ,(or ":" "begin-structure"))
nil)
- (`(:list-intro . ,_) t)
+ (`(:list-intro ,_) t)
(_ nil)))
(defun forth-smie--forward-token ()
diff --git a/test/tests.el b/test/tests.el
index cb9331b068..893731650f 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -188,7 +188,13 @@ The whitespace before and including \"|\" on each line is
removed."
(forth-should-indent
": foo ( x y -- y x )
| swap
- |;"))
+ |;")
+ ;; Open Firmware style
+ (let ((forth-smie-basic-indent 3))
+ (forth-should-indent
+ ": foo ( x y -- y x )
+ | swap
+ |;")))
(ert-deftest forth-indent-if-then-else ()
(forth-should-indent
- [nongnu] elpa/forth-mode eaeac02b6d 082/153: Disable warning about cl., (continued)
- [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
- [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 <=
- [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
- [nongnu] elpa/forth-mode 5c1c928490 132/153: Make completion case insensitive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 37da497572 144/153: Switch back from interaction mode to source buffer., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 05e8a02796 139/153: Highlight LEAVE, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1f922f41f4 138/153: Declare forth-smie-basic-indent as safe local-variable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 74c0e17c45 122/153: Improve beginning-of-defun, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b40ffb3127 078/153: Fix building with Emacs 23., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1d85344467 113/153: Add commands to browse description in Forth standards, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c5e63e29f1 072/153: Basic indentation of control structures, ELPA Syncer, 2022/01/29