aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-06 12:02:00 +1000
committerYuchen Pei <hi@ypei.me>2022-09-06 12:02:00 +1000
commitb85fe78ce35ace46f42c5922773152843810fa5e (patch)
tree2caa1d72b0612beecff5f0749f2c6d133701daa5
parent17059377da7b041d47d7fe6376560ca219a1a03c (diff)
adding hook to enable hcel-minor-mode in eldoc doc buffers
-rw-r--r--lisp/hcel-outline.el1
-rw-r--r--lisp/hcel-source.el20
2 files changed, 15 insertions, 6 deletions
diff --git a/lisp/hcel-outline.el b/lisp/hcel-outline.el
index b90a464..b5ad54a 100644
--- a/lisp/hcel-outline.el
+++ b/lisp/hcel-outline.el
@@ -184,6 +184,7 @@ update in the outline mode too."
(define-minor-mode hcel-outline-follow-mode
"Display modules and identifiers as point moves."
+ :lighter " hcel-outline-follow"
:after-hook
(if hcel-outline-follow-mode
(if (not (eq major-mode 'hcel-outline-mode))
diff --git a/lisp/hcel-source.el b/lisp/hcel-source.el
index 783436b..b52393e 100644
--- a/lisp/hcel-source.el
+++ b/lisp/hcel-source.el
@@ -208,12 +208,16 @@ May cause error if the identifier has exact location."
(hcel-type-at-point)))
(funcall cb docstring
:thing symbol
- :face 'font-lock-variable-name-face)))
+ :face 'font-lock-variable-name-face)
+ (with-current-buffer eldoc--doc-buffer
+ (hcel-minor-mode))))
(defun hcel-eldoc-docs (cb)
(when-let ((docstring (hcel-id-docs-at-point)))
(setq this-command nil)
- (funcall cb docstring)))
+ (funcall cb docstring)
+ (with-current-buffer eldoc--doc-buffer
+ (hcel-minor-mode))))
(defun hcel-eldoc-expression-type (cb)
(when mark-active
@@ -223,7 +227,9 @@ May cause error if the identifier has exact location."
(setq this-command nil)
(funcall cb (cdr expr-and-type)
:thing (car expr-and-type)
- :face 'font-lock-variable-name-face))))
+ :face 'font-lock-variable-name-face)
+ (with-current-buffer eldoc--doc-buffer
+ (hcel-minor-mode)))))
;; highlight
(defface hcel-highlight-id '((t (:inherit underline)))
@@ -367,7 +373,7 @@ May cause error if the identifier has exact location."
;; hcel-minor mode
(defvar hcel-minor-major-modes
- '(hcel-outline-mode hcel-ids-mode eldoc-mode)
+ '(hcel-outline-mode hcel-ids-mode)
"Major modes where hcel-minor mode can live in.")
(defvar hcel-minor-mode-map
@@ -377,10 +383,12 @@ May cause error if the identifier has exact location."
(define-minor-mode hcel-minor-mode
"A minor mode for exploring haskell codebases."
+ :lighter " hcel-minor"
:after-hook
(if hcel-minor-mode
- (if (not (memq major-mode hcel-minor-major-modes))
- (error "Not in one of the following modes: %s"
+ (if (and (not (memq major-mode hcel-minor-major-modes))
+ (not (eq (current-buffer) eldoc--doc-buffer)))
+ (error "Not in one of the supported modes (%s) or the eldoc buffer."
(string-join (mapcar 'prin1-to-string hcel-minor-major-modes)
", ")))))