Skip to content

Commit

Permalink
Fix ebut being identified as ibut
Browse files Browse the repository at this point in the history
  • Loading branch information
matsl committed Dec 22, 2023
1 parent a329d29 commit e715e61
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2023-12-10 Mats Lidell <[email protected]>

* hui.el (hui:link-possible-types): Fix ebut being identified as ibut.

2023-12-09 Mats Lidell <[email protected]>

* test/hy-test-helpers.el (hy-test-helpers:consume-input-events): Remove
Expand Down
19 changes: 10 additions & 9 deletions hui.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 21:42:03
;; Last-Mod: 6-Nov-23 at 19:36:33 by Bob Weiner
;; Last-Mod: 10-Dec-23 at 19:10:29 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1850,14 +1850,15 @@ Buffer without File link-to-buffer-tmp"
(when (looking-at "\\bid:")
(list 'link-to-org-id id)))))))))

;; Next clause forces use of any ibut name in the link
;; and sets hbut:current button attributes.
(t (cond ((and (not (derived-mode-p 'dired-mode))
(prog1 (setq hbut-sym (hbut:at-p))
(save-excursion (ibut:at-to-name-p hbut-sym)))
(setq lbl-key (hattr:get hbut-sym 'lbl-key))
(eq (current-buffer) (get-file-buffer (gbut:file))))
(list 'link-to-gbut lbl-key))
;; Next clause forces use of any ibut name in the link
;; and sets hbut:current button attributes.
(t (cond ((and (not (derived-mode-p 'dired-mode))
(prog1 (setq hbut-sym (hbut:at-p))
(when (ibut:is-p hbut-sym)
(save-excursion (ibut:at-to-name-p hbut-sym))))
(setq lbl-key (hattr:get hbut-sym 'lbl-key))
(eq (current-buffer) (get-file-buffer (gbut:file))))
(list 'link-to-gbut lbl-key))
((and hbut-sym lbl-key (eq (hattr:get hbut-sym 'categ) 'explicit))
(list 'link-to-ebut lbl-key))
((and hbut-sym lbl-key)
Expand Down
6 changes: 2 additions & 4 deletions test/hui-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
;; Last-Mod: 7-Dec-23 at 00:32:03 by Mats Lidell
;; Last-Mod: 10-Dec-23 at 21:11:07 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -958,9 +958,7 @@ With point on label suggest that ibut for rename."
;; Explicit Button link-to-ebut
(with-temp-buffer
(ebut:program "label" 'link-to-directory "/tmp")
(should (equal (hattr:get (hbut:at-p) 'categ) 'explicit))
;; BUG!? SHOULD BE LINK TO EBUT HERE
(should (equal (caar (hui:link-possible-types)) 'link-to-ibut)))
(should (equal (caar (hui:link-possible-types)) 'link-to-ebut)))

;; Implicit Button link-to-ibut
(with-temp-buffer
Expand Down

0 comments on commit e715e61

Please sign in to comment.