diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-25 17:05:06 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-25 17:05:06 -0500 |
| commit | 692b44d648472fdf52048f6040d223ea7befe755 (patch) | |
| tree | 8ec08f4463640a720476c2901cd9e1cbee418b1f | |
| parent | a5555afaf09be4c023f49661d48de803b2586927 (diff) | |
removed unnecessary hardcoded paths & fixed a typo
- defined constants for all commonly used paths
- replaced hardcoded instances throughout the config with the variables
- fixed typo in scripts/reset-to-first-launch.sj
| -rw-r--r-- | TODO.org | 219 | ||||
| -rw-r--r-- | modules/ai-config.el | 4 | ||||
| -rw-r--r-- | modules/calibredb-epub-config.el | 4 | ||||
| -rw-r--r-- | modules/dirvish-config.el | 121 | ||||
| -rw-r--r-- | modules/elfeed-config.el | 2 | ||||
| -rw-r--r-- | modules/epa-config.el | 3 | ||||
| -rw-r--r-- | modules/games-config.el | 5 | ||||
| -rw-r--r-- | modules/mail-config.el | 26 | ||||
| -rw-r--r-- | modules/modeline-config.el | 4 | ||||
| -rw-r--r-- | modules/prog-general.el | 3 | ||||
| -rw-r--r-- | modules/prog-training.el | 2 | ||||
| -rw-r--r-- | modules/system-utils.el | 5 | ||||
| -rw-r--r-- | modules/user-constants.el | 50 | ||||
| -rwxr-xr-x | scripts/reset-to-first-launch.sh | 2 |
14 files changed, 244 insertions, 206 deletions
@@ -566,7 +566,7 @@ Please note that =-i= is case-insensitive for the searched term, not for the fil #+END_QUOTE [[][]] Captured On: [2024-04-18 Thu 06:15] -* DOING Emacs Config v0.7 [2/5] +* DOING Emacs Config v0.7 [2/4] ** DONE Supplement Existing Functionality [9/9] *** DONE [#B] Make sure eshell has same path as other shells CLOSED: [2024-03-27 Wed 14:02] @@ -704,7 +704,7 @@ This is the result of overriding that function in cj/invincible-buffers in syste *** DONE [#C] Bookmark-save-flag Replaces Bookmark-set-and-save CLOSED: [2024-04-03 Wed 15:00] remove cj/bookmark-set-and-save if setting bookmark-save-flat to 1 saves when adding/modifying a bookmark -** DOING Open v0.7 Fit and Finish (ends 2024.04.20) [1/5] +** DOING Open v0.7 Fit and Finish (ends 2024.04.20) [0/3] *** DOING [#B] Save All Attachments Working in Mu4e **** 2024-04-18 Thu @ 05:55:32 -0500 The Documentation Suggests A Path Forward This suggests that if I'm writing another function, I should @@ -815,101 +815,6 @@ Adding /usr/local/bin to your PATH can save you some keystrokes if you are doing #+END_QUOTE [[https://wiki.archlinux.org/title/msmtp#Using_msmtp_offline][msmtp - ArchWiki]] Captured On: [2024-04-13 Sat 09:35] -*** DOING [#C] Remove all unnecessarily hardcoded filenames and paths -**** DONE Fix hardcoded in org-roam - -(defconst roam-dir (concat sync-dir "roam/") - "The location of org-roam files.") - -./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/") -./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org") -./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org") -./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org") -./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org") -./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org")) -./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org")) -./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org")) -./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org" -**** TODO Create constant for ~/.authinfo.gpg -./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg"))) -./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg") -**** TODO Use constants for search path in prog-general -./modules/prog-general.el:84: (projectile-project-search-path '("~/code" -./modules/prog-general.el:85: "~/projects")) -**** TODO Make initial go menu locations the constants -./modules/dirvish-config.el:55: '(("h" "~/" "home") -./modules/dirvish-config.el:58: ("co" "~/code" "code") -./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles") -./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads") -./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files") -./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents") -./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents") -./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course") -./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash") -./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists") -./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video") -./modules/dirvish-config.el:68: ("mx" "~/music/" "music") -./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube") -./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync") -./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists") -./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects") -./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots") -./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper") -./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures") -./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games") -./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos"))) -**** TODO mu4e mail directory constant -./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts -./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/")) -**** TODO create videos constant -./modules/elfeed-config.el:129: (let ((default-directory "~/videos")) -**** full ripgrep results searching for "~/" -./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/") -./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org") -./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org") -./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org") -./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org") -./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org")) -./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org")) -./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org")) -./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org" -./modules/modeline-config.el:14:(defvar feebleline-working-directory "~/code/feebleline" -./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg")) -./modules/prog-general.el:84: (projectile-project-search-path '("~/code" -./modules/prog-general.el:85: "~/projects")) -./modules/prog-go.el:35: (add-to-list 'exec-path "~/go/bin") -./modules/dirvish-config.el:55: '(("h" "~/" "home") -./modules/dirvish-config.el:58: ("co" "~/code" "code") -./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles") -./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads") -./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files") -./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents") -./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents") -./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course") -./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash") -./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists") -./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video") -./modules/dirvish-config.el:68: ("mx" "~/music/" "music") -./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube") -./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync") -./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists") -./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects") -./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots") -./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper") -./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures") -./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games") -./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos"))) -./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg"))) -./modules/eww-config.el:24: (setq url-cookie-file "~/.local/share/cookies.txt") -./modules/prog-training.el:25: (setq leetcode-directory "~/code/leetcode") -./modules/games-config.el:27: (setq malyon-stories-directory "~/sync/org/text.games/")) -./modules/prog-lisp.el:24:;; (load (expand-file-name "~/quicklisp/slime-helper.el")) -./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts -./modules/mail-config.el:195: ;; (setq smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg")) -./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/")) -./modules/calibredb-epub-config.el:27: (setq calibredb-root-dir "~/sync/books/") -./modules/calibredb-epub-config.el:28: (setq calibredb-library-alist '(("~/sync/books/"))) -./modules/elfeed-config.el:129: (let ((default-directory "~/videos")) *** TODO [#C] Articles Should Be Saved Under todo.org TO READ Heading **** 2024-04-16 Tue @ 10:28:17 -0500 Notes This involves changing webclipper. Webclipper as it is now doesn't return the content, it actually yanks it into the article-file. @@ -1167,6 +1072,126 @@ CLOSED: [2024-04-25 Thu 14:15] - [X] org-contacts - [X] org-drill - [X] org-export +**** DONE [#C] Remove all unnecessarily hardcoded filenames and paths [6/6] +CLOSED: [2024-04-25 Thu 16:53] +:LOGBOOK: +- State "DONE" from "DOING" [2024-04-25 Thu 16:53] +:END: + +***** DONE mu4e mail directory constant +CLOSED: [2024-04-25 Thu 16:53] +:LOGBOOK: +- State "DONE" from "TODO" [2024-04-25 Thu 16:53] +:END: +./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts +./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/")) +***** DONE create videos constant +CLOSED: [2024-04-25 Thu 16:28] +:LOGBOOK: +- State "DONE" from "TODO" [2024-04-25 Thu 16:28] +:END: +./modules/elfeed-config.el:129: (let ((default-directory "~/videos")) +***** DONE Create constant for ~/.authinfo.gpg +CLOSED: [2024-04-25 Thu 15:59] +:LOGBOOK: +- State "DONE" from "TODO" [2024-04-25 Thu 15:59] +:END: +./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg"))) +./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg") +***** DONE Fix hardcoded in org-roam + +(defconst roam-dir (concat sync-dir "roam/") + "The location of org-roam files.") + +./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/") +./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org") +./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org") +./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org") +./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org") +./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org")) +./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org")) +./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org")) +./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org" +***** DONE Make initial go menu locations the constants +CLOSED: [2024-04-25 Thu 15:52] +:LOGBOOK: +- State "DONE" from "TODO" [2024-04-25 Thu 15:52] +:END: +./modules/dirvish-config.el:55: '(("h" "~/" "home") +./modules/dirvish-config.el:58: ("co" "~/code" "code") +./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles") +./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads") +./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files") +./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents") +./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents") +./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course") +./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash") +./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists") +./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video") +./modules/dirvish-config.el:68: ("mx" "~/music/" "music") +./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube") +./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync") +./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists") +./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects") +./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots") +./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper") +./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures") +./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games") +./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos"))) +***** DONE Use constants for search path in prog-general +CLOSED: [2024-04-25 Thu 14:44] +:LOGBOOK: +- State "DONE" from "TODO" [2024-04-25 Thu 14:44] +:END: +./modules/prog-general.el:84: (projectile-project-search-path '("~/code" +./modules/prog-general.el:85: "~/projects")) +***** full ripgrep results searching for "~/" +./modules/org-roam-config.el:16: (org-roam-directory "~/sync/org/roam/") +./modules/org-roam-config.el:27: ("v" "v2mom" plain (file "~/sync/org/roam/templates/v2mom.org") +./modules/org-roam-config.el:30: ("r" "recipe" plain (file "~/sync/org/roam/templates/recipe.org") +./modules/org-roam-config.el:33: ("p" "project" plain (file "~/sync/org/roam/templates/project.org") +./modules/org-roam-config.el:36: ("t" "topic" plain (file "~/sync/org/roam/templates/topic.org") +./modules/org-roam-config.el:116: (cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org")) +./modules/org-roam-config.el:121: (cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org")) +./modules/org-roam-config.el:126: (cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org")) +./modules/org-roam-config.el:146: :if-new (file+head+olp "~/sync/org/roam/inbox.org" +./modules/modeline-config.el:14:(defvar feebleline-working-directory "~/code/feebleline" +./modules/epa-config.el:15: (setq auth-sources '("~/.authinfo.gpg")) +./modules/prog-general.el:84: (projectile-project-search-path '("~/code" +./modules/prog-general.el:85: "~/projects")) +./modules/prog-go.el:35: (add-to-list 'exec-path "~/go/bin") +./modules/dirvish-config.el:55: '(("h" "~/" "home") +./modules/dirvish-config.el:58: ("co" "~/code" "code") +./modules/dirvish-config.el:59: ("df" "~/.dotfiles/" "dotfiles") +./modules/dirvish-config.el:60: ("dn" "~/downloads/" "downloads") +./modules/dirvish-config.el:61: ("dr" "~/sync/org/drill/" "org drill files") +./modules/dirvish-config.el:62: ("dt" "~/downloads/torrents/complete/" "torrents") +./modules/dirvish-config.el:63: ("dx" "~/documents/" "documents") +./modules/dirvish-config.el:64: ("gc" "~/code/golangcourse" "golang course") +./modules/dirvish-config.el:65: ("lt" "~/.local/share/Trash" "trash") +./modules/dirvish-config.el:66: ("mp" "~/sync/playlists/" "playlists") +./modules/dirvish-config.el:67: ("mv" "~/magic/video/" "magic/video") +./modules/dirvish-config.el:68: ("mx" "~/music/" "music") +./modules/dirvish-config.el:69: ("my" "~/magic/youtube/" "magic/youtube") +./modules/dirvish-config.el:70: ("or" "~/sync/org/" "sync") +./modules/dirvish-config.el:71: ("pl" "~/sync/playlists" "playlists") +./modules/dirvish-config.el:72: ("pr" "~/projects/" "projects") +./modules/dirvish-config.el:73: ("ps" "~/pictures/screenshots/" "screenshots") +./modules/dirvish-config.el:74: ("pw" "~/pictures/wallpaper" "wallpaper") +./modules/dirvish-config.el:75: ("px" "~/pictures/" "pictures") +./modules/dirvish-config.el:76: ("tg" "~/sync/org/text.games" "text games") +./modules/dirvish-config.el:77: ("vx" "~/videos/" "videos"))) +./modules/ai-config.el:52: (setq auth-sources '((:source "~/.authinfo.gpg"))) +./modules/eww-config.el:24: (setq url-cookie-file "~/.local/share/cookies.txt") +./modules/prog-training.el:25: (setq leetcode-directory "~/code/leetcode") +./modules/games-config.el:27: (setq malyon-stories-directory "~/sync/org/text.games/")) +./modules/prog-lisp.el:24:;; (load (expand-file-name "~/quicklisp/slime-helper.el")) +./modules/mail-config.el:43: (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts +./modules/mail-config.el:195: ;; (setq smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg")) +./modules/mail-config.el:207:;; (setq smtpmail-queue-dir "~/.mail/queued-mail/")) +./modules/calibredb-epub-config.el:27: (setq calibredb-root-dir "~/sync/books/") +./modules/calibredb-epub-config.el:28: (setq calibredb-library-alist '(("~/sync/books/"))) +./modules/elfeed-config.el:129: (let ((default-directory "~/videos")) ** DOING Complete v0.7 Release Checklist [8/11] *** DOING Fit and Finish Period *** TODO Clean Launch from Archsetup diff --git a/modules/ai-config.el b/modules/ai-config.el index e4ef932e..01b089ce 100644 --- a/modules/ai-config.el +++ b/modules/ai-config.el @@ -50,8 +50,8 @@ . "You are a large language model and a conversation partner. Respond concisely."))) - ;; grab the secret from ~/.authinfo.gpg - (setq auth-sources '((:source "~/.authinfo.gpg"))) + ;; grab the secret from the auth file + (setq auth-sources `((:source ,authinfo-file))) (setq gptel-api-key (auth-source-pick-first-password :host "api.openai.com"))) (provide 'ai-config) diff --git a/modules/calibredb-epub-config.el b/modules/calibredb-epub-config.el index 11aca93d..db86dd1e 100644 --- a/modules/calibredb-epub-config.el +++ b/modules/calibredb-epub-config.el @@ -24,8 +24,8 @@ ("l" . calibredb-filter-by-tag)) :config ;; basic config - (setq calibredb-root-dir "~/sync/books/") - (setq calibredb-library-alist '(("~/sync/books/"))) + (setq calibredb-root-dir books-dir) + (setq calibredb-library-alist (list books-dir)) (setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir)) (setq calibredb-program "/usr/bin/calibredb") (setq calibredb-preferred-format "epub") diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el index 12f67519..d5dc6c33 100644 --- a/modules/dirvish-config.el +++ b/modules/dirvish-config.el @@ -17,7 +17,7 @@ (:map dired-mode-map ([remap dired-summary] . which-key-show-major-mode) ("E" . wdired-change-to-wdired-mode) ;; edit names/properties in buffer - ("e" . cj/dired-ediff-files)) ;; ediff files + ("e" . cj/dired-ediff-files)) ;; ediff files :custom (dired-use-ls-dired nil) ;; non GNU FreeBSD doesn't support a "--dired" switch :config @@ -31,6 +31,20 @@ ;; (add-hook 'dired-mode-hook 'auto-revert-mode) ;; auto revert dired when files change +;; ------------------------------ Dired Open With ------------------------------ + + +(defun cj/dired-open-with (command) + "Open the dired file at point with a user-specified COMMAND. +This function is meant to be called interactively. It prompts for the command to +open the file with if called without a parameter. The command runs +asynchronously and its output is saved in a buffer, but the buffer is not +automatically displayed." + (interactive "sCommand to use to open the file: ") + (let* ((file (dired-get-file-for-visit)) + (buff (generate-new-buffer (concat "*dired-open-with output: " file "*")))) + (start-process-shell-command command buff (concat command " " file)))) + ;; -------------------------- Dired Copy Path As Kill -------------------------- ;; copies the full path of the file at point to the clipboard @@ -38,11 +52,11 @@ "Copy the full path of file at point in dired to the clipboard." (interactive) (let ((filename (dired-get-file-for-visit))) - (if (and filename (file-exists-p filename)) - (progn - (kill-new filename) - (message "Copied '%s' to clipboard." filename)) - (message "No file at point.")))) + (if (and filename (file-exists-p filename)) + (progn + (kill-new filename) + (message "Copied '%s' to clipboard." filename)) + (message "No file at point.")))) ;; ------------------------ Dired Convert Image To Jpeg ------------------------ ;; converts the image at point to a jpeg @@ -50,16 +64,16 @@ (defun cj/dired-convert-image-to-jpeg () (interactive) (let* ((original-file (dired-get-file-for-visit)) - (file-extension (file-name-extension original-file)) - (jpeg-file (concat (file-name-sans-extension original-file) ".jpeg"))) - (if (member file-extension '("png" "bmp" "gif" "tif" "tiff" "svg" "webp")) - (if (string= file-extension "jpeg") - (message "File is already in JPEG format.") - (start-process "convert-to-jpeg" nil "convert" original-file jpeg-file) - (message "Conversion started for %s" original-file)) - (message (concat "File is not a supported image file type." - "Current supported types: " - "'png' 'bmp' 'gif' 'tif' 'tiff' 'svg' 'webp'"))))) + (file-extension (file-name-extension original-file)) + (jpeg-file (concat (file-name-sans-extension original-file) ".jpeg"))) + (if (member file-extension '("png" "bmp" "gif" "tif" "tiff" "svg" "webp")) + (if (string= file-extension "jpeg") + (message "File is already in JPEG format.") + (start-process "convert-to-jpeg" nil "convert" original-file jpeg-file) + (message "Conversion started for %s" original-file)) + (message (concat "File is not a supported image file type." + "Current supported types: " + "'png' 'bmp' 'gif' 'tif' 'tiff' 'svg' 'webp'"))))) ;; ------------------------ Dired Mark All Visible Files ----------------------- ;; convenience function to mark all visible files in dired @@ -81,30 +95,26 @@ :after dired :custom (dirvish-quick-access-entries - '(("h" "~/" "home") + `(("h" ,user-home-dir "home") + ("cx" ,code-dir "code diredtory") + ("ws" ,(concat code-dir "/website") "website staging") + ("dr" ,(concat sync-dir "/drill/") "drill files") + ("s" ,sync-dir "sync directory") + ("mp" ,(concat sync-dir "/playlists") "music playlists") + ("px" ,projects-dir "projects directory") + ("tg" ,(concat sync-dir "/text.games") "text games") + ("ps" ,(concat pix-dir "/screenshots/") "pictures screenshots") + ("pw" ,(concat pix-dir "/wallpaper/") "pictures wallpaper") + ("px" ,pix-dir "pictures directory") + ("dl" ,dl-dir "downloads") + ("dt" ,(concat dl-dir "/torrents/complete/") "torrents") + ("vx" ,videos-dir "videos") + ("df" "~/.dotfiles/" "dotfiles") + ("dx" "~/documents/" "documents") + ("mx" "~/music/" "music") + ("rcj" "/sshx:cjennings@cjennings.net:~" "remote cjennings.net") ("rsb" "/sshx:cjennings@wolf.usbx.me:/home/cjennings/" "remote seedbox") - ("rcj" "/sshx:cjennings@cjennings.net:~" "remote cjennings.net") - ("co" "~/code" "code") - ("cj" "~/code/cjennings-net" "cjennings.net hugo") - ("df" "~/.dotfiles/" "dotfiles") - ("dn" "~/downloads/" "downloads") - ("dr" "~/sync/org/drill/" "org drill files") - ("dt" "~/downloads/torrents/complete/" "torrents") - ("dx" "~/documents/" "documents") - ("gc" "~/code/golangcourse" "golang course") - ("lt" "~/.local/share/Trash" "trash") - ("mp" "~/sync/playlists/" "playlists") - ("mv" "~/magic/video/" "magic/video") - ("mx" "~/music/" "music") - ("my" "~/magic/youtube/" "magic/youtube") - ("or" "~/sync/org/" "sync") - ("pl" "~/sync/playlists" "playlists") - ("pr" "~/projects/" "projects") - ("ps" "~/pictures/screenshots/" "screenshots") - ("pw" "~/pictures/wallpaper" "wallpaper") - ("px" "~/pictures/" "pictures") - ("tg" "~/sync/org/text.games" "text games") - ("vx" "~/videos/" "videos"))) + )) ;; end dirvish-quick-access-entries (dirvish-attributes '(vscode-icon file-size)) (dirvish-override-dired-mode t) (dirvish-preview-dispatchers '(image gif video audio epub pdf archive)) @@ -124,8 +134,9 @@ ("bg" . (lambda () (interactive) ; set background image (shell-command (concat "nitrogen --save --set-zoom-fill " (dired-file-name-at-point) " >>/dev/null 2>&1" )))) - ("Z" . (lambda () (interactive) (cj/open-file-with-command "zathura"))) - ("P" . (lambda () (interactive) (cj/open-file-with-command "gimp"))) + ("Z" . (lambda () (interactive) (cj/dired-open-with "zathura"))) + ("P" . (lambda () (interactive) (cj/dired-open-with "gimp"))) + ("O" . (lambda () (interactive) (call-interactively 'cj/dired-open-with))) ("<left>" . dired-up-directory) ("<right>" . dired-find-file) ("f" . dirvish-file-info-menu) @@ -194,20 +205,20 @@ "Ediff two selected files within Dired." (interactive) (let ((files (dired-get-marked-files)) - (wnd (current-window-configuration))) - (if (<= (length files) 2) - (let ((file1 (car files)) - (file2 (if (cdr files) - (cadr files) - (read-file-name - "file: " - (dired-dwim-target-directory))))) - (if (file-newer-than-file-p file1 file2) - (ediff-files file2 file1) - (ediff-files file1 file2)) - (add-hook 'ediff-after-quit-hook-internal - (lambda () - (setq ediff-after-quit-hook-internal nil) + (wnd (current-window-configuration))) + (if (<= (length files) 2) + (let ((file1 (car files)) + (file2 (if (cdr files) + (cadr files) + (read-file-name + "file: " + (dired-dwim-target-directory))))) + (if (file-newer-than-file-p file1 file2) + (ediff-files file2 file1) + (ediff-files file1 file2)) + (add-hook 'ediff-after-quit-hook-internal + (lambda () + (setq ediff-after-quit-hook-internal nil) (set-window-configuration wnd)))) (error "No more than 2 files should be marked")))) diff --git a/modules/elfeed-config.el b/modules/elfeed-config.el index 4d4a80d1..076b6f1f 100644 --- a/modules/elfeed-config.el +++ b/modules/elfeed-config.el @@ -127,7 +127,7 @@ (defun cj/yt-dl-it (url) "Downloads the URL in an async shell." - (let ((default-directory "~/videos")) + (let ((default-directory videos-dir)) (save-window-excursion (async-shell-command (format "tsp yt-dlp --add-metadata -ic -o '%%(channel)s-%%(title)s.%%(ext)s' '%s'" url))))) diff --git a/modules/epa-config.el b/modules/epa-config.el index 0e3972a0..8d902ae4 100644 --- a/modules/epa-config.el +++ b/modules/epa-config.el @@ -12,8 +12,7 @@ :ensure nil ;; built in :demand t ;; load this package early :config - (setq auth-sources '("~/.authinfo.gpg")) - ;; (setq auth-sources '((:source "~/.authinfo.gpg"))) + (setq auth-sources `(,authinfo-file)) (setenv "GPG_AGENT_INFO" nil) ;; emacs use internal prompt, not gpg agent (setq auth-source-debug t)) ;; echo debug info to Messages diff --git a/modules/games-config.el b/modules/games-config.el index e0439630..eab245e7 100644 --- a/modules/games-config.el +++ b/modules/games-config.el @@ -24,7 +24,7 @@ (use-package malyon :defer 1 :config - (setq malyon-stories-directory "~/sync/org/text.games/")) + (setq malyon-stories-directory (concat sync-dir "text.games/")) ;; ------------------------------------ 2048 ----------------------------------- ;; combine numbered tiles to create the elusive number 2048. @@ -37,7 +37,8 @@ :defer 1 :config (setq chess-default-display 'chess-images) - (setq chess-images-directory (concat user-emacs-directory "assets/chess/pieces/xboard/")) + (setq chess-images-directory + (concat user-emacs-directory "assets/chess/pieces/xboard/")) (setq chess-images-dark-color "#779556") (setq chess-images-light-color "#EBECD0") (setq chess-images-default-size 100) diff --git a/modules/mail-config.el b/modules/mail-config.el index ac982814..2d9288ac 100644 --- a/modules/mail-config.el +++ b/modules/mail-config.el @@ -40,7 +40,7 @@ (setq mu4e-confirm-quit nil) ;; don't ask when quitting (setq mu4e-context-policy 'pick-first) ;; start with the first (default) context (setq mu4e-headers-auto-update nil) ;; updating headers buffer on email is too jarring - (setq mu4e-root-maildir "~/.mail") ;; root directory for all email accounts + (setq mu4e-root-maildir mail-dir) ;; root directory for all email accounts (setq mu4e-sent-messages-behavior 'delete) ;; don't save to "Sent", IMAP does this already (setq mu4e-show-images t) ;; show embedded images (setq mu4e-update-interval nil) ;; don't update automatically @@ -149,15 +149,14 @@ ;; ----------------------------- Compose Mode Hydra ---------------------------- -;; menu available in compose mode +;; WIP: menu available in compose mode (defhydra hydra-mu4e-compose (:color blue :timeout 10 :hint nil) "Compose Mode Menu\n\n" ("q" quit-window "Quit" :column "") ("a" mail-add-attachment "Add Attachment" :column "") ("r" message-new-line-and-reformat "Newline and Reformat" :column "") - ("d" message-delete-not-region "Delete Outside Region" :column "") - ) + ("d" message-delete-not-region "Delete Outside Region" :column "")) (defun mu4e-compose-mode-hook-hydra-setup () "Create hydra/menu keybinding when entering compose mode." @@ -177,34 +176,17 @@ Prompts user for the action when executing." ;;; ------------------ Smtpmail & Easy PG Assistant ----------------- -;; Send Mail to smtp host from smtpmail temp buffer. +;; send mail to smtp host from smtpmail temp buffer. (use-package smtpmail :ensure nil ;; built-in :defer .5 :config - ;; (require 'epa-file) - ;; (epa-file-enable) - ;; (setq epa-pinentry-mode 'loopback) - ;; (auth-source-forget-all-cached) - (setq message-kill-buffer-on-exit t) ;; don't keep compose buffers after sending (setq sendmail-program (executable-find "msmtp")) (setq send-mail-function 'message-send-mail-with-sendmail message-send-mail-function 'message-send-mail-with-sendmail) (setq message-sendmail-envelope-from 'header) - ;; (setq smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg")) - ;; (setq starttls-use-gnutls t) - ;; (setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))) - ;; (setq smtpmail-default-smtp-server "smtp.gmail.com") - ;; (setq smtpmail-smtp-server "smtp.gmail.com") - ;; (setq smtpmail-smtp-service 587) (setq smtpmail-debug-info t)) -;; BUG: queuing mu4e email doesn't currently work. -;; if you need offline mode, set these -- and create the queue dir -;; with 'mu mkdir', i.e.. mu mkdir ~/.mail/queued-mail/" -;; (setq smtpmail-queue-mail nil) -;; (setq smtpmail-queue-dir "~/.mail/queued-mail/")) - (provide 'mail-config) ;;; mail-config.el ends here diff --git a/modules/modeline-config.el b/modules/modeline-config.el index cea31660..6e45fc43 100644 --- a/modules/modeline-config.el +++ b/modules/modeline-config.el @@ -11,11 +11,13 @@ ;;; Code: -(defvar feebleline-working-directory "~/code/feebleline" +(defvar feebleline-working-directory (concat code-dir "/feebleline") "The working directory for the feebleline mode line.") ;; --------------------------------- Feebleline -------------------------------- ;; ultrathin simple modeline. adds only useful info to echo area. +;; working on a patch to fix a few issues +;; load the non-packaged version only if the directory exists (use-package feebleline :if (file-readable-p feebleline-working-directory) diff --git a/modules/prog-general.el b/modules/prog-general.el index 2338564f..ee25c62b 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -81,8 +81,7 @@ If none exists, it opens magit-status." ("r" . projectile-replace-regexp)) :custom (projectile-auto-discover nil) - (projectile-project-search-path '("~/code" - "~/projects")) + (projectile-project-search-path `(,code-dir ,projects-dir)) :config ;; scan for projects if none are defined (cj/projectile-schedule-project-discovery) diff --git a/modules/prog-training.el b/modules/prog-training.el index 801b1982..bada3a0b 100644 --- a/modules/prog-training.el +++ b/modules/prog-training.el @@ -22,7 +22,7 @@ (url-debug t) :config (setq leetcode-prefer-language "golang") - (setq leetcode-directory "~/code/leetcode") + (setq leetcode-directory (concat code-dir "/leetcode")) (setq leetcode-save-solutions t)) diff --git a/modules/system-utils.el b/modules/system-utils.el index 0ec287b9..bc1bba64 100644 --- a/modules/system-utils.el +++ b/modules/system-utils.el @@ -106,10 +106,11 @@ With a prefix argument, add the TARGET-BUFFER to \='cj/buffer-bury-alive-list\=' ;; opens the current buffer's file with a command. Prompts if interactive. (defun cj/open-file-with-command (command) - "Asynchronously open the file for the current buffer with a specified COMMAND. + "Asynchronously open the file assocated with the current buffer with COMMAND. Don't automatically display output buffers, but keep them in buffer list." (interactive "MOpen with program: ") - (let ((display-buffer-keywords '(("*Async Shell Command*" display-buffer-no-window (nil))))) + (let ((display-buffer-keywords + '(("*Async Shell Command*" display-buffer-no-window (nil))))) (add-to-list 'display-buffer-alist display-buffer-keywords)) (async-shell-command (format "%s \"%s\"" command buffer-file-name))) diff --git a/modules/user-constants.el b/modules/user-constants.el index 6ed74d37..97cba1f4 100644 --- a/modules/user-constants.el +++ b/modules/user-constants.el @@ -10,55 +10,73 @@ ;; ------------------------ Directory And File Constants ----------------------- ;; DIRECTORIES -(defconst user-home-dir (getenv "HOME") - "The user's home directory per the environment variable.") - (defconst emacs-init-file (concat user-emacs-directory "init.el") "The location of Emacs's main init file.") (defconst emacs-early-init-file (concat user-emacs-directory "early-init.el") "The location of Emacs's early init file.") -(defconst code-dir (concat user-home-dir "/code/") +(defconst user-home-dir (getenv "HOME") + "The user's home directory per the environment variable.") + +(defconst books-dir (concat user-home-dir "/sync/books/") + "The location of org-roam files.") + +(defconst code-dir (concat user-home-dir "/code/") "Code repositories are located in this directory.") -(defconst projects-dir (concat user-home-dir "/projects/") +(defconst dl-dir (concat user-home-dir "/downloads/") + "Location of the general downloads directory.") + +(defconst pix-dir (concat user-home-dir "/pictures/") + "Location of where pictures and images are stored.") + +(defconst projects-dir (concat user-home-dir "/projects/") "Non-code projects and repositories are located in this directory.") -(defconst sync-dir (concat user-home-dir "/sync/org/") +(defconst videos-dir (concat user-home-dir "/videos/") + "Location of where videos are stored.") + +(defconst mail-dir (concat user-home-dir ".mail/") + "Root directory where the mail folders are located.") + +(defconst sync-dir (concat user-home-dir "/sync/org/") "This directory is synchronized across machines.") -(defconst roam-dir (concat sync-dir "roam/") +(defconst roam-dir (concat sync-dir "roam/") "The location of org-roam files.") -(defconst drill-dir (concat sync-dir "drill/") +(defconst drill-dir (concat sync-dir "drill/") "The location of org-drill org files.") -(defconst snippets-dir (concat sync-dir "snippets/") +(defconst snippets-dir (concat sync-dir "snippets/") "The location of ya-snippet snippets.") ;; FILES -(defvar schedule-file (concat sync-dir "schedule.org") +(defvar schedule-file (concat sync-dir "schedule.org") "The location of the org file containing scheduled events.") -(defvar inbox-file (concat roam-dir "inbox.org") +(defvar inbox-file (concat roam-dir "inbox.org") "The location of the org file that serves as the task inbox.") -(defvar contacts-file (concat sync-dir "contacts.org") +(defvar contacts-file (concat sync-dir "contacts.org") "The location of the org file containing org-contacts information.") -(defvar article-file (concat sync-dir "article-inbox.org") +(defvar article-file (concat sync-dir "article-inbox.org") "The location of the org file containing new clipped pages to review.") -(defvar article-archive (concat sync-dir "article-archive.org") +(defvar article-archive (concat sync-dir "article-archive.org") "The location of the org file that stores saved articples to keep.") ; -(defvar ledger-file (concat sync-dir "main.ledger") +(defvar ledger-file (concat sync-dir "main.ledger") "The location of the user's ledger file.") -(defvar macros-file (concat sync-dir "macros.el") +(defvar macros-file (concat sync-dir "macros.el") "The location of the macros file for recorded saved macros via M-f3.") +(defvar authinfo-file (concat user-home-dir "/.authinfo.gpg") + "The location of the encrypted .authinfo or .netrc file.") + ;; ------------------------- Verify Or Create Functions ------------------------ (defun cj/verify-or-create-dir (dir) diff --git a/scripts/reset-to-first-launch.sh b/scripts/reset-to-first-launch.sh index 1aa07f5b..e237b153 100755 --- a/scripts/reset-to-first-launch.sh +++ b/scripts/reset-to-first-launch.sh @@ -18,7 +18,7 @@ rm -rf ~/.emacs.d/eshell/ rm -rf ~/.emacs.d/nov-places/ rm -rf ~/.emacs.d/persist/ rm -rf ~/.emacs.d/quelpa/ -rm -rf ~/.emacs.d/tramp-autosave/ +rm -rf ~/.emacs.d/tramp-auto-save/ rm -rf ~/.emacs.d/transient/ rm -rf ~/.emacs.d/tree-sitter/ rm -rf ~/.emacs.d/url/ |
