add more buttons
This commit is contained in:
@@ -23,12 +23,9 @@
|
||||
"Run `find-file' or 'counsel-find-file' if available."
|
||||
(interactive "e")
|
||||
(let ()
|
||||
;;(message "%s" event)
|
||||
(if (featurep 'counsel)
|
||||
(counsel-find-file)
|
||||
(find-file))
|
||||
;;(message "foo")
|
||||
))
|
||||
(find-file))))
|
||||
|
||||
(defvar my-tool-bar-button-open "Open "
|
||||
"Button to run `find-file' or `counsel-find-file' if available.")
|
||||
@@ -45,6 +42,33 @@
|
||||
"Button to run `keyboard-escape-quit'.")
|
||||
;; "Button to run `keyboard-quit'."
|
||||
|
||||
(defun my-tool-bar-function-fill (event)
|
||||
"Run `fill-region'."
|
||||
(interactive "e")
|
||||
(let ()
|
||||
(fill-region)))
|
||||
|
||||
(defvar my-tool-bar-button-fill "Fill "
|
||||
"Button to run `fill-region'.")
|
||||
|
||||
(defun my-tool-bar-function-spell (event)
|
||||
"Run `flyspell-buffer'."
|
||||
(interactive "e")
|
||||
(let ()
|
||||
(flyspell-buffer)))
|
||||
|
||||
(defvar my-tool-bar-button-spell "Spell "
|
||||
"Button to run `flyspell-buffer'.")
|
||||
|
||||
(defun my-tool-bar-function-langtool (event)
|
||||
"Run `langtool-check-buffer'."
|
||||
(interactive "e")
|
||||
(let ()
|
||||
(langtool-check-buffer)))
|
||||
|
||||
(defvar my-tool-bar-button-langtool "langtool "
|
||||
"Button to run `langtool-check-buffer'.")
|
||||
|
||||
;; (defun my-tool-bar-format-save ()
|
||||
;; "Produce the Menu button for the tool bar that shows the menu bar."
|
||||
;; `((menu-bar menu-item ,my-tool-bar-button-save
|
||||
@@ -59,18 +83,31 @@ You can hide these buttons by customizing `tab-bar-format' and removing
|
||||
`(;;(sep-history-back menu-item ,(tab-bar-separator) ignore)
|
||||
(save
|
||||
menu-item ,my-tool-bar-button-save my-tool-bar-function-save
|
||||
:help "Save")
|
||||
:help "Save `save-buffer'")
|
||||
;;(sep-test menu-item "" ignore)
|
||||
(open
|
||||
menu-item ,my-tool-bar-button-open my-tool-bar-function-open
|
||||
:help "Open File...")
|
||||
:help "Open File... `find-file'")
|
||||
(cancle
|
||||
menu-item ,my-tool-bar-button-cancle my-tool-bar-function-cancle
|
||||
:help "Cancle")
|
||||
:help "Cancle `keyboard-escape-quit'")
|
||||
(sep-1 menu-item ,(tab-bar-separator) ignore)
|
||||
(fill
|
||||
menu-item ,my-tool-bar-button-fill my-tool-bar-function-fill
|
||||
:help "Fill text in region to fit between left and right margin `fill-region'")
|
||||
(sep-2 menu-item ,(tab-bar-separator) ignore)
|
||||
(spell
|
||||
menu-item ,my-tool-bar-button-spell my-tool-bar-function-spell
|
||||
:help "Spell `flyspell-buffer'")
|
||||
(langtool
|
||||
menu-item ,my-tool-bar-button-langtool my-tool-bar-function-langtool
|
||||
:help "languagetool `langtool-check-buffer'")
|
||||
(sep-tool-bar menu-item ,(my-tool-bar-newline) ignore))))
|
||||
|
||||
(defun my-tool-bar--load-buttons ()
|
||||
"Load the icons for the tool bar buttons."
|
||||
"Load the icons for the tool bar buttons.
|
||||
See `image-load-path' for possible locations for images.
|
||||
See `icon-preference' for the order of type preference."
|
||||
;; (emoji "<empji>") see e.g. https://emojipedia.org/hamburger
|
||||
;; (symbol "<unicode>") see e.g. https://www.compart.com/en/unicode/U+2630
|
||||
(require 'icons)
|
||||
@@ -118,6 +155,47 @@ You can hide these buttons by customizing `tab-bar-format' and removing
|
||||
:version "29.1"))
|
||||
(setq my-tool-bar-button-cancle (icon-string 'my-tool-bar-icon-cancle))
|
||||
|
||||
(unless (iconp 'my-tool-bar-icon-fill)
|
||||
(define-icon my-tool-bar-icon-fill nil
|
||||
`((image "newsticker/narrow.xpm"
|
||||
:height (1.5 . em)
|
||||
:margin ,tab-bar-button-margin
|
||||
:ascent center)
|
||||
(text "Fill"
|
||||
;; :face tab-bar-tab-inactive
|
||||
))
|
||||
"Icon for fill region."
|
||||
:version "29.1"))
|
||||
(setq my-tool-bar-button-fill (icon-string 'my-tool-bar-icon-fill))
|
||||
|
||||
(unless (iconp 'my-tool-bar-icon-spell)
|
||||
(define-icon my-tool-bar-icon-spell nil
|
||||
`((image "spell.xpm"
|
||||
:height (1.5 . em)
|
||||
:margin ,tab-bar-button-margin
|
||||
:ascent center
|
||||
)
|
||||
(text "Spell"
|
||||
;; :face tab-bar-tab-inactive
|
||||
))
|
||||
"Icon for spell."
|
||||
:version "29.1"))
|
||||
(setq my-tool-bar-button-spell (icon-string 'my-tool-bar-icon-spell))
|
||||
|
||||
(unless (iconp 'my-tool-bar-icon-langtool)
|
||||
(define-icon my-tool-bar-icon-langtool nil
|
||||
`((image "languagetool.org.xpm"
|
||||
:height (1.5 . em)
|
||||
:margin ,tab-bar-button-margin
|
||||
:ascent center
|
||||
)
|
||||
(text "languagetool"
|
||||
;; :face tab-bar-tab-inactive
|
||||
))
|
||||
"Icon for languagetool."
|
||||
:version "29.1"))
|
||||
(setq my-tool-bar-button-langtool (icon-string 'my-tool-bar-icon-langtool))
|
||||
|
||||
)
|
||||
|
||||
(define-minor-mode my-tool-bar-mode
|
||||
|
||||
Reference in New Issue
Block a user