Compare commits

..

4 commits

Author SHA1 Message Date
Howard Abrams
6463bb95a9 Migrating from direnv to Mise
Oh, and fixed an obscure bug that has caused me great consternation.
2026-01-09 22:06:40 -08:00
Howard Abrams
8af3329b73 Fancier tab-bar numbers of the Mac 2026-01-09 22:06:20 -08:00
Howard Abrams
bceca4ce0f Using Unicode characters for the tab-bar mode 2026-01-06 21:34:37 -08:00
Howard Abrams
ce83073865 Minor bug fixes in the display 2026-01-06 21:12:22 -08:00
6 changed files with 161 additions and 10 deletions

View file

@ -96,6 +96,7 @@ Yet another encrypted chat/VoIP client-server, but unlike Signal and Telegram, [
#+begin_src emacs-lisp
(use-package ement
:straight (:host github :repo "alphapapa/ement.el")
:after major-mode-hydra
:config
(major-mode-hydra-define ement-room-mode (:quit-key "q")
("Send"
@ -117,7 +118,6 @@ Yet another encrypted chat/VoIP client-server, but unlike Signal and Telegram, [
(ement-connect :user-id username
:password password
:uri-prefix "https://matrix.org"))
(ha-leader
"a x S" '("send" . ement-send-direct-message)
"a x s" '("send" . ement-room-send-message)
@ -186,7 +186,7 @@ In the Telega chats, lets turn on non-fixed-width fonts:
#+end_src
* RPG DM
Been working on my [[https://gitlab.com/howardabrams/emacs-rpgdm][RPG DM project]] for getting Emacs helping as a /Dungeon Master's Assistant/. The idea is to be able to roll dice and whatnot. What I find most useful is the [[https://gitlab.com/howardabrams/emacs-rpgdm/-/blob/main/rpgdm-tables.el][random tables]].
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no
(when (f-directory? "~/src/emacs-rpgdm")
(use-package rpgdm
:straight (:local-repo "~/src/emacs-rpgdm")

View file

@ -1116,7 +1116,110 @@ Any time I create or delete a new tab, we can call =ha-tab-bar-update-names=:
(advice-add #'tab-bar-close-tab :after #'ha-tab-bar-update-names)
(advice-add #'tab-bar-close-other-tabs :after #'ha-tab-bar-update-names)
(add-hook desktop-after-read-hook #'ha-tab-bar-update-names)
(add-hook #'desktop-after-read-hook #'ha-tab-bar-update-names)
#+END_SRC
*** Add Numbers ot Tab Bar Mode
Christian Tietze had a [[https://christiantietze.de/posts/2022/02/emacs-tab-bar-numbered-tabs/][great idea]] for making the tab-bar numbers more distinguished from the labels on the tabs (he has a [[https://christiantietze.de/posts/2022/12/sf-symbols-emacs-tab-numbers/][follow up essay]] about using a different font, but since I need the portability of Unicode for Linux, I may need to synthesize both).
#+BEGIN_SRC emacs-lisp
(defface ha/tab-bar-numbers
(if (ha-running-on-macos?)
'((t
:inherit tab-bar-tab-face
:family "SF Compact"
:weight light))
;; On Linux, we use the dingbat unicode with default font:
'((t
:inherit tab-bar-tab-face
:weight light)))
"Face for tab numbers in both active and inactive tabs.")
#+END_SRC
First, create a variable that contains the Unicode values for the numbers. I am using the negative versions of the circle numbers from the Unicode dingbats collection:
#+BEGIN_SRC emacs-lisp
(defvar ha/circle-numbers-alist
(if (ha-running-on-macos?)
'((0 . "􀃈")
(1 . "􀃊")
(2 . "􀃌")
(3 . "􀃎")
(4 . "􀘙")
(5 . "􀃒")
(6 . "􀑵")
(7 . "􀃖")
(8 . "􀃘")
(9 . "􀑷")
(10 . "􀃈"))
;; Keeping these around for the Mac just in case.
;; '((0 . "⓿")
;; (1 . "❶")
;; (2 . "❷")
;; (3 . "❸")
;; (4 . "❹")
;; (5 . "❺")
;; (6 . "❻")
;; (7 . "❼")
;; (8 . "❽")
;; (9 . "❾"))
'((0 . "🄌")
(1 . "➊")
(2 . "➋")
(3 . "➌")
(4 . "➍")
(5 . "➎")
(6 . "➏")
(7 . "➐")
(8 . "➑")
(9 . "➒")))
"Alist of integers to strings of circled unicode numbers.")
#+END_SRC
And then use this function to replace the standard =tab-bar-tab-name-format-function=:
#+BEGIN_SRC emacs-lisp
(defun ha/tab-bar-tab-name-format-default (tab i)
"Replacement for `tab-bar-tab-name-format-function'.
Places a special symbol for the initial digit."
(let ((current-p (eq (car tab) 'current-tab))
(tab-num (if (and tab-bar-tab-hints (< i 10))
(alist-get i ha/circle-numbers-alist) "")))
(propertize
(concat tab-num
" "
(alist-get 'name tab)
(or (and tab-bar-close-button-show
(not (eq tab-bar-close-button-show
(if current-p 'non-selected 'selected)))
tab-bar-close-button)
"")
" ")
'face (funcall tab-bar-tab-face-function tab))))
(defun ha/tab-bar-tab-name-format-default (tab i)
"Replacement for `tab-bar-tab-name-format-function'.
Places a special symbol for the initial digit."
(let ((current-p (eq (car tab) 'current-tab)))
(concat
;; First, add the tab number with a custom face
(propertize
(if (and tab-bar-tab-hints (< i 10)) (alist-get i ha/circle-numbers-alist) "")
'face 'ha/tab-bar-numbers)
;; Add tab name with the face returned by tab-bar-tab-face-function
(propertize
(concat
" " ; Add initial space
(alist-get 'name tab)
(or (and tab-bar-close-button-show
(not (eq tab-bar-close-button-show
(if current-p 'non-selected 'selected)))
tab-bar-close-button)
"")
" ")
'face (funcall tab-bar-tab-face-function tab)))))
(setq tab-bar-tab-name-format-function
#'ha/tab-bar-tab-name-format-default)
#+END_SRC
* Pretty Good Encryption

View file

@ -444,9 +444,14 @@ This replaces the /title generator/ for [[file:ha-config.org::*Leader Sequences]
#+BEGIN_SRC emacs-lisp
(setq major-mode-hydra-title-generator
'(lambda (&optional mode)
(let ((title (major-mode-hydra-title mode)))
(s-concat ; (s-repeat 5 " ")
(nerd-icons-icon-for-mode (or mode major-mode) :v-adjust 0.05)
(unless mode (setq mode major-mode))
(let ((title (major-mode-hydra-title mode))
(default (nerd-icons-mdicon "nf-md-apple_keyboard_command"
:v-adjust 0.05))
(icon (nerd-icons-icon-for-mode (or mode major-mode)
:v-adjust 0.05)))
(concat (if (eq icon mode) default icon)
" " title " Commands"))))
#+END_SRC

View file

@ -28,6 +28,32 @@ A literate programming file for helping me program.
Configuration for programming interfaces and workflows that behave similarly.
* General
The following work for all programming languages.
** Virtual Environments with Mise
The [[https://github.com/eki3z/mise.el][mise.el]] project overcomes the [[https://mise.jdx.dev/ide-integration.html#emacs][need for shims]] and other hoops when working with [[https://mise.jdx.dev/walkthrough.html][Mise]].
#+BEGIN_SRC emacs-lisp
(use-package mise
:straight (:type git :host github :repo "eki3z/mise.el")
:hook (after-init . global-mise-mode))
#+END_SRC
Now, per project, create a =mise.toml= that contains tools, environment variables, etc.
#+BEGIN_SRC toml
[env]
AWS_DEFAULT_REGION = "us-gov-east-1"
[tools]
python = {version='3', virtualenv='~/.venv/govcloud_lambda'}
#+END_SRC
Or create the entries by using CLI commands:
#+BEGIN_SRC sh :tangle no
mise set AWS_DEFAULT_REGION=us-gov-east-1
#+END_SRC
** Virtual Environments with direnv
Farm off commands into /virtual environments/:
#+begin_src emacs-lisp

View file

@ -311,7 +311,6 @@ Can we *see* our colors?
#+END_SRC
* Dark Theme
Lets make a /theme/:
#+BEGIN_SRC emacs-lisp
@ -334,7 +333,7 @@ Lets make a /theme/:
`(tab-bar ((t :foreground ,default-fg :background ,default-bg)))
`(tab-line ((t :foreground ,default-fg :background ,default-bg)))
`(tab-bar-tab ((t (:inherit variable-pitch :background ,active))))
`(tab-bar-tab-inactive ((t (:inherit variable-pitch :background ,inactive))))
`(tab-bar-tab-inactive ((t (:inherit variable-pitch :background ,default-bg))))
`(doom-modeline-buffer-path ((t (:foreground ,almond))))
`(doom-modeline-buffer-file ((t (:foreground "white" :weight bold))))
@ -457,7 +456,24 @@ Lets make a /theme/:
`(elfeed-search-tag-face ((t (:foreground ,slate))))))
#+END_SRC
[[file:ha-theme-results.png]]
To update a feature live with all attributes, do something like:
#+BEGIN_SRC emacs-lisp :tangle no
(set-face-attribute 'tab-bar-tab-inactive nil
:inherit variable-pitch
:background "#462200")
#+END_SRC
Or, you can use the helper functions to change a feature directly:
#+BEGIN_SRC emacs-lisp :tangle no
(set-face-background 'tab-bar-tab-inactive "#462200")
#+END_SRC
* Technical Artifacts :noexport:
Let's =provide= a name so we can =require= this file:

View file

@ -246,6 +246,7 @@ Configure the plugins, making sure to not use =git=, as the aliases are a pain t
- [[https://github.com/hsienjan/colorize][colorize]] :: syntax-highlight file contents, so install [[https://pygments.org/download/][Pygments]] first. Then call =ccat= and =cless= (see [[Aliases]]).
- [[https://github.com/ptavares/zsh-direnv][direnv]] :: to support the [[https://direnv.net/][direnv]] virtual environment project.
- [[https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/mise/mise.plugin.zsh][mise]] :: to support the [[https://mise.jdx.dev/getting-started.html][mise]] virtual environment and tool project (instead of direnv). See the [[https://mise.jdx.dev/walkthrough.html][walk-through]].
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gnu-utils][gnu-utils]] :: bind the GNU flavor for standard utils, like =gfind= to the normal version, e.g. =find=.
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/iterm2][iterm2]] :: while fully configured below, configures the interaction with the MacOS application, [[https://www.iterm2.com/][iTerm2]].
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos][macos]] :: adds new functions that work better with MacOS terminals and the Finder. I like:
@ -258,7 +259,7 @@ Configure the plugins, making sure to not use =git=, as the aliases are a pain t
To have a plugin /install/, add its name to the =plugins= array variable /before/ we =source= the OMZ script:
#+begin_SRC zsh
plugins=(colorize direnv gnu-utils iterm2 macos virtualenv zbell zsh-syntax-highlighting)
plugins=(colorize direnv gnu-utils iterm2 macos mise virtualenv zbell zsh-syntax-highlighting)
#+END_SRC
Notice the =iterm2= plugin as well as the =macos= plugins that would be nice to figure out how to make them optionally added (although I believe they check themselves).