diff options
| -rw-r--r-- | hcel-results.el | 18 | ||||
| -rw-r--r-- | hcel-source.el | 7 | ||||
| -rw-r--r-- | hcel-utils.el | 10 | 
3 files changed, 17 insertions, 18 deletions
| diff --git a/hcel-results.el b/hcel-results.el index da0335e..75b35a0 100644 --- a/hcel-results.el +++ b/hcel-results.el @@ -269,11 +269,12 @@ Start by choosing a package."      (mapc       (lambda (result)         (insert "--\n") -       (insert (hcel-ids-render-result result))) +       (insert (hcel-ids-render-result result +                                       'hcel-tag-span-button-load-source)))       (alist-get 'json results))      (goto-char (point-min)))) -(defun hcel-ids-render-result (result &optional button-action) +(defun hcel-ids-render-result (result button-action)    (let* ((location-info (alist-get 'locationInfo result))           (doc (hcel-render-html                 (or (alist-get 'doc result) @@ -434,20 +435,15 @@ Start by choosing a package."    (hcel-ids 'package query hcel-package-id))  (define-key hcel-mode-map "i" #'hcel-package-ids) -;; TODO: this is impossible with the current API, as definitionSite does not -;; contain signature, and ExactLocation does not contain component name or even -;; name -(defun hcel-help-tag-span-button-action (marker) -  (hcel-help-internal -   (print (hcel-definition-site-location-info -           (get-text-property marker 'location-info))))) - +;; TODO: it is impossible with the current API to follow link within the help +;; buffer, as definitionSite does not contain signature, and ExactLocation does +;; not contain component name or even name  (defun hcel-help-internal (info)    (help-setup-xref (list #'hcel-help-internal info)                     (called-interactively-p 'interactive))    (with-help-window (help-buffer)        (with-current-buffer standard-output -        (insert (hcel-ids-render-result info))))) +        (insert (hcel-ids-render-result info 'hcel-tag-span-button-load-source)))))  (defun hcel-help (query)    (interactive diff --git a/hcel-source.el b/hcel-source.el index fc7e38c..814211c 100644 --- a/hcel-source.el +++ b/hcel-source.el @@ -215,7 +215,7 @@ the location with pulsing.                               (ignore-errors                                 (hcel-hoogle-docs-location-info location-info))))                     (when (length> hoogle-docs 0) (concat "Hoogle: " hoogle-docs)))))) -            (hcel-render-html docs))))))) +            (hcel-render-html docs 'hcel-tag-span-button-load-source)))))))  ;; TODO: multiple expressions  (defun hcel-expressions-type (beg end) @@ -376,6 +376,11 @@ the location with pulsing.       (libxml-parse-html-region (point-min) (point-max))       "line-content"))) +(defun hcel-tag-span-button-load-source (marker) +  (hcel-load-module-location-info +   (hcel-to-exact-location +    (get-text-property marker 'location-info)))) +  ;; imenu  (defun hcel-imenu-create-index ()    (hcel-imenu-create-index-internal)) diff --git a/hcel-utils.el b/hcel-utils.el index 7f8fa86..d5b75cf 100644 --- a/hcel-utils.el +++ b/hcel-utils.el @@ -17,6 +17,9 @@  ;; You should have received a copy of the GNU Affero General Public  ;; License along with hcel.  If not, see <https://www.gnu.org/licenses/>. +(require 'dom) +(require 'shr) +  ;; data conversions  (defun hcel-parse-package-id (package-id &optional divider)    (unless (stringp divider) (setq divider " ")) @@ -145,7 +148,7 @@ Example of an idSrcSpan:                      (alist-get 'exprType (alist-get 'info expr)))))      (cons expression type))) -(defun hcel-render-html (html &optional action) +(defun hcel-render-html (html action)    (unless action (setq action 'hcel-tag-span-button-load-source))    (when html      ;; (hcel-debug-html html) @@ -178,11 +181,6 @@ Example of an idSrcSpan:                       )))              (dom-attributes dom))))) -(defun hcel-tag-span-button-load-source (marker) -  (hcel-load-module-location-info -   (hcel-to-exact-location -    (get-text-property marker 'location-info)))) -  (defun hcel-tag-div (dom)    (if (equal (dom-attr dom 'class) "source-code")        (shr-tag-pre dom) | 
