aboutsummaryrefslogtreecommitdiff
path: root/lisp/hcel-results.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/hcel-results.el')
-rw-r--r--lisp/hcel-results.el31
1 files changed, 24 insertions, 7 deletions
diff --git a/lisp/hcel-results.el b/lisp/hcel-results.el
index 63f3c91..2636b41 100644
--- a/lisp/hcel-results.el
+++ b/lisp/hcel-results.el
@@ -179,15 +179,32 @@ Start by choosing a package."
(defun hcel-find-references-at-point ()
"Find references of the identifier at point."
(interactive)
- (when-let ((id (alist-get 'externalId (hcel-lookup-identifier-at-point)))
- (buffer-name (hcel-refs-format-id id)))
- (with-current-buffer (get-buffer-create buffer-name)
- (hcel-refs-mode)
- (setq hcel-refs-id id)
- (hcel-refs-update-references-package)
- (switch-to-buffer-other-window buffer-name))))
+ (hcel-find-references-internal hcel-package-id hcel-module-path
+ (get-text-property (point) 'identifier)))
(define-key hcel-mode-map (kbd "M-?") 'hcel-find-references-at-point)
+(defun hcel-minor-find-references-at-point ()
+ (interactive)
+ (let ((props (text-properties-at (point))))
+ (cond ((eq major-mode 'hcel-outline-mode)
+ (hcel-find-references-internal
+ (plist-get props 'package-id)
+ (plist-get props 'module-path)
+ (plist-get props 'internal-id)))
+ (t (error "%S not supported!" major-mode)))))
+
+(defun hcel-find-references-internal (package-id module-path identifier)
+ (when (and package-id module-path identifier)
+ (with-current-buffer (hcel-buffer-name package-id module-path)
+ (when-let* ((id (alist-get
+ 'externalId
+ (alist-get (intern identifier) hcel-identifiers)))
+ (buffer-name (hcel-refs-format-id id)))
+ (with-current-buffer (get-buffer-create buffer-name)
+ (hcel-refs-mode)
+ (setq hcel-refs-id id)
+ (hcel-refs-update-references-package))
+ (switch-to-buffer-other-window buffer-name)))))
;; hcel-ids-mode
(defcustom hcel-ids-per-page 20
"hcel-ids mode number of results per page."