[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode e2e3490 382/385: hide-show supports BOILE
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode e2e3490 382/385: hide-show supports BOILERPLATE START ... BOILERPLATE END |
Date: |
Wed, 6 Oct 2021 00:00:09 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit e2e3490a0bc4d14c96b3bac4cea35a37e774065a
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
hide-show supports BOILERPLATE START ... BOILERPLATE END
---
haskell-tng-extra.el | 17 +++++++++++++++++
haskell-tng-mode.el | 20 ++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/haskell-tng-extra.el b/haskell-tng-extra.el
index 4789b04..baa28bc 100644
--- a/haskell-tng-extra.el
+++ b/haskell-tng-extra.el
@@ -19,6 +19,7 @@
;; hook in both `before-save-hook' (detecting that the file is new) and
;; `after-save-hook' (running the command and resetting the newfile var).
+(require 'hideshow)
(require 'subr-x)
(require 'haskell-tng-util)
@@ -117,6 +118,22 @@ When in a comment and called with a prefix, the comment
will be completed."
'haskell-tng-stack2cabal))))
;;;###autoload
+(defvar-local haskell-tng-boilerplate nil
+ "A cache of the `boilerplate' binary as seen from this buffer.")
+(defun haskell-tng-boilerplate ()
+ "Apply `boilerplate' expansion rules."
+ (interactive)
+ (when (buffer-modified-p)
+ (save-buffer))
+ (when (= 0 (call-process
+ (haskell-tng--util-cached-variable
+ (lambda () (haskell-tng--util-which "boilerplate"))
+ 'haskell-tng-boilerplate)
+ nil "*boilerplate*" nil "-i" buffer-file-name))
+ (revert-buffer t t t)
+ (hs-hide-all)))
+
+;;;###autoload
(defun haskell-tng-goto-imports ()
"Hack to jump to imports"
;; TODO is this useful?
diff --git a/haskell-tng-mode.el b/haskell-tng-mode.el
index d53abfc..60a584c 100644
--- a/haskell-tng-mode.el
+++ b/haskell-tng-mode.el
@@ -15,6 +15,7 @@
;;; Code:
(require 'dabbrev)
+(require 'hideshow)
(require 'imenu)
(require 'rx)
@@ -90,12 +91,31 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'."
(haskell-tng--smie-setup)
(prettify-symbols-mode 1)
+ (hs-minor-mode 1)
+
+ (setq-local hs-hide-comments-when-hiding-all nil)
+ (unless noninteractive
+ (let ((inhibit-message t))
+ (hs-hide-all)))
)
;;;###autoload
(progn
(add-to-list 'auto-mode-alist `(,(rx ".hs" eos) . haskell-tng-mode))
+ (add-to-list 'hs-special-modes-alist
+ '(haskell-tng-mode
+ "{- BOILERPLATE START -}"
+ "{- BOILERPLATE END -}"
+ "-- "
+ haskell-tng--hs-forward))
(modify-coding-system-alist 'file (rx ".hs" eos) 'utf-8))
+(defun haskell-tng--hs-forward (&optional _arg _interactive)
+ "hide-show forward function that does what you'd expect"
+ (goto-char
+ (save-excursion
+ (re-search-forward hs-block-end-regexp nil t)
+ (point))))
+
(provide 'haskell-tng-mode)
;;; haskell-tng-mode.el ends here
- [nongnu] elpa/haskell-tng-mode 611711a 208/385: address melpa review, (continued)
- [nongnu] elpa/haskell-tng-mode 611711a 208/385: address melpa review, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 89c5c80 223/385: improve smartparens workaround, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e270647 228/385: more robust calls to hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ad5967b 236/385: simpler installation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 599d4f0 283/385: import symbol at point, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9b334f7 275/385: ghcflags, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f221f95 173/385: introduce types and constraints to the grammar, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ae1d399 268/385: backslashes are only keywords when used in lambdas, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1d74d5f 279/385: backslash bughunting, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 499c77f 261/385: abbrev-mode support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e2e3490 382/385: hide-show supports BOILERPLATE START ... BOILERPLATE END,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode a34e796 368/385: improve debugging, ELPA Syncer, 2021/10/06