Compare commits
3 commits
0cbcc59c27
...
43fd32499e
Author | SHA1 | Date | |
---|---|---|---|
|
43fd32499e | ||
|
c1dd2a133a | ||
|
bc1b7a1c35 |
8 changed files with 64 additions and 89 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 "<tab> %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))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1300,8 +1300,8 @@ While filename extensions work fine most of the time, I don't like to pre-pend =
|
|||
:mode (rx (or (seq ".sh" eol)
|
||||
"/bin/"))
|
||||
:init
|
||||
(setq sh-basic-offset 2
|
||||
sh-indentation 2)
|
||||
(setq sh-basic-offset 4
|
||||
sh-indentation 4)
|
||||
:config
|
||||
(ha-auto-insert-file (rx (or (seq ".sh" eol)
|
||||
"/bin/"))
|
||||
|
|
|
@ -214,14 +214,6 @@ Let's begin by defining some variables used for communication between the functi
|
|||
See =ha-ssh-add-favorite-host= for easily adding to this list.")
|
||||
#+end_src
|
||||
|
||||
Also, let's make it easy for me to change my default shell:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar ha-shell "bash" ;; Eat works better with Bash/Zsh
|
||||
;; (string-trim (shell-command-to-string "type -p fish"))
|
||||
"The executable to the shell I want to use locally.")
|
||||
#+end_src
|
||||
|
||||
** Terminal Abstractions
|
||||
Could I abstract the different ways I start terminals in Emacs? The =ha-ssh-term= starts either a [[VTerm]]
|
||||
or [[Eat]] terminals, depending on what is available. This replaces (wraps) the default [[help:make-term][make-term]].
|
||||
|
@ -232,11 +224,11 @@ or [[Eat]] terminals, depending on what is available. This replaces (wraps) the
|
|||
The PROGRAM, if non-nil, is executed, otherwise, this is `ha-shell'.
|
||||
STARTFILE is the initial text given to the PROGRAM, and the
|
||||
SWITCHES are the command line options."
|
||||
(unless program (setq program ha-shell))
|
||||
(cond
|
||||
((fboundp 'vterm) (progn (vterm name)
|
||||
(vterm-send-string (append program switches))
|
||||
(vterm-send-return)))
|
||||
(when program
|
||||
(vterm-send-string (append program switches))
|
||||
(vterm-send-return))))
|
||||
((fboundp 'eat) (progn (switch-to-buffer
|
||||
(apply 'eat-make (append (list name program startfile)
|
||||
switches)))
|
||||
|
|
17
initialize
17
initialize
|
@ -23,6 +23,15 @@ gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40
|
|||
cat > "$HAMACS_DEST/early-init.el" <<EOF
|
||||
;;; early-init.el --- Hamacs Early Init -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; ▄████████ ▄▄▄▄███▄▄▄▄ ▄████████ ▄████████ ▄████████
|
||||
;; ███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███
|
||||
;; ███ █▀ ███ ███ ███ ███ ███ ███ █▀ ███ █▀
|
||||
;; ▄███▄▄▄ ███ ███ ███ ███ ███ ███ ███
|
||||
;; ▀▀███▀▀▀ ███ ███ ███▀███████████ ███ ▀███████████
|
||||
;; ███ █▄ ███ ███ ███ ███ ███ ███ █▄ ███
|
||||
;; ███ ███ ███ ███ ███ ███ ███ ███ ███ ▄█ ███
|
||||
;; ██████████ ▀█ ███ █▀ ███ █▀ ████████▀ ▄████████▀
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is my early Emacs configuration file. See init.el for the real
|
||||
|
@ -69,6 +78,14 @@ echo "Created $HAMACS_DEST/early-init.el"
|
|||
cat > "$HAMACS_DEST/init.el" <<EOF
|
||||
;;; init.el --- Hamacs Init -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; :::::::::: :::: :::: ::: :::::::: ::::::::
|
||||
;; :+: +:+:+: :+:+:+ :+: :+: :+: :+: :+: :+:
|
||||
;; +:+ +:+ +:+:+ +:+ +:+ +:+ +:+ +:+
|
||||
;; +#++:++# +#+ +:+ +#+ +#++:++#++: +#+ +#++:++#++
|
||||
;; +#+ +#+ +#+ +#+ +#+ +#+ +#+
|
||||
;; #+# #+# #+# #+# #+# #+# #+# #+# #+#
|
||||
;; ########## ### ### ### ### ######## ########
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is my Emacs Bootloader. Simply put, I initialize the package
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
;; )
|
||||
)
|
||||
(defsrc
|
||||
esc 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||
` 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||
tab q w e r t y u i o p [ ] \
|
||||
caps a s d f g h j k l ; ' ret
|
||||
lsft z x c v b n m , . / rsft
|
||||
|
|
Loading…
Reference in a new issue