Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
2025-04-13 Bob Weiner <rsw@gnu.org>

* hbut.el (hattr:is-p): Add to abstract testing of hattr values.

* hsys-org.el (hsys-org-thing-at-p): Fix to work outside of Org mode by
suppressing warnings and ignoring Org regex errors. This fixes two
hsys-org tests where the 'www-url' ibtype fired instead of
Expand Down
9 changes: 8 additions & 1 deletion hbut.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 18-Sep-91 at 02:57:09
;; Last-Mod: 5-Jan-25 at 11:27:31 by Bob Weiner
;; Last-Mod: 13-Apr-25 at 11:20:12 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -947,6 +947,13 @@ Return TO-HBUT."
"Return value of OBJ-SYMBOL's attribute ATTR-SYMBOL."
(get obj-symbol attr-symbol))

(defun hattr:is-p (attr value &optional hbut-symbol)
"Return t if ATTR has VALUE for 'hbut:current or optional HBUT-SYMBOL."
(and (symbolp attr) attr
(eq (hattr:get (or (and (symbolp hbut-symbol) hbut-symbol) 'hbut:current)
attr)
value)))

(defun hattr:list (obj)
"Return a property list of OBJ's attributes.
Each pair of elements is: <attrib-name> <attrib-value>."
Expand Down
8 changes: 5 additions & 3 deletions test/hsys-org-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 23-Apr-21 at 20:55:00
;; Last-Mod: 13-Apr-25 at 03:23:46 by Bob Weiner
;; Last-Mod: 13-Apr-25 at 11:23:02 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -140,7 +140,8 @@ This is independent of the setting of `hsys-org-enable-smart-keys'."
(insert "[[file:/tmp/abc][file]]\n")
(goto-char 6)
(should (equal hsys-org-enable-smart-keys v)) ; Traceability
(should (action-key)))))))
(should (action-key))
(should (hattr:is-p 'actype #'org-open-at-point-global)))))))

(ert-deftest hsys-org--org-outside-org-mode-tmp-file ()
"Org links in a non `org-mode' file should work.
Expand All @@ -155,7 +156,8 @@ This is independent of the setting of `hsys-org-enable-smart-keys'."
(let ((hsys-org-enable-smart-keys v))
(mocklet (((org-open-at-point-global) => t))
(should (equal hsys-org-enable-smart-keys v)) ; Traceability
(should (action-key))))))
(should (action-key))
(should (hattr:is-p 'actype #'org-open-at-point-global))))))
(hy-delete-file-and-buffer file))))

(ert-deftest hsys-org--at-tags-p ()
Expand Down