Skip to content

Commit

Permalink
Fixing bug: Not showing buttons that have no binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosemer committed Nov 25, 2023
1 parent 7accb3a commit 9aa0bc7
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions window-tool-bar.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,32 @@ MENU-ITEM: Menu item to convert. See info node (elisp)Tool Bar."
"|")

;; Main workhorse
(`(,key menu-item ,name-expr . ,_)
(`(,key menu-item ,name-expr ,binding . ,_)
;; Normal menu item, turn into propertized string button
(let* ((name (eval name-expr))
(str (format "[%s]" (eval name-expr)))
(enable-form (plist-get menu-item :enable))
(enabled (or (not enable-form)
(eval enable-form))))
(setq str (apply #'propertize
(append (list str)
(when enabled
`(mouse-face tab-line-highlight
keymap ,window-tool-bar--button-keymap)))))
(when-let ((spec (plist-get menu-item :image)))
(setq str (propertize str
'display (append spec
'(:margin 2)
(unless enabled '(:conversion disabled))))))
(if-let ((spec (plist-get menu-item :help)))
(when binding ; If no binding exists, then button is hidden.
(let* ((name (eval name-expr))
(str (format "[%s]" (eval name-expr)))
(enable-form (plist-get menu-item :enable))
(enabled (or (not enable-form)
(eval enable-form))))
(setq str (apply #'propertize
(append (list str)
(when enabled
`(mouse-face tab-line-highlight
keymap ,window-tool-bar--button-keymap)))))
(when-let ((spec (plist-get menu-item :image)))
(setq str (propertize str
'display (append spec
'(:margin 2)
(unless enabled '(:conversion disabled))))))
(if-let ((spec (plist-get menu-item :help)))
(setq str (propertize str
'help-echo spec))
(setq str (propertize str
'help-echo spec))
'help-echo name)))
(setq str (propertize str
'help-echo name)))
(setq str (propertize str
'tool-bar-key key))
str))))
'tool-bar-key key))
str)))))

(defun window-tool-bar--call-button ()
"Call the button that was clicked on in the tab line."
Expand Down

0 comments on commit 9aa0bc7

Please sign in to comment.