aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/hcel-outline.el1
-rw-r--r--lisp/hcel-results.el32
2 files changed, 22 insertions, 11 deletions
diff --git a/lisp/hcel-outline.el b/lisp/hcel-outline.el
index 3732ed2..b90a464 100644
--- a/lisp/hcel-outline.el
+++ b/lisp/hcel-outline.el
@@ -23,6 +23,7 @@
outline-level (lambda () (1+ (/ (length (match-string 1))
hcel-outline-indentation)))
buffer-read-only t))
+(add-hook 'hcel-outline-mode-hook 'hcel-minor-mode)
(defun hcel ()
(interactive)
diff --git a/lisp/hcel-results.el b/lisp/hcel-results.el
index 2636b41..df1b8ae 100644
--- a/lisp/hcel-results.el
+++ b/lisp/hcel-results.el
@@ -191,20 +191,30 @@ Start by choosing a package."
(plist-get props 'package-id)
(plist-get props 'module-path)
(plist-get props 'internal-id)))
+ ((eq major-mode 'hcel-ids-mode)
+ (hcel-find-references-internal
+ (alist-get 'packageId (plist-get props 'location-info))
+ (alist-get 'modulePath (plist-get props 'location-info))
+ (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)))))
+ (let ((hcel-buffer (hcel-buffer-name package-id module-path)))
+ (when (or (get-buffer hcel-buffer)
+ (and (y-or-n-p "Open module source?")
+ (hcel-load-module-source
+ package-id module-path))))
+ (with-current-buffer hcel-buffer
+ (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."
@@ -212,7 +222,6 @@ Start by choosing a package."
(defcustom hcel-ids-live-per-page 10
"hcel-ids live search results per page."
:group 'hcel-ids)
-
(define-compilation-mode hcel-ids-mode "hcel-ids"
"Major mode for showing identifiers"
(setq-local next-error-function 'hcel-results-next-error
@@ -221,6 +230,7 @@ Start by choosing a package."
hcel-ids-package-id nil
hcel-results-page-number nil
hcel-results-max-page-number nil))
+(add-hook 'hcel-ids-mode-hook 'hcel-minor-mode)
(defun hcel-ids-update ()
(unless (eq major-mode 'hcel-ids-mode)