aboutsummaryrefslogtreecommitdiff
path: root/lisp/hcel-source.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-06 11:21:51 +1000
committerYuchen Pei <hi@ypei.me>2022-09-06 11:21:51 +1000
commit0f77cab1b303bd23e84a48952834d7d607c089bd (patch)
treeeae3419555fd92a12e14d3fc9f92267d9e1b4e77 /lisp/hcel-source.el
parent6f522c08939cfbe5f2993a093dd8302aa438fb57 (diff)
Adding hcel minor mode and find references in outline mode
Diffstat (limited to 'lisp/hcel-source.el')
-rw-r--r--lisp/hcel-source.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/hcel-source.el b/lisp/hcel-source.el
index 29efab0..783436b 100644
--- a/lisp/hcel-source.el
+++ b/lisp/hcel-source.el
@@ -365,4 +365,23 @@ May cause error if the identifier has exact location."
(t
(error "unimplemented: %s" (hcel-location-tag location-info)))))))
+;; hcel-minor mode
+(defvar hcel-minor-major-modes
+ '(hcel-outline-mode hcel-ids-mode eldoc-mode)
+ "Major modes where hcel-minor mode can live in.")
+
+(defvar hcel-minor-mode-map
+ (let ((kmap (make-sparse-keymap)))
+ (define-key kmap (kbd "M-?") 'hcel-minor-find-references-at-point)
+ kmap))
+
+(define-minor-mode hcel-minor-mode
+ "A minor mode for exploring haskell codebases."
+ :after-hook
+ (if hcel-minor-mode
+ (if (not (memq major-mode hcel-minor-major-modes))
+ (error "Not in one of the following modes: %s"
+ (string-join (mapcar 'prin1-to-string hcel-minor-major-modes)
+ ", ")))))
+
(provide 'hcel-source)