improve spell button to toggle on and off

This commit is contained in:
2025-07-13 10:31:09 +02:00
parent 542ad44c34
commit 373aa8226e

View File

@@ -99,12 +99,14 @@
"Button to run `fill-region'.")
(defun my-tool-bar-function-spell (event)
"Run `flyspell-buffer'."
"Run `flyspell-mode' and `flyspell-buffer'."
(interactive "e")
(let ()
(flyspell-buffer)))
(if flyspell-mode
(flyspell-mode -1)
(flyspell-mode 1) ;; local on-the-fly
(flyspell-buffer) )) ;; whole buffer
(defvar my-tool-bar-button-spell "Spell "
"Button to run `flyspell-buffer'.")
"Button to run `flyspell-mode' and `flyspell-buffer'.")
(defun my-langtool-active-p ()
"Check if `langtool-check-buffer' is active."
@@ -135,45 +137,45 @@ You can hide these buttons by customizing `tab-bar-format' and removing
(save
menu-item ,my-tool-bar-button-save my-tool-bar-function-save
;; :enable buffer-modified-p
:help "Save `save-buffer'")
: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... `find-file'")
:help "Open File... / `find-file'")
(cancle
menu-item ,my-tool-bar-button-cancle my-tool-bar-function-cancle
:help "Cancle `keyboard-escape-quit'")
:help "Cancle / `keyboard-escape-quit'")
(sep-1 menu-item ,(tab-bar-separator) ignore)
(revert
menu-item ,my-tool-bar-button-revert my-tool-bar-function-revert
:help "Re-read current buffer from its file `revert-buffer'")
:help "Re-read current buffer from its file / `revert-buffer'")
(undo
menu-item ,my-tool-bar-button-undo my-tool-bar-function-undo
:help "Undo `undo-only'")
:help "Undo / `undo-only'")
(redo
menu-item ,my-tool-bar-button-redo my-tool-bar-function-redo
:help "Redo `undo-redo'")
:help "Redo / `undo-redo'")
(cut
menu-item ,my-tool-bar-button-cut my-tool-bar-function-cut
:help "Cut text of region `kill-region'")
:help "Cut text of region / `kill-region'")
(copy
menu-item ,my-tool-bar-button-copy my-tool-bar-function-copy
:help "Copy text of region `kill-ring-save'")
:help "Copy text of region / `kill-ring-save'")
(paste
menu-item ,my-tool-bar-button-paste my-tool-bar-function-paste
:help "Paste text `yank'")
:help "Paste text / `yank'")
(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'")
:help "Fill text in region to fit between left and right margin / `fill-region'")
(sep-2 menu-item ,(tab-bar-separator) ignore)
;; (sep-2 menu-item ,my-tool-bar-separator ignore
;; :enable nil :help "")
(spell
menu-item ,my-tool-bar-button-spell my-tool-bar-function-spell
:help "Spell `flyspell-buffer'")
:help "Spell checking / `flyspell-mode' and `flyspell-buffer'")
(langtool
menu-item ,my-tool-bar-button-langtool my-tool-bar-function-langtool
:help "languagetool `langtool-check-buffer'")
:help "LanguageTool / `langtool-check-buffer'")
(sep-tool-bar menu-item ,(my-tool-bar-newline) ignore))))
(defun my-tool-bar--load-buttons ()