aboutsummaryrefslogtreecommitdiff
path: root/lisp/hcel-source.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-06 10:21:10 +1000
committerYuchen Pei <hi@ypei.me>2022-09-06 10:21:10 +1000
commit6f522c08939cfbe5f2993a093dd8302aa438fb57 (patch)
treea744feea81e37cbd4d63d03f7ced6d8f23303cc8 /lisp/hcel-source.el
parentde0447a69f58bbb55fd73cdc1e799c8e4705f128 (diff)
showing docs in hcel-ids mode, switch to buffer
Diffstat (limited to 'lisp/hcel-source.el')
-rw-r--r--lisp/hcel-source.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/hcel-source.el b/lisp/hcel-source.el
index c397387..29efab0 100644
--- a/lisp/hcel-source.el
+++ b/lisp/hcel-source.el
@@ -89,6 +89,19 @@ If NO-JUMP is non-nil, just open the source and does not jump to the location wi
'next-error))
buffer))
+(defun hcel-switch-buffer ()
+ (interactive)
+ (switch-to-buffer
+ (read-buffer
+ "Switch to buffer: " nil t
+ (lambda (buffer)
+ (equal
+ (buffer-local-value
+ 'major-mode
+ (get-buffer (if (stringp buffer) buffer (car buffer))))
+ 'hcel-mode)))))
+(define-key hcel-mode-map "b" 'hcel-switch-buffer)
+
(defun hcel-definition-site-at-point ()
"Call definitionSite for identifier at point.
@@ -149,17 +162,13 @@ May cause error if the identifier has exact location."
;; same module
(alist-get 'doc (hcel-lookup-identifier-at-point))
;; other module
- (when-let
- ((definition (ignore-errors (hcel-definition-site-at-point))))
- (alist-get 'documentation definition))
+ (alist-get 'documentation
+ (ignore-errors (hcel-definition-site-at-point)))
;; hoogle
(when-let ((hoogle-docs
(ignore-errors (hcel-hoogle-docs-at-point))))
(when (length> hoogle-docs 0) (concat "Hoogle: " hoogle-docs))))))
- (with-temp-buffer
- (insert docs)
- (shr-render-region (point-min) (point-max))
- (buffer-string))))
+ (hcel-render-html docs)))
;; TODO: multiple expressions
(defun hcel-expressions-type (beg end)