From 2bf50e1f78358ed94d89d4dca3b1b9c49856d03f Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Mon, 3 Jun 2024 22:14:37 -0700 Subject: [PATCH] Organizational bug fix --- ha-config.org | 39 ++++++++- ha-display.org | 179 +++++++++++++++++++------------------- ha-general.org | 32 +------ ha-org-word-processor.org | 1 + ha-programming.org | 3 +- 5 files changed, 132 insertions(+), 122 deletions(-) diff --git a/ha-config.org b/ha-config.org index bf2a7eb..ba64979 100644 --- a/ha-config.org +++ b/ha-config.org @@ -316,12 +316,49 @@ Pressing the ~SPACE~ can activate a /leader key sequence/ I define in my [[file: #+end_src This extends the =use-package= to include a =:general= keybinding section. -Since I seldom remember keybindings, or even function names, for major-modes, I pull them all together into a nice table using the [[https://github.com/jerrypnz/major-mode-hydra.el][Major Mode Hydra]] project: +Since I seldom remember keybindings, or even function names, for major-modes, I pull them all together into a nice table using the [[https://github.com/jerrypnz/major-mode-hydrajjj0.el][Major Mode Hydra]] project: #+begin_src emacs-lisp (use-package major-mode-hydra :config (global-set-key (kbd "s-,") #'major-mode-hydra)) #+end_src + +For this feature, I may want to pull it out into its own file, so as to keep all of its features together... however, those feature often /depend/ of the functions they are calling. If so, we would have a series like this: +#+begin_src emacs-lisp + (use-package major-mode-hydra + :config + (major-mode-hydra-define Info-mode (:quit-key "q") + ("Overview" + (("d" Info-directory "Directory") + ("t" Info-top-node "Top") + ("T" Info-toc "Contents")) + "Goto" + (("m" link-hint-open-link "Menu...") + ("n" Info-goto-node "Node...") + ("i" Info-index "Index...")) + "History" + (("M-h" Info-history "List") + ("H" Info-history-back "Back" :color pink) + ("L" Info-history-forward "Forward" :color pink)) + "Navigation" + (("u" Info-up "Up" :color pink) + ("p" Info-backward-node "Backward" :color pink) + ("n" Info-forward-node "Forward" :color pink)) + "References" + (("l" Info-follow-reference "Choose") + ("j" Info-next-reference "Next" :color pink) + ("k" Info-prev-reference "Previous" :color pink)) + "Scroll" + (("SPC" Info-scroll-up "Up" :color pink) + ("DEL" Info-scroll-down "Down" :color pink) + ("RET" Info-follow-nearest-node "Open")) + "Misc" + (("o" org-store-link "Store link") + ("b" Info-bookmark-jump "Bookmark") + ("w" Info-goto-node-web "View on Web"))))) +#+end_src + + ** Additional Global Packages The following defines my use of the Emacs completion system. I’ve decided my /rules/ will be: - Nothing should automatically appear; that is annoying and distracting. diff --git a/ha-display.org b/ha-display.org index d7eab0f..1f1ece9 100644 --- a/ha-display.org +++ b/ha-display.org @@ -130,92 +130,6 @@ And if I can’t find the cursor, and don’t want to move it to see it, I can h (use-package pulsar :bind ("" . pulsar-pulse-line)) #+end_src -* Themes -One does get used to a particular collection of colors. After happily using Steve Purcell’s Tomorrow theme for many years, I decided to push it a little /warmer/. - -#+begin_src emacs-lisp - (use-package flexoki-themes - :config - (load-theme 'flexoki-themes-dark t) - - (defun ha-flexoki-themes-update () - "Slight tweaks to the flexoki-themes. - I found the background a tad too stark." - (if (eq flexoki-themes-set-theme 'dark) - (progn - (set-face-attribute 'default nil :background "#161514") - (set-face-attribute 'region nil :background "#bc5215") - (set-face-attribute 'org-block nil :background "#1b1a19") - (set-face-attribute 'org-block-begin-line nil :background "#1d1c1b") - (set-face-attribute 'org-block-begin-line nil :background "#1d1c1b")) - - (set-face-attribute 'region nil :background "#da702c") - (set-face-attribute 'org-block-begin-line nil :foreground "#fffcf0"))) - - :custom - (flexoki-themes-set-theme 'dark) - (flexoki-themes-use-bold-keywords t) - (flexoki-themes-use-bold-builtins t) - (flexoki-themes-use-italic-comments t) - - :hook (flexoki-themes-after-load-themes . ha-flexoki-themes-update)) -#+end_src - -Most of the time, Emacs is on my desk is a darkened room, so I choose the dark theme: - -#+begin_src emacs-lisp - (defun laptop-inside () - "Customize the theme for inside programming." - (interactive) - (load-theme 'flexoki-themes-dark t) - (ha-word-processor-fonts)) -#+end_src - -But, when feeling adventurous, I /sometimes/ take my laptop outside: - -#+begin_src emacs-lisp - (defun laptop-in-the-sun () - "Customize the theme for outside programming." - (interactive) - (load-theme 'flexoki-themes-light t) - (ha-word-processor-fonts)) -#+end_src - -I’ve been playing around with making the current window more pronounced. -This isn’t needed as much with the [[*Window Dimmer][Window Dimmer]] feature, but if I do, this would be the settings: - -#+begin_src emacs-lisp :tangle no - (set-face-attribute 'mode-line nil :background "#cccccc") - (set-face-attribute 'mode-line-inactive nil :background "#888888") -#+end_src - -Oh, and turn off the line highlighting: - -#+begin_src emacs-lisp - (global-hl-line-mode -1) -#+end_src - -And of course, the default is /inside/ where it is dark and safe: - -#+begin_src emacs-lisp - (laptop-inside) -#+end_src -* Full Size Frame -Taken from [[https://emacsredux.com/blog/2020/12/04/maximize-the-emacs-frame-on-startup/][this essay]], I figured I would start the initial frame automatically in fullscreen, but not any subsequent frames (as this could be part of the capturing system). -#+begin_src emacs-lisp - (add-to-list 'initial-frame-alist '(fullscreen . maximized)) -#+end_src - -But when capturing, I subsequently open smaller frames that shouldn’t be /odd looking/: -#+begin_src emacs-lisp - (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) - (add-to-list 'default-frame-alist '(ns-appearance . dark)) -#+end_src - -Now that I’m using v29 of Emacs, I can /un-decorate/ the non-full-sized frames: -#+begin_src emacs-lisp - (add-to-list 'default-frame-alist '(undecorated-round . t)) -#+end_src * Font Configuration Am I ever really ever satisfied with any font? I regularly change my font based on the monospace du jour... [[http://blogs.adobe.com/typblography/2012/09/source-code-pro.html][Source Code Pro]] is attractive, and has been a staple on every programmers' screen. However, we all want ligatures, [[https://github.com/i-tu/Hasklig][Hasklig]] is a nice font that is thinner and easier to read than [[https://github.com/tonsky/FiraCode][Fira]], but [[https://typeof.net/Iosevka/][Iosevka]] seems to have it all. Oh, Microsoft just gave us [[https://docs.microsoft.com/en-us/windows/terminal/cascadia-code][Cascadia]] and that seems shiny. However, the [[https://github.com/ryanoasis/nerd-fonts][Nerd Font project]] adds the ligatures as well as all the other niceties to a font. @@ -381,9 +295,9 @@ Which font to choose? [[https://github.com/emacsmirror/mixed-pitch][Mixed pitch]] is a minor mode that enables mixing fixed-pitch (also known as fixed-width or monospace) and variable-pitch (AKA “proportional”) fonts. It tries to be smart about which fonts get which face. #+begin_src emacs-lisp -(use-package mixed-pitch - :hook - (text-mode . mixed-pitch-mode)) + (use-package mixed-pitch + :straight (:host github :repo "jabranham/mixed-pitch") + :hook (text-mode . mixed-pitch-mode)) #+end_src ** Zooming or Increasing Font Size Do we want to increase the size of font in a single window (using =text-scale-increase=), or globally (using my new =font-size-increase=)? @@ -417,6 +331,93 @@ And some keybindings to call them: (global-set-key (kbd "s-=") 'font-size-increase) (global-set-key (kbd "s--") 'font-size-decrease) #+end_src +* Themes +One does get used to a particular collection of colors. After happily using Steve Purcell’s Tomorrow theme for many years, I decided to push it a little /warmer/. + +#+begin_src emacs-lisp + (use-package flexoki-themes + :straight (:host github :repo "crmsnbleyd/flexoki-emacs-theme") + :config + (load-theme 'flexoki-themes-dark t) + + (defun ha-flexoki-themes-update () + "Slight tweaks to the flexoki-themes. + I found the background a tad too stark." + (if (eq flexoki-themes-set-theme 'dark) + (progn + (set-face-attribute 'default nil :background "#161514") + (set-face-attribute 'region nil :background "#bc5215") + (set-face-attribute 'org-block nil :background "#1b1a19") + (set-face-attribute 'org-block-begin-line nil :background "#1d1c1b") + (set-face-attribute 'org-block-begin-line nil :background "#1d1c1b")) + + (set-face-attribute 'region nil :background "#da702c") + (set-face-attribute 'org-block-begin-line nil :foreground "#fffcf0"))) + + :custom + (flexoki-themes-set-theme 'dark) + (flexoki-themes-use-bold-keywords t) + (flexoki-themes-use-bold-builtins t) + (flexoki-themes-use-italic-comments t) + + :hook (flexoki-themes-after-load-themes . ha-flexoki-themes-update)) +#+end_src + +Most of the time, Emacs is on my desk is a darkened room, so I choose the dark theme: + +#+begin_src emacs-lisp + (defun laptop-inside () + "Customize the theme for inside programming." + (interactive) + (load-theme 'flexoki-themes-dark t) + (ha-word-processor-fonts)) +#+end_src + +But, when feeling adventurous, I /sometimes/ take my laptop outside: + +#+begin_src emacs-lisp + (defun laptop-in-the-sun () + "Customize the theme for outside programming." + (interactive) + (load-theme 'flexoki-themes-light t) + (ha-word-processor-fonts)) +#+end_src + +I’ve been playing around with making the current window more pronounced. +This isn’t needed as much with the [[*Window Dimmer][Window Dimmer]] feature, but if I do, this would be the settings: + +#+begin_src emacs-lisp :tangle no + (set-face-attribute 'mode-line nil :background "#cccccc") + (set-face-attribute 'mode-line-inactive nil :background "#888888") +#+end_src + +Oh, and turn off the line highlighting: + +#+begin_src emacs-lisp + (global-hl-line-mode -1) +#+end_src + +And of course, the default is /inside/ where it is dark and safe: + +#+begin_src emacs-lisp + (laptop-inside) +#+end_src +* Full Size Frame +Taken from [[https://emacsredux.com/blog/2020/12/04/maximize-the-emacs-frame-on-startup/][this essay]], I figured I would start the initial frame automatically in fullscreen, but not any subsequent frames (as this could be part of the capturing system). +#+begin_src emacs-lisp + (add-to-list 'initial-frame-alist '(fullscreen . maximized)) +#+end_src + +But when capturing, I subsequently open smaller frames that shouldn’t be /odd looking/: +#+begin_src emacs-lisp + (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) + (add-to-list 'default-frame-alist '(ns-appearance . dark)) +#+end_src + +Now that I’m using v29 of Emacs, I can /un-decorate/ the non-full-sized frames: +#+begin_src emacs-lisp + (add-to-list 'default-frame-alist '(undecorated-round . t)) +#+end_src * Emojis, Icons and Whatnot Display these two symbols as one: #+begin_src emacs-lisp diff --git a/ha-general.org b/ha-general.org index 4cc1ab1..8c376ff 100644 --- a/ha-general.org +++ b/ha-general.org @@ -761,37 +761,7 @@ Let's make Info behave a little more VI-like: "U" 'Info-directory "T" 'Info-top-node "p" 'Info-backward-node - "n" 'Info-forward-node) - :config - (major-mode-hydra-define Info-mode (:quit-key "q") - ("Overview" - (("d" Info-directory "Directory") - ("t" Info-top-node "Top") - ("T" Info-toc "Contents")) - "Goto" - (("m" link-hint-open-link "Menu...") - ("n" Info-goto-node "Node...") - ("i" Info-index "Index...")) - "History" - (("M-h" Info-history "List") - ("H" Info-history-back "Back" :color pink) - ("L" Info-history-forward "Forward" :color pink)) - "Navigation" - (("u" Info-up "Up" :color pink) - ("p" Info-backward-node "Backward" :color pink) - ("n" Info-forward-node "Forward" :color pink)) - "References" - (("l" Info-follow-reference "Choose") - ("j" Info-next-reference "Next" :color pink) - ("k" Info-prev-reference "Previous" :color pink)) - "Scroll" - (("SPC" Info-scroll-up "Up" :color pink) - ("DEL" Info-scroll-down "Down" :color pink) - ("RET" Info-follow-nearest-node "Open")) - "Misc" - (("o" org-store-link "Store link") - ("b" Info-bookmark-jump "Bookmark") - ("w" Info-goto-node-web "View on Web"))))) + "n" 'Info-forward-node)) #+end_src * Consult The [[https://github.com/minad/consult][consult project]] aims to use libraries like [[*Vertico][Vertico]] to enhance specific, built-in, Emacs functions. I appreciate this project that when selecting an element in the minibuffer, it displays what you are looking at… for instance, it previews a buffer before choosing it. Unlike /Vertico/ and /Orderless/, you need to bind keys to its special functions (or rebind existing keys that do something similar). diff --git a/ha-org-word-processor.org b/ha-org-word-processor.org index baf3afd..61262b1 100644 --- a/ha-org-word-processor.org +++ b/ha-org-word-processor.org @@ -2,6 +2,7 @@ #+author: Howard X. Abrams #+date: 2020-09-10 #+tags: emacs org +#+startup: inlineimages A literate programming file for making Org file more readable. diff --git a/ha-programming.org b/ha-programming.org index b9abc1f..ea42c06 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -1235,7 +1235,7 @@ I adapted this code from the [[https://github.com/emacsmirror/poly-ansible][poly #+begin_src emacs-lisp (use-package polymode :config - (define-hostmode poly-yaml-hostmode :mode #'yaml-ts-mode) + (define-hostmode poly-yaml-hostmode :mode 'yaml-ts-mode) (defcustom pm-inner/jinja2 (pm-inner-chunkmode :mode #'jinja2-mode :head-matcher "{[%{#][+-]?" @@ -1260,6 +1260,7 @@ Doing a lot of [[https://github.com/yoshiki/yaml-mode][YAML work]], but the =ya #+begin_src emacs-lisp (when (treesit-available-p) (use-package yaml-ts-mode + :straight (:type built-in) ;; :mode ((rx ".y" (optional "a") "ml" string-end) ;; (rx (optional ".") "yamllint")) :mode-hydra