Skip to content

Commit

Permalink
Fixing bug: GDB tool bar does not display correctly.
Browse files Browse the repository at this point in the history
* Evaluating the name form when needed.
* Using name form as fallback for help-echo text.
  • Loading branch information
chaosemer committed Nov 25, 2023
1 parent a9d6ff9 commit 7accb3a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions window-tool-bar.el
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ MENU-ITEM: Menu item to convert. See info node (elisp)Tool Bar."
;; Separators
(`(,_ "--")
"|")
(`(,_ menu-item ,(pred (string-prefix-p "--")))
(`(,_ menu-item ,(and (pred stringp)
(pred (string-prefix-p "--"))))
"|")

;; Main workhorse
(`(,key menu-item ,name . ,_)
(`(,key menu-item ,name-expr . ,_)
;; Normal menu item, turn into propertized string button
(let* ((str (format "[%s]" name))
(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))))
Expand All @@ -114,9 +116,11 @@ MENU-ITEM: Menu item to convert. See info node (elisp)Tool Bar."
'display (append spec
'(:margin 2)
(unless enabled '(:conversion disabled))))))
(when-let ((spec (plist-get menu-item :help)))
(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
'tool-bar-key key))
str))))
Expand Down

0 comments on commit 7accb3a

Please sign in to comment.