From cf18e3fc3cc4803b7fec1c30a2ec04da89c916e6 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Mon, 10 Mar 2025 16:20:15 -0700 Subject: [PATCH] Lots of little bug fixes --- bootstrap.org | 3 +-- ha-config.org | 9 +++---- ha-display.org | 50 +++++++++++++++++++++----------------- ha-org-clipboard.org | 10 ++++---- ha-org.org | 5 ++-- ha-programming-ansible.org | 8 ------ ha-programming-python.org | 6 ++--- ha-programming.org | 4 +-- ha-theme.org | 4 +-- 9 files changed, 45 insertions(+), 54 deletions(-) diff --git a/bootstrap.org b/bootstrap.org index 94e1933..337b253 100644 --- a/bootstrap.org +++ b/bootstrap.org @@ -219,8 +219,7 @@ The following /defines/ the rest of my org-mode literate files, that I load late ;; "ha-irc.org" "ha-org-publishing.org" "ha-email.org" - "ha-aux-apps.org" - "ha-feed-reader.org")) + "ha-aux-apps.org")) "ha-dashboard.org")) "List of org files that complete the hamacs project.") #+end_src diff --git a/ha-config.org b/ha-config.org index 78d62e9..fd339f6 100644 --- a/ha-config.org +++ b/ha-config.org @@ -252,7 +252,7 @@ Save the file whenever I move away from Emacs (see [[https://irreal.org/blog/?p= (interactive) (save-some-buffers t)) - ;; See 'after-focus-change -hook? + ;; See 'after-focus-change-function? (add-hook 'focus-out-hook 'save-all-buffers) #+end_src *** Download Files via URL @@ -818,12 +818,9 @@ The built-in =isearch= is fantastically simple and useful, bound to ~C-s~, but w I like Charles Choi’s [[https://github.com/kickingvegas/casual][Casual Suite]], and his original [[https://github.com/kickingvegas/cc-isearch-menu][cc-isearch-menu]] was great at seeing the /buried/ features. I’ve duplicated the features using [[https://github.com/jerrypnz/major-mode-hydra.el][pretty-hydra]]. In the middle of a search, type ~⌘-s~ (Command-s), and menu of options I don’t remember appear. -#+begin_src emacs-lisp :tangle no - (defvar ha-isearch--title (font-icons 'faicon "magnifying_glass" - :title "Search Options")) - +#+begin_src emacs-lisp (pretty-hydra-define isearch-mode - (:color amaranth :quit-key "C-s" :title ha-isearch--title) + (:color amaranth :quit-key "C-s" :title " Search Options") ("Movement" (("n" isearch-repeat-forward "Forward") ("p" isearch-repeat-backward "Backward") diff --git a/ha-display.org b/ha-display.org index 87a9436..6d2f246 100644 --- a/ha-display.org +++ b/ha-display.org @@ -275,10 +275,9 @@ Simple function that gives me the font information based on the size I need. Re (defun ha-set-favorite-font-size (size) "Set the default font size as well as equalize the fixed and variable fonts." - (let ((mixed-on mixed-pitch-mode) - (fixed-font (format "%s-%d" ha-fixed-font size)) + (let ((fixed-font (format "%s-%d" ha-fixed-font size)) (prop-font (format "%s-%d" ha-variable-font size))) - (when mixed-on + (when (fboundp 'mixed-pitch-mode) (mixed-pitch-mode -1)) ;; The font specification is the name and the size ... odd enough I guess: @@ -286,9 +285,7 @@ Simple function that gives me the font information based on the size I need. Re (set-face-attribute 'fixed-pitch nil :font fixed-font :inherit 'default :height 'unspecified) (set-face-attribute 'variable-pitch nil :font prop-font :inherit 'default - :height 'unspecified) - (when mixed-on - (mixed-pitch-mode 1)))) + :height 'unspecified))) #+end_src Define /interactive/ functions to quickly adjusting the font size based on my computing scenario: @@ -337,8 +334,6 @@ Which font to choose? (if (eq system-type 'gnu/linux) (ha-linux-laptop-fontsize) (ha-mac-laptop-fontsize))) - - (font-monitor-size-default) #+end_src ** Ligatures @@ -392,26 +387,26 @@ The way we access the /font icons/ has always been … odd; needing to specify t #+BEGIN_SRC emacs-lisp (defun font-icons (collection label &rest args) "Abstraction over `nerd-icons' project. - LABEL is a short icon description merged with COLLECTION to identify an - icon to use. For instance, 'faicon or 'octicon. + LABEL is a short icon description merged with COLLECTION to + identify an icon to use. For instance, 'faicon or 'octicon. ARGS, a plist, contain the title, sizing and other information. For instance: - (font-icons 'faicon \"file\" :title \"File Management\") + (font-icons 'faicon \"file\" :title \"File Management\") The goal is to take: - (all-the-icons-octicon \"git-branch\") + (all-the-icons-octicon \"git-branch\") And reformat to: - (font-icons 'octicon \"git-branch\")" + (font-icons 'octicon \"git-branch\")" (let* ((func (intern (format "nerd-icons-%s" collection))) (short (cl-case collection - ('octicon "oct") - ('faicon "fa") - ('mdicon "md") - ('codicon "cod") - ('sucicon "custom") - ('devicon "dev") + (octicon "oct") + (faicon "fa") + (mdicon "md") + (codicon "cod") + (sucicon "custom") + (devicon "dev") (t collection))) (title (plist-get args :title)) (space (plist-get args :space)) @@ -426,6 +421,15 @@ The way we access the /font icons/ has always been … odd; needing to specify t (title (concat " " title)))))) #+END_SRC +So: + +#+BEGIN_SRC emacs-lisp + (font-icons 'faicon "apple" :title "MacOS Specific") + ;; -> #(" MacOS Specific" 0 1 (rear-nonsticky t display (raise 0.0) + ;; font-lock-face (:family "CaskaydiaCove Nerd Font" :height 1.0) + ;; face (:family "CaskaydiaCove Nerd Font" :height 1.0))) +#+END_SRC + This replaces the /title generator/ for [[file:ha-config.org::*Leader Sequences][major-mode-hydra]] project to include a nice looking icon: #+BEGIN_SRC emacs-lisp @@ -441,7 +445,8 @@ Transition: #+BEGIN_SRC emacs-lisp (defun with-faicon (icon str &optional height v-adjust) - "Return an ICON from the Nerd Fonts along with a STR for a label." + "Return an ICON from the Nerd Fonts along with a STR for a label. + HEIGHT defaults to 1, and V-ADJUST defaults to 0." (font-icons 'faicon icon :v-adjust (or v-adjust 0) :height (or height 1) :title str)) (defun with-fileicon (icon str &optional height v-adjust) @@ -572,8 +577,10 @@ Most of the time, Emacs is on my desk is a darkened room, so I choose the dark t (defun laptop-inside () "Customize the theme for inside programming." (interactive) + (sit-for 1) (load-theme 'hamacs) - (ha-word-processor-fonts)) + (sit-for 1) + (font-monitor-size-default)) #+end_src But, when feeling adventurous, I /sometimes/ take my laptop outside: @@ -611,7 +618,6 @@ Oh, and turn off the line highlighting: And of course, the default is /inside/ where my mind is dark and safe: #+begin_src emacs-lisp - (add-to-list 'custom-theme-load-path hamacs-source-dir) (laptop-inside) #+end_src ** Highlight Task Labels diff --git a/ha-org-clipboard.org b/ha-org-clipboard.org index c425bfb..782a7a6 100644 --- a/ha-org-clipboard.org +++ b/ha-org-clipboard.org @@ -181,11 +181,11 @@ And define the same interface for Linux. Keep in mind, we need the exit code fro ** Converting to Org Let's work top-down at this point with the interactive function that inserts the clipboard into the current buffer: #+begin_src emacs-lisp -(defun ha-org-yank-clipboard () - "Yanks (pastes) the contents of the Apple Mac clipboard in an -org-mode-compatible format." - (interactive) - (insert (ha-org-clipboard))) + (defun ha-org-yank-clipboard () + "Yanks (pastes) the contents of the Apple Mac clipboard in an + org-mode-compatible format." + (interactive) + (insert (ha-org-clipboard))) #+end_src This function does the heavy lifting. Note that I will need another function to tidy up the output from =pandoc= that will be more to my liking. diff --git a/ha-org.org b/ha-org.org index c62fffb..2ba9e2b 100644 --- a/ha-org.org +++ b/ha-org.org @@ -3,7 +3,7 @@ #+date: 2020-09-18 #+tags: emacs org #+startup: inlineimages -#+lastmod: [2025-02-28 Fri] +#+lastmod: [2025-03-01 Sat] A literate programming file for configuring org-mode and those files. @@ -446,8 +446,7 @@ Using the [[https://graphviz.org/][graphviz project]], create charts with /textu (use-package graphviz-dot-mode :mode "\\.dot\\'" :init - (setq tab-width 4 - graphviz-dot-indent-width 2 + (setq graphviz-dot-indent-width 2 graphviz-dot-auto-indent-on-newline t graphviz-dot-auto-indent-on-braces t graphviz-dot-auto-indent-on-semi t)) diff --git a/ha-programming-ansible.org b/ha-programming-ansible.org index 2b3cc81..5471db0 100644 --- a/ha-programming-ansible.org +++ b/ha-programming-ansible.org @@ -102,10 +102,8 @@ Doing a lot of [[https://github.com/yoshiki/yaml-mode][YAML work]], but the =ya #+begin_src emacs-lisp (use-package yaml-mode - :after mixed-pitch :mode ((rx ".yamllint") (rx ".y" (optional "a") "ml" string-end)) - :hook (yaml-mode . (lambda () (mixed-pitch-mode -1))) :mode-hydra ((:foreign-keys run) ("Simple" @@ -198,12 +196,6 @@ I adapted this code from the [[https://github.com/emacsmirror/poly-ansible][poly ("Extensions" (("j" poly-yaml-jinja2-mode "Jinja2"))))) #+end_src -We need to make sure the =mixed-pitch-mode= doesn’t screw things up. - -#+begin_src emacs-lisp :tangle no - (add-hook 'poly-yaml-jinja2-mode-hook (lambda () (mixed-pitch-mode -1))) -#+end_src - We /can/ hook this up to Org, via: #+begin_src emacs-lisp :tangle no diff --git a/ha-programming-python.org b/ha-programming-python.org index ba5c885..f26d7f9 100644 --- a/ha-programming-python.org +++ b/ha-programming-python.org @@ -37,9 +37,9 @@ While Emacs supplies a Python editing environment, we’ll still use =use-packag (setq python-indent-guess-indent-offset-verbose nil flycheck-flake8-maximum-line-length 120) :config - (when (and (executable-find "python3") - (string= python-shell-interpreter "python")) - (setq python-shell-interpreter "python3")) + (when (and (executable-find "ipython") + (string= python-shell-interpreter "ipython")) + (setq python-shell-interpreter "ipython")) (flycheck-add-next-checker 'python-pylint 'python-pycompile 'append)) #+end_src diff --git a/ha-programming.org b/ha-programming.org index c8a6b41..fd70b11 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -47,12 +47,10 @@ For all programming languages, I would like to now default to absolute line numb #+begin_src emacs-lisp (use-package emacs - :after mixed-pitch :config (defun ha-prog-mode-config () "Configure the `prog-mode'" - (setq display-line-numbers t) - (mixed-pitch-mode 0)) + (setq display-line-numbers t)) :hook (prog-mode . ha-prog-mode-config)) #+end_src diff --git a/ha-theme.org b/ha-theme.org index ae48d6e..e3e83fc 100644 --- a/ha-theme.org +++ b/ha-theme.org @@ -372,7 +372,7 @@ Let’s make a /theme/: `(org-code ((t (:foreground ,almond)))) `(org-verbatim ((t (:foreground ,gray-95 :inherit fixed-pitch)))) - `(org-block ((t (:background ,gray-10)))) + `(org-block ((t (:background ,gray-10 :extend t)))) `(org-block-begin-line ((t (:foreground ,gray-50 :background ,gray-20 :height ,smaller :extend t)))) `(org-block-end-line ((t (:inherit org-block-begin-line :height ,smallest)))) @@ -467,7 +467,7 @@ Let's =provide= a name so we can =require= this file: #+DESCRIPTION: defining a warm, autumn, but subtle color theme for Emacs. #+PROPERTY: header-args:sh :tangle no -#+PROPERTY: header-args:emacs-lisp :tangle hamacs-theme.el +#+PROPERTY: header-args:emacs-lisp :tangle ~/.emacs.d/hamacs-theme.el #+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil