From bc1b7a1c35d66c4971528e741ead1f7678b7efd5 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Fri, 3 Oct 2025 12:31:51 -0700 Subject: [PATCH] Update personal tab bar abstractions This also fixes a couple of bugs, most notably, the new Mastodon interface changes. --- bootstrap.org | 12 +++++++-- ha-aux-apps.org | 40 +++++++++++++++--------------- ha-config.org | 63 ++++++++---------------------------------------- ha-dashboard.org | 1 + initialize | 17 +++++++++++++ 5 files changed, 58 insertions(+), 75 deletions(-) diff --git a/bootstrap.org b/bootstrap.org index 73c2001..f0501dd 100644 --- a/bootstrap.org +++ b/bootstrap.org @@ -8,6 +8,15 @@ A literate programming file for bootstraping my Emacs Configuration. #+begin_src emacs-lisp :exports none ;;; bootstrap.el --- file for bootstraping my Emacs Configuration ;; + ;; ██████████ + ;; ░░███░░░░░█ + ;; ░███ █ ░ █████████████ ██████ ██████ █████ + ;; ░██████ ░░███░░███░░███ ░░░░░███ ███░░███ ███░░ + ;; ░███░░█ ░███ ░███ ░███ ███████ ░███ ░░░ ░░█████ + ;; ░███ ░ █ ░███ ░███ ░███ ███░░███ ░███ ███ ░░░░███ + ;; ██████████ █████░███ █████░░████████░░██████ ██████ + ;; ░░░░░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░ + ;; © 2021-2023 Howard X. Abrams ;; Licensed under a Creative Commons Attribution 4.0 International License. ;; See http://creativecommons.org/licenses/by/4.0/ @@ -220,8 +229,7 @@ The following /defines/ the rest of my org-mode literate files, that I load late "ha-org-publishing.org" "ha-email.org" "ha-aux-apps.org")) - ;; "ha-dashboard.org" - )) + "ha-dashboard.org")) "List of org files that complete the hamacs project.") #+end_src diff --git a/ha-aux-apps.org b/ha-aux-apps.org index c7690e3..1fe072e 100644 --- a/ha-aux-apps.org +++ b/ha-aux-apps.org @@ -55,33 +55,33 @@ I would like a dedicate perspective to Mastodon, and I would like a leader key s :config (major-mode-hydra-define mastodon-mode nil ("Timelines" - (("u" mastodon-tl--update "update") - ("F" mastodon-tl--get-federated-timeline "Federated") - ("H" mastodon-tl--get-home-timeline "Home") - ("L" mastodon-tl--get-local-timeline "Local") - ("T" mastodon-tl--get-tag-timeline "Hashtag")) + (("u" mastodon-tl-update "update") + ("F" mastodon-tl-get-federated-timeline "Federated") + ("H" mastodon-tl-get-home-timeline "Home") + ("L" mastodon-tl-get-local-timeline "Local") + ("T" mastodon-tl-get-tag-timeline "Hashtag")) "Specials" (("M" mastodon-notifications--get-mentions "Mentions") ("N" mastodon-notifications-get "Notifications") - ("A" mastodon-tl--followed-tags-timeline "All Tags") - ("S" mastodon-profile--view-bookmarks "Saved bookmarks") - ("O" mastodon-profile--my-profile "My Profile")) + ("A" mastodon-tl-followed-tags-timeline "All Tags") + ("S" mastodon-profile-view-bookmarks "Saved bookmarks") + ("O" mastodon-profile-my-profile "My Profile")) "Post" (("c" mastodon-toot "Compose toot") - ("e" mastodon-toot--edit-toot-at-point "Edit toot") - ("t" mastodon-tl--thread "Read thread") - ("r" mastodon-toot--reply "Reply") - ("m" mastodon-tl--dm-user "Direct Msg") - ("d" mastodon-toot--delete-toot "Delete")) + ("e" mastodon-toot-edit-toot-at-point "Edit toot") + ("t" mastodon-tl-thread "Read thread") + ("r" mastodon-toot-reply "Reply") + ("m" mastodon-tl-dm-user "Direct Msg") + ("d" mastodon-toot-delete-toot "Delete")) "Toot" - (("f" mastodon-toot--toggle-favourite "Favorite") - ("b" mastodon-toot--toggle-boost "Boost") - ("s" mastodon-toot--toggle-bookmark "Save") - ("y" mastodon-toot--copy-toot-url "Copy URL") - ("Y" mastodon-toot--copy-toot-text "Copy text")) + (("f" mastodon-toot-toggle-favourite "Favorite") + ("b" mastodon-toot-toggle-boost "Boost") + ("s" mastodon-toot-toggle-bookmark "Save") + ("y" mastodon-toot-copy-toot-url "Copy URL") + ("Y" mastodon-toot-copy-toot-text "Copy text")) "Navigation" - (("n" mastodon-tl--next-tab-item "next" :color pink) - ("p" mastodon-tl--previous-tab-item "previous" :color pink) + (("n" mastodon-tl-next-tab-item "next" :color pink) + ("p" mastodon-tl-previous-tab-item "previous" :color pink) ("," ha-mastodon-scroll-or-more "...more" :color pink)))))) #+end_src diff --git a/ha-config.org b/ha-config.org index b3f1013..971f2a3 100644 --- a/ha-config.org +++ b/ha-config.org @@ -990,44 +990,6 @@ New workspace is a tab with a specific name that opens up a specific buffer or a ((bufferp bff) (switch-to-buffer bff))))) #+end_src -With a new tab group for a directory or probably a project, let’s see if we can load the most useful files. - -#+begin_src emacs-lisp - (defun ha-tab-bar-new-default () - "Given a new perspective, display some buffer windows. - The choice of files to display depends on a combination of READMEs and - most recently viewed files in the project. This function assumes the - variable `default-directory' contains the root of the project." - (cl-flet ((one-win (file) (find-file file)) - (two-win (left right) - (find-file right) - (split-window-right) - (find-file left)) - (in-project (file) - (string-match (rx bos (literal default-directory)) - (expand-file-name file)))) - (let* ((recent-files (seq-filter #'in-project recentf-list)) - (recent (car recent-files)) - (readme-org (expand-file-name "README.org")) - (readme-md (expand-file-name "README.md"))) - (cond - ;; ORG + recent - ((and (file-exists-p recent) (file-exists-p readme-org)) - (two-win readme-org recent)) - ;; MD + recent - ((and (file-exists-p recent) (file-exists-p readme-md)) - (two-win readme-md recent)) - ;; recent-only - ((file-exists-p recent) - (one-win recent)) - ;; ORG only - ((file-exists-p readme-org) - (one-win readme-org)) - ;; MD only - ((file-exists-p readme-md) - (one-win readme-md)))))) -#+end_src - Create a new tab associated with a project: #+begin_src emacs-lisp @@ -1038,8 +1000,7 @@ Create a new tab associated with a project: (let ((name (project-name (project-current nil project-dir))) (default-directory project-dir)) (ha-tab-bar-new name) - (project-switch-project project-dir) - (ha-tab-bar-new-default))) + (project-switch-project project-dir))) #+end_src If we close a tab that is a project, we want to close all the buffers associated with it. I wouldn’t do this if it wasn’t so easy to re-create them: @@ -1086,7 +1047,7 @@ And some shortcut keys from the =general= project: I want to quickly jump, by the number shown on the tab, to that grouping. The following two functions create leader sequences with the name of the tab group: #+BEGIN_SRC emacs-lisp - (defun ha-tab-update-names () + (defun ha-tab-bar-update-names () "Create normal-mode keybindings for the tab groupings. This creates `SPC TAB 1' to jump to the first tab, etc." ;; Remove all previously created keybindings: @@ -1095,9 +1056,9 @@ I want to quickly jump, by the number shown on the tab, to that grouping. The fo (general-nmap :prefix "SPC" (format " %d" indx) nil))) ;; Loop through the existing tabs, create keys for each: - (seq-do-indexed 'ha-tab-update-tab-keybinding (tab-bar-tabs))) + (seq-do-indexed 'ha-tab-bar-update-tab-keybinding (tab-bar-tabs))) - (defun ha-tab-update-tab-keybinding (tab-deets indx) + (defun ha-tab-bar-update-tab-keybinding (tab-deets indx) "Create a keybinding to jump to tab described by TAB-DEETS. The key sequence, `SPC' `TAB' then INDX." (let ((name (alist-get 'name tab-deets))) @@ -1107,14 +1068,14 @@ I want to quickly jump, by the number shown on the tab, to that grouping. The fo (lambda () (interactive) (tab-bar-select-tab ,(1+ indx))))))) #+END_SRC -Any time I create or delete a new tab, we can call =ha-tab-update-names=: +Any time I create or delete a new tab, we can call =ha-tab-bar-update-names=: #+BEGIN_SRC emacs-lisp - (advice-add #'tab-bar-new-tab :after #'ha-tab-update-names) - (advice-add #'tab-bar-close-tab :after #'ha-tab-update-names) - (advice-add #'tab-bar-close-other-tabs :after #'ha-tab-update-names) + (advice-add #'tab-bar-new-tab :after #'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-update-names) + (add-hook desktop-after-read-hook #'ha-tab-bar-update-names) #+END_SRC * Pretty Good Encryption @@ -1143,12 +1104,8 @@ Also, as [[https://www.bytedude.com/gpg-in-emacs/][bytedude]] mentions, I need t ;; Make sure we prompt in the minibuffer for the password: (epg-pinentry-mode 'loopback) ;; I trust my Emacs session, so I don't bother expiring my pass: - (auth-source-cache-expiry nil)) -#+end_src + (auth-source-cache-expiry nil) -Need to make sure that Emacs will handle the prompts, and turn it on: -#+begin_src emacs-lisp - (use-package epa-file :config (setenv "GPG_AGENT_INFO" nil) (epa-file-enable)) diff --git a/ha-dashboard.org b/ha-dashboard.org index c9a9a0b..2b62974 100644 --- a/ha-dashboard.org +++ b/ha-dashboard.org @@ -173,6 +173,7 @@ The [[https://github.com/emacs-dashboard/emacs-dashboard][emacs-dashboard]] proj ;; :hook (dashboard-after-initialize . ha-dashboard) :config + (tab-bar-switch-to-tab "main") (dashboard-setup-startup-hook)) #+end_src diff --git a/initialize b/initialize index b04a962..a4c96a3 100755 --- a/initialize +++ b/initialize @@ -23,6 +23,15 @@ gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40 cat > "$HAMACS_DEST/early-init.el" < "$HAMACS_DEST/init.el" <