diff --git a/lisp/my/my-tool-bar.el b/lisp/my/my-tool-bar.el index 29159a08..e19dd157 100644 --- a/lisp/my/my-tool-bar.el +++ b/lisp/my/my-tool-bar.el @@ -129,16 +129,28 @@ (comment-or-uncomment-region (region-beginning) (region-end)) ;; (comment-dwim) )) -(defvar my-tool-bar-button-fill "Comment " +(defvar my-tool-bar-button-comment "Comment " "Button to run `comment-or-uncomment-region'.") -(defun my-tool-bar-function-hide (event) - "Run `my-org-hide'." +(defun my-hide-elements () + "." (interactive "e") (let () - (my-org-hide) )) -(defvar my-tool-bar-button-fill "(Un)hide " - "Button to run `my-org-hide'.") + (pcase major-mode + ('org-mode + (let () + (my-org-toggle-elements) + )) + (_ (message "%s: %s" "not defined for this major-mode" + major-mode)) ) + )) +(defun my-tool-bar-function-hide (event) + "Run `my-hide-elements' inside org-mode." + (interactive "e") + (let () + (my-hide-elements))) +(defvar my-tool-bar-button-hide "(Un)hide " + "Button to run `my-hide-elements' inside org-mode.") (defun my-tool-bar-function-spell (event) "Run `flyspell-mode' and `flyspell-buffer'." @@ -164,6 +176,25 @@ (defvar my-tool-bar-button-langtool "langtool " "Button to run `langtool-check-buffer'.") +(defun my-tool-bar-function-play (event) + "Run `C-c'." + (interactive "e") + (let () + (pcase major-mode + ('org-mode (org-ctrl-c-ctrl-c)) + (_ (message "%s: %s" "not defined for this major-mode" + major-mode)) ))) +(defvar my-tool-bar-button-play "Cc " + "Button to run `C-c'.") + +(defun my-tool-bar-function-read (event) + "Run `my-distraction-free'." + (interactive "e") + (let () + (my-distraction-free) )) +(defvar my-tool-bar-button-read "Rdv " + "Button to run `my-distraction-free'.") + ;; (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 @@ -217,7 +248,8 @@ You can hide these buttons by customizing `tab-bar-format' and removing (propertize "`revert-buffer'" 'face 'font-lock-constant-face))) - (sep-1 menu-item ,(tab-bar-separator) ignore) + ;; (sep-1 menu-item ,(tab-bar-separator) ignore) + (sep-1 menu-item " " ignore :enable nil :help "") (undo menu-item ,my-tool-bar-button-undo my-tool-bar-function-undo @@ -254,15 +286,16 @@ You can hide these buttons by customizing `tab-bar-format' and removing :help (concat "Comment text in region " (propertize "`comment-or-uncomment-region'" 'face 'font-lock-constant-face))) - (comment - menu-item ,my-tool-bar-button-hide my-tool-bar-function-hide - :help (concat "(Un)hide elements " - (propertize "`my-org-hide'" + (play + menu-item ,my-tool-bar-button-play my-tool-bar-function-play + :help (concat "Run " + (propertize "`C-c'" 'face 'font-lock-constant-face))) - (sep-2 menu-item ,(tab-bar-separator) ignore) + ;; (sep-2 menu-item ,(tab-bar-separator) ignore) ;; (sep-2 menu-item ,my-tool-bar-separator ignore - ;; :enable nil :help "") + ;; :enable nil :help "") + (sep-2 menu-item " " ignore :enable nil :help "") (spell menu-item ,my-tool-bar-button-spell my-tool-bar-function-spell @@ -274,12 +307,28 @@ You can hide these buttons by customizing `tab-bar-format' and removing :help (concat "LanguageTool " (propertize "`langtool-check-buffer'" 'face 'font-lock-constant-face))) - (sep-tool-bar menu-item ,(my-tool-bar-newline) ignore)))) + (hide + menu-item ,my-tool-bar-button-hide my-tool-bar-function-hide + :help (concat "(Un)hide elements " + (propertize "`my-hide-elements'" + 'face 'font-lock-constant-face))) + (read + menu-item ,my-tool-bar-button-read my-tool-bar-function-read + :help (concat "Read view " + (propertize "`my-distraction-free'" + 'face 'font-lock-constant-face))) + + (sep-tool-bar menu-item ,(my-tool-bar-newline) ignore) + + ))) (defun my-tool-bar--load-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." +See `icon-preference' for the type order to load. +See `create-image' and `icons--create' and info node `(elisp) Image Descriptors' for the properties of an image." + ;; (info "(elisp) Image Descriptors") + ;; (emoji "") see e.g. https://emojipedia.org/hamburger ;; (symbol "") see e.g. https://www.compart.com/en/unicode/U+2630 (require 'icons) @@ -291,12 +340,12 @@ See `icon-preference' for the order of type preference." (define-icon my-tool-bar-icon-separator nil `((image "separator.xpm" :height (1.5 . em) - :margin ,tab-bar-button-margin + :margin (5 . 1) :ascent center) (text " " ;; :face tab-bar-tab-inactive )) - "Icon for save." + "Separator." :version "29.1")) (setq my-tool-bar-separator (icon-string 'my-tool-bar-icon-separator)) @@ -310,7 +359,7 @@ See `icon-preference' for the order of type preference." :ascent center) (emoji "📂") (symbol "🗀 ") ;; 🗁 🗀 - (text "Open " + (text "Opn " ;; :face tab-bar-tab-inactive )) "Icon for open file." @@ -327,7 +376,7 @@ See `icon-preference' for the order of type preference." :ascent center) (emoji "💾") (symbol "🖫 ") ;; 🖪 🖫 🖬 - (text "Save " + (text "Sav " ;; :face tab-bar-tab-inactive )) "Icon for save." @@ -340,7 +389,7 @@ See `icon-preference' for the order of type preference." :height (1.5 . em) :margin ,tab-bar-button-margin :ascent center) - (text "Save as " + (text "SvA " ;; :face tab-bar-tab-inactive )) "Icon for save as." @@ -357,7 +406,7 @@ See `icon-preference' for the order of type preference." :ascent center) (emoji "❌") (symbol "🗙 ") ;; 🗙 𐌗 - (text "Quit " + (text "Qit " ;; :face tab-bar-tab-inactive )) "Icon for quit." @@ -371,7 +420,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "♺ ") ; ⮔ ♺ - (text "Prev-buffer " + (text "PBf " )) "Icon for previous buffer." :version "29.1")) @@ -384,7 +433,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "♺ ") ; ⮔ ♺ - (text "Next-buffer " + (text "NBf " )) "Icon for next buffer." :version "29.1")) @@ -399,7 +448,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "♺ ") ; ⮔ ♺ - (text "Revert " + (text "Rev " ;; :face tab-bar-tab-inactive )) "Icon for revert buffer." @@ -415,7 +464,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "↩ ") - (text "Undo " + (text "UDo " ;; :face tab-bar-tab-inactive )) "Icon for undo." @@ -431,7 +480,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "↪ ") - (text "Redo " + (text "RDo " ;; :face tab-bar-tab-inactive )) "Icon for redo." @@ -464,7 +513,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "🗐 ") - (text "Copy " + (text "Cpy " ;; :face tab-bar-tab-inactive )) "Icon for copy region." @@ -481,7 +530,7 @@ See `icon-preference' for the order of type preference." :ascent center) (emoji "📋") (symbol "🗎 ") - (text "Paste " + (text "Pst " ;; :face tab-bar-tab-inactive )) "Icon for paste." @@ -497,7 +546,7 @@ See `icon-preference' for the order of type preference." :margin ,tab-bar-button-margin :ascent center) (symbol "≣ ") - (text "Fill " + (text "Fil " ;; :face tab-bar-tab-inactive )) "Icon for fill region." @@ -510,7 +559,7 @@ See `icon-preference' for the order of type preference." :height (1.5 . em) :margin ,tab-bar-button-margin :ascent center) - (text "Comment " )) + (text "Com " )) "Icon for comment region." :version "29.1")) (setq my-tool-bar-button-comment (icon-string 'my-tool-bar-icon-comment)) @@ -521,7 +570,7 @@ See `icon-preference' for the order of type preference." :height (1.5 . em) :margin ,tab-bar-button-margin :ascent center) - (text "(Un)hide " )) + (text "Hid " )) "Icon for (un)hide elements." :version "29.1")) (setq my-tool-bar-button-hide (icon-string 'my-tool-bar-icon-hide)) @@ -536,7 +585,7 @@ See `icon-preference' for the order of type preference." :ascent center ) (symbol "⎁ ") ;; ⎀ ⎁ ⎂ - (text "Spell " + (text "Spl " ;; :face tab-bar-tab-inactive )) "Icon for spell." @@ -552,13 +601,39 @@ See `icon-preference' for the order of type preference." :ascent center ) (symbol "ℒ ") - (text "langtool " + (text "Lng " ;; :face tab-bar-tab-inactive )) "Icon for languagetool." :version "29.1")) (setq my-tool-bar-button-langtool (icon-string 'my-tool-bar-icon-langtool)) + (unless (iconp 'my-tool-bar-icon-play) + (define-icon my-tool-bar-icon-play nil + `((image "Fluent-dark/builder-run-start-symbolic.svg" + :height (1.5 . em) + :margin ,tab-bar-button-margin + :ascent center + ) + (text "Run " + )) + "Icon for run C-c." + :version "29.1")) + (setq my-tool-bar-button-play (icon-string 'my-tool-bar-icon-play)) + + (unless (iconp 'my-tool-bar-icon-read) + (define-icon my-tool-bar-icon-read nil + `((image "Fluent-dark/ephy-reader-mode-symbolic.svg" + :height (1.5 . em) + :margin ,tab-bar-button-margin + :ascent center + ) + (text "Rdv " + )) + "Icon for read view." + :version "29.1")) + (setq my-tool-bar-button-read (icon-string 'my-tool-bar-icon-read)) + ) (define-minor-mode my-tool-bar-mode diff --git a/lisp/my/my.el b/lisp/my/my.el index 4f15349e..8a9c921d 100644 --- a/lisp/my/my.el +++ b/lisp/my/my.el @@ -313,14 +313,32 @@ print it in the message buffer." ;; https://emacs.stackexchange.com/questions/7375/can-i-format-cells-in-an-org-mode-table-differently-depending-on-a-formula (require 'ov) - (defun my-org-toggle-emphasis () + (setq my-org-latex-preview nil) + (defun my-org-toggle-elements () "Toggle hiding/showing of org emphasize markers." (interactive) + (if org-hide-emphasis-markers (set-variable 'org-hide-emphasis-markers nil) (set-variable 'org-hide-emphasis-markers t)) - (org-mode-restart)) - (define-key org-mode-map (kbd "C-c C-x C-e") 'my-org-toggle-emphasis) + (setq org-link-descriptive (not org-link-descriptive)) + (org-restart-font-lock) + + (org-toggle-inline-images) + + ;; (org-latex-preview) + (if my-org-latex-preview + ;; switch off + (let () + (set-variable 'my-org-latex-preview nil) + (org-latex-preview '(64))) + ;; switch on + (set-variable 'my-org-latex-preview t) + (org-latex-preview '(16))) + + ;; (org-mode-restart) + ) + (define-key org-mode-map (kbd "C-c C-x C-e") 'my-org-toggle-elements) (defun my-org-keywords () "Parse the buffer and return a cons list of (key . value) diff --git a/settings/org-settings.el b/settings/org-settings.el index 4ec21609..988ff4da 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -296,7 +296,7 @@ For example in org-mode the link location" (setq org-hidden-keywords nil) ;; hide keywords like `#+TITLE:` or not, see also `org-appear' (setq org-hide-emphasis-markers nil) ;; hide emphasis marker *_=~/+, see also `org-appear' (setq org-startup-folded nil) ;; nil = showall = #+STARTUP: showall - (setq org-startup-with-inline-images t) ;; #+STARTUP: inlineimages|noinlineimages, show inline images when loading a new Org file + (setq org-startup-with-inline-images nil) ;; #+STARTUP: inlineimages|noinlineimages, show inline images when loading a new Org file (setq org-use-sub-superscripts '{}) ;; braces are *required* in order to trigger interpretations as sub/superscript, see also `org-export-with-sub-superscripts'. C-c C-x \ (`org-toggle-pretty-entities') (setq org-pretty-entities nil) ;; so much trouble in an article, see also `org-appear' and [C-c C-x \] (`org-toggle-pretty-entities') (setq org-pretty-entities-include-sub-superscripts t) ;; if `org-pretty-entities' is active include also sub-superscripts.