[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 36ff14389c 2/5: Extend smart-lisp to handle i
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 36ff14389c 2/5: Extend smart-lisp to handle ibtype and actype tags |
Date: |
Tue, 18 Jan 2022 15:57:34 -0500 (EST) |
branch: externals/hyperbole
commit 36ff14389ca1d54134e31bbde3702b06588ef0e5
Author: Robert Weiner <rsw@gnu.org>
Commit: Robert Weiner <rsw@gnu.org>
Extend smart-lisp to handle ibtype and actype tags
---
ChangeLog | 8 ++++++++
hmouse-tag.el | 36 +++++++++++++++++++++++++++++++++---
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7697eb9503..33b57c2f3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-17 Bob Weiner <rsw@gnu.org>
+
+* hmouse-tag.el (smart-lisp-htype-tag): Add to transform ibtype and actype tags
+ into bound emacs symbols for lookup.
+ (smart-lisp-at-tag-p): Rewrite to use smart-lisp-htyp-tag.
+ (smart-lisp-at-non-htype-tag-p): Use when don't want to resolve
+ Hyperbole htypes.
+
* test/MANIFEST - Add summary of Hyperbole test case files
install-test/MANIFEST - Add summary of Hyperbole installation test files
diff --git a/hmouse-tag.el b/hmouse-tag.el
index 5ea45bf68d..05ec9caca3 100644
--- a/hmouse-tag.el
+++ b/hmouse-tag.el
@@ -595,7 +595,8 @@ been loaded, this jumps to the library source whenever
possible.
Otherwise, if a definition for the identifier is found within a TAGS
file in the current directory or any of its ancestor directories, this
-jumps to the definition.
+jumps to the definition. Supports Hyperbole implicit button types and
+action types.
With optional SHOW-DOC flag, show documentation for the tag at point
rather than displaying its source code definition. In this case, tag
@@ -674,7 +675,8 @@ Use `hpath:display-buffer' to show definition or
documentation."
(xref-etags-mode 1))
(condition-case ()
;; Tag of any language
- (and (featurep 'etags) (smart-tags-display tag
show-doc))
+ (when (featurep 'etags)
+ (smart-tags-display tag show-doc))
(error (unless (and elisp-flag (stringp
smart-emacs-tags-file)
(condition-case ()
(smart-tags-display
@@ -703,7 +705,7 @@ Use `hpath:display-buffer' to show definition or
documentation."
(looking-at "\\(;*[ \t]*\\)?(\\(autoload\\|load\\|require\\)")))
(defun smart-lisp-at-change-log-tag-p ()
- "When in a change-log mode, match to only bound Elisp identifiers and those
with a '-' somewhere in the middle.
+ "When in a change-log mode, match to bound Elisp identifiers only and those
with a '-' somewhere in the middle.
These tight tests help eliminate undesired matches.
Returns matching ELisp tag name that point is within, else nil."
(when (derived-mode-p 'change-log-mode)
@@ -711,8 +713,36 @@ Returns matching ELisp tag name that point is within, else
nil."
(and identifier (intern-soft identifier)
(string-match "[^-]-[^-]" identifier)))))
+(defun smart-lisp-htype-tag (tag)
+ "Given TAG at point, if it is a Hyperbole type, return the full symbol name,
else return the TAG unchanged."
+ (setq tag (cond ((and tag (string-match-p "::" tag))
+ tag)
+ ((and tag
+ (save-excursion
+ (skip-chars-backward "^ \t\n\r\f")
+ (skip-chars-backward " \t\n\r\f")
+ (equal (smart-lisp-at-non-htype-tag-p t) "hact")))
+ ;; If tag is preceded by an 'hact' call, then treat as a
Hyperbole actype.
+ (or (symtable:actype-p tag) tag))
+ (tag
+ (if (intern-soft tag)
+ tag
+ (or (symtable:ibtype-p tag) (symtable:actype-p tag)
tag)))))
+ (cond ((or (null tag) (stringp tag))
+ tag)
+ ((symbolp tag)
+ (symbol-name tag))))
+
(defun smart-lisp-at-tag-p (&optional no-flash)
"Return possibly non-existent Lisp tag name that point is within, else nil.
+Return nil when point is on the first line of a non-alias Lisp definition.
+
+Resolve Hyperbole implicit button type and action type references."
+ (smart-lisp-htype-tag
+ (smart-lisp-at-non-htype-tag-p no-flash)))
+
+(defun smart-lisp-at-non-htype-tag-p (&optional no-flash)
+ "Return possibly non-existent Lisp tag name that point is within, else nil.
Return nil when point is on the first line of a non-alias Lisp definition."
(unless (smart-lisp-at-definition-p)
(save-excursion