[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode ac55d33 134/385: interactive SMIE debuggi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode ac55d33 134/385: interactive SMIE debugging |
Date: |
Tue, 5 Oct 2021 23:59:16 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit ac55d33005c4e4c126d91aff4845030eb7fb376b
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
interactive SMIE debugging
---
haskell-tng-smie.el | 26 ++++++++++++++++++++++++--
test/haskell-tng-indent-test.el | 4 +++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index ce9dde1..0d10bc3 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -85,10 +85,32 @@
)))
+(defvar haskell-tng-smie:debug nil)
+(defun haskell-tng-smie:debug (command)
+ "An alternative to RETURN that outputs SMIE debugging
+information, to aid in the creation of new rules."
+ (let ((output " *haskell-tng-smie*"))
+ (when (get-buffer output)
+ (kill-buffer output))
+ (let ((haskell-tng-smie:debug (get-buffer-create output))
+ (inhibit-read-only t))
+ (with-current-buffer haskell-tng-smie:debug
+ (read-only-mode 1))
+ (call-interactively command)
+ (display-buffer output))))
+(defun haskell-tng-smie:debug-newline ()
+ (interactive)
+ (haskell-tng-smie:debug #'newline-and-indent))
+(defun haskell-tng-smie:debug-tab ()
+ (interactive)
+ (haskell-tng-smie:debug #'indent-for-tab-command))
+
;;
https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#SMIE-Indentation
(defun haskell-tng-smie:rules (method arg)
;; see docs for `smie-rules-function'
- ;; (message "INDENT %S %S" method arg)
+ (when haskell-tng-smie:debug
+ (with-current-buffer haskell-tng-smie:debug
+ (insert (format "INDENT %S %S\n" method arg))))
(pcase method
(:elem
(pcase arg
@@ -104,7 +126,7 @@
(if (smie-rule-parent-p "module")
'(column . 0)
smie-indent-basic))
- ((or "::" "=" "let" "do" "of")
+ ((or "::" "=" "let" "do" "of" "{")
smie-indent-basic)
))
diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el
index f1e62f5..d8d6d14 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -19,7 +19,7 @@
;; 2. newline-and-indent with the rest of the file intact (insert)
;; 3. indent-line-function at the beginning of each line (re-indent)
;;
- ;; each with alternative indentation suggestions.
+ ;; each maybe with alternative indentation suggestions.
;;
;; Expectations could use lines of symbols such as | and . or digits to
;; indicate where the indentation(s) go.
@@ -30,6 +30,8 @@
(should (have-expected-newline-indent-insert (testdata "src/medley.hs")))
;; TODO more tests
;;
https://raw.githubusercontent.com/kadena-io/chainweb-node/master/test/Chainweb/Test/TreeDB.hs
+
+ ;; FIXME type 3 tests without alternatives
)
;; TODO enable this test and get it passing, which requires a TAB command that
- [nongnu] elpa/haskell-tng-mode 4e1f51c 170/385: indent is deriving aware, (continued)
- [nongnu] elpa/haskell-tng-mode 4e1f51c 170/385: indent is deriving aware, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3ddafce 181/385: disambiguate -> during lexing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6b4dca0 189/385: note other build tools, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cc657a8 197/385: support type alignment options, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a7098e8 194/385: stylish haskell outputs failures, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 21fe2a0 221/385: fix broken test assertions, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 907255e 026/385: some namespacing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e7eaa38 077/385: some ideas for cabal, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ddd0706 108/385: suggest next line indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 7a8f714 139/385: indent back to the same level of `do', ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ac55d33 134/385: interactive SMIE debugging,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 6ade588 195/385: key bindings in compilation mode, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 144cabf 202/385: fix test assertions, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 04ebec6 204/385: third party integrations, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode aa9bbb7 216/385: add (broken) test coverage for consyms, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5f423b9 100/385: some alts in the indentation test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 50b53d3 114/385: tng compilation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 36ece6d 117/385: low hanging fruit, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 489e4c9 124/385: document explicit export fontification bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 91a1d08 136/385: creating small scenarios for indentation specs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ec39a64 133/385: improvements to indentation alts and compilation info, ELPA Syncer, 2021/10/06