summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
committerCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
commit07fd4f1a6930dc62880b0fd7a0496270f4c2efd6 (patch)
tree31c37427859b391dd8dcad9abc2f4f3515f072b5 /modules
parenta55a5248bd2dae5f849476d0f7b5dcd8d91cf929 (diff)
more fit and finish work
User Constants - move all file and directory constants into it's own file - create the directories and files if they don't exist - warn the user when not found/created General - remove duplicate dirvish go menu entry - remove xterm color in test code (it's already in eshell) - fixed org-drill not starting - fixing issue with auto-complete not working in eshell - adding playlists location for dirvish - moved all org-drill config into the use-package declaration - added drill-dir to user-constants - default ledger-file location changed; updated tasks - git ignore the persist folder - added more point values in fontaine menu - fix for gptel early key grab in authinfo.gpg - removed localrepo from reset script - remove magit-forge package - don't wait too long to bury-buffers - add setting native compile warnings to 'silent - fixed sdcv errors when looking up a word normally and in nov
Diffstat (limited to 'modules')
-rw-r--r--modules/ai-config.el32
-rw-r--r--modules/calibredb-epub-config.el4
-rw-r--r--modules/dirvish-config.el40
-rw-r--r--modules/epa-config.el5
-rw-r--r--modules/eshell-vterm-config.el35
-rw-r--r--modules/font-config.el8
-rw-r--r--modules/games-config.el2
-rw-r--r--modules/org-config.el28
-rw-r--r--modules/org-drill-config.el95
-rw-r--r--modules/system-utils.el6
-rw-r--r--modules/test-code.el89
-rw-r--r--modules/ui-theme.el28
-rw-r--r--modules/user-constants.el86
-rw-r--r--modules/vc-config.el5
-rw-r--r--modules/wrap-up.el2
15 files changed, 277 insertions, 188 deletions
diff --git a/modules/ai-config.el b/modules/ai-config.el
index 2240d0ac..be4cffa9 100644
--- a/modules/ai-config.el
+++ b/modules/ai-config.el
@@ -23,7 +23,8 @@
;; integration with ChatGPT and other large language models.
(use-package gptel
- :defer .5
+ :defer t
+ :commands (gptel gptel-send)
:bind
("C-h G" . gptel)
(:map gptel-mode-map
@@ -34,33 +35,22 @@
(gptel-default-mode 'org-mode)
:config
(setq gptel-directives
- '((default
- . "You are a large language model living in Emacs and a careful and
+ '((default
+ . "You are a large language model living in Emacs and a careful and
knowledgeable emacs-lisp programmer. Respond accurately and concisely.")
- (programming
- . "You are a large language model and a careful programmer. Provide code
+ (programming
+ . "You are a large language model and a careful programmer. Provide code
and only code as output without any additional text, prompt or note.")
- (writing
- . "You are a large language model and a writing assistant. Respond
+ (writing
+ . "You are a large language model and a writing assistant. Respond
concisely.")
- (chat
- . "You are a large language model and a conversation partner. Respond
+ (chat
+ . "You are a large language model and a conversation partner. Respond
concisely.")))
;; grab the secret from ~/.authinfo.gpg
+ (setq auth-sources '((:source "~/.authinfo.gpg")))
(setq gptel-api-key (auth-source-pick-first-password :host "api.openai.com")))
-;; ----------------------------- Gptel Send Region -----------------------------
-;; convenience function to send a selection to Gptel.
-
-(defun cj/gptel-send-region (&optional prefix)
- "Verify a region is selected and call gptel-send with PREFIX."
- (interactive "P")
- (if (use-region-p)
- (gptel-send (prefix-numeric-value prefix))
- (error "No region selected")))
-
-(global-set-key (kbd "C-; g") 'cj/gptel-send-region)
-
(provide 'ai-config)
;;; ai-config.el ends here
diff --git a/modules/calibredb-epub-config.el b/modules/calibredb-epub-config.el
index 92e65e2a..4b794cd3 100644
--- a/modules/calibredb-epub-config.el
+++ b/modules/calibredb-epub-config.el
@@ -39,7 +39,7 @@
(use-package nov
:defer .5
- :after (visual-fill-column)
+ :after visual-fill-column
:mode ("\\.epub\\'" . nov-mode)
;; :hook (nov-mode . cj/nov-apply-preferences)
:bind
@@ -48,7 +48,7 @@
("b" . bookmark-bmenu-list)
("r" . nov-render-document)
("l" . recenter-top-bottom)
- ("d" . sdcv-search)
+ ("d" . sdcv-search-input)
("." . cj/forward-paragraph-and-center)
("<" . nov-history-back)
(">" . nov-history-forward)
diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el
index e089f010..f35d2934 100644
--- a/modules/dirvish-config.el
+++ b/modules/dirvish-config.el
@@ -53,26 +53,26 @@
:custom
(dirvish-quick-access-entries
'(("h" "~/" "home")
- ("rsb" "/sshx:cjennings@wolf.usbx.me:/home/cjennings/" "seedbox")
- ("rcj" "/sshx:cjennings@cjennings.net:~" "cjennings.net")
- ("dn" "~/downloads/" "downloads")
- ("lt" "~/.local/share/Trash" "trash")
- ("cj" "~/code/cjennings.net" "cjennings.net")
- ("co" "~/code" "code")
- ("df" "~/.dotfiles/" "dotfiles")
- ("dr" "~/sync/org/drill/" "org drill files")
- ("dt" "~/downloads/torrents/complete/" "torrents")
- ("dx" "~/documents/" "documents")
- ("gc" "~/code/golangcourse" "golang course")
- ("mp" "~/sync/playlists/" "playlists")
- ("mv" "~/magic/video/" "magic/video")
- ("mx" "~/music/" "music")
- ("my" "~/magic/youtube/" "magic/youtube")
- ("or" "~/sync/org/" "sync")
- ("pr" "~/projects/" "projects")
- ("ps" "~/pictures/screenshots/" "screenshots")
- ("pw" "~/pictures/wallpaper" "wallpaper")
- ("px" "~/pictures/" "pictures")
+ ("rsb" "/sshx:cjennings@wolf.usbx.me:/home/cjennings/" "remote seedbox")
+ ("rcj" "/sshx:cjennings@cjennings.net:~" "remote cjennings.net")
+ ("co" "~/code" "code")
+ ("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")))
(dirvish-attributes '(vscode-icon file-size))
diff --git a/modules/epa-config.el b/modules/epa-config.el
index 8d9d8f13..0e3972a0 100644
--- a/modules/epa-config.el
+++ b/modules/epa-config.el
@@ -10,9 +10,10 @@
(use-package auth-source
:ensure nil ;; built in
- :defer .5
+ :demand t ;; load this package early
:config
- (setq auth-sources '((:source "~/.authinfo.gpg")))
+ (setq auth-sources '("~/.authinfo.gpg"))
+ ;; (setq auth-sources '((:source "~/.authinfo.gpg")))
(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/eshell-vterm-config.el b/modules/eshell-vterm-config.el
index cf73205f..7d37d9e5 100644
--- a/modules/eshell-vterm-config.el
+++ b/modules/eshell-vterm-config.el
@@ -37,12 +37,6 @@
:ensure nil ;; built-in
:defer .5
:config
- ;; for plan 9 smart shell functionality
- (require 'em-smart)
- (setq eshell-where-to-jump 'begin)
- (setq eshell-review-quick-commands nil)
- (setq eshell-smart-space-goes-to-end t)
-
(setq eshell-banner-message "")
(setq eshell-scroll-to-bottom-on-input 'all)
(setq eshell-error-if-no-glob t)
@@ -51,6 +45,12 @@
(setq eshell-prefer-lisp-functions nil)
(setq eshell-destroy-buffer-when-process-dies t)
+ (add-hook
+ 'eshell-mode-hook
+ (lambda ()
+ (setq pcomplete-cycle-completions nil)))
+ (setq eshell-cmpl-cycle-completions nil)
+
(add-to-list 'eshell-modules-list 'eshell-tramp)
(add-hook 'eshell-hist-mode-hook
@@ -101,11 +101,10 @@
(use-package xterm-color
:defer .5
:after eshell
- :hook (eshell-before-prompt-hook . (lambda ()
- (setq xterm-color-preserve-properties t)))
+ :hook
+ (eshell-before-prompt-hook . (lambda ()
+ (setq xterm-color-preserve-properties t)))
:config
- (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
- (setq eshell-output-filter-functions (remove 'eshell-handle-ansi-color eshell-output-filter-functions))
(setenv "TERM" "xterm-256color"))
;; ------------------------------ Vterm ------------------------------
@@ -138,15 +137,15 @@
:config
(setq vterm-toggle-fullscreen-p nil)
(add-to-list 'display-buffer-alist
- '((lambda (buffer-or-name _)
- (let ((buffer (get-buffer buffer-or-name)))
- (with-current-buffer buffer
- (or (equal major-mode 'vterm-mode)
- (string-prefix-p vterm-buffer-name (buffer-name buffer))))))
- (display-buffer-reuse-window display-buffer-at-bottom)
+ '((lambda (buffer-or-name _)
+ (let ((buffer (get-buffer buffer-or-name)))
+ (with-current-buffer buffer
+ (or (equal major-mode 'vterm-mode)
+ (string-prefix-p vterm-buffer-name (buffer-name buffer))))))
+ (display-buffer-reuse-window display-buffer-at-bottom)
(dedicated . t) ;dedicated is supported in Emacs 27+
- (reusable-frames . visible)
- (window-height . 0.3))))
+ (reusable-frames . visible)
+ (window-height . 0.3))))
(provide 'eshell-vterm-config)
;;; eshell-vterm-config.el ends here.
diff --git a/modules/font-config.el b/modules/font-config.el
index 6678d2f9..fc9d8b18 100644
--- a/modules/font-config.el
+++ b/modules/font-config.el
@@ -40,7 +40,13 @@
(Codelia-Only
:default-family "Codelia Ligatures")
(Liberation_Mono-Only
- :default-family "Liberation Mono")
+ :default-family "Liberation Mono")
+ (24-point-font
+ :default-height 240)
+ (20-point-font
+ :default-height 200)
+ (16-point-font
+ :default-height 160)
(12-point-font
:default-height 120)
(13-point-font
diff --git a/modules/games-config.el b/modules/games-config.el
index 6b198be3..e0439630 100644
--- a/modules/games-config.el
+++ b/modules/games-config.el
@@ -15,7 +15,7 @@
("d" dunnet "Dunnet : Emacs' Built-n Text Adventure" :column "Game")
("g" gomoku "Gomoku : Tic Tac Toe, but Five in a Row" :column "Game")
("m" malyon "Malyon : The Text Adventure Player" :column "Game")
- ("t" tetris "Tetris : Combine falling blocks and scoreq" :column "Game"))
+ ("t" tetris "Tetris : Combine falling blocks and score" :column "Game"))
(global-set-key (kbd "M-G") 'hydra-games/body)
;; ----------------------------------- Malyon ----------------------------------
diff --git a/modules/org-config.el b/modules/org-config.el
index 1bfcf704..6a177d30 100644
--- a/modules/org-config.el
+++ b/modules/org-config.el
@@ -31,12 +31,12 @@
(interactive)
(save-excursion
(ignore-errors
- (progn
- (org-sort-entries t ?a)
- (org-sort-entries t ?p)
- (org-sort-entries t ?t)
- (org-cycle)
- (org-cycle)))))
+ (progn
+ (org-sort-entries t ?a)
+ (org-sort-entries t ?p)
+ (org-sort-entries t ?t)
+ (org-cycle)
+ (org-cycle)))))
;; ---------------------------------- Org Mode ---------------------------------
@@ -45,7 +45,7 @@
:ensure nil ;; use the built-in package
:pin manual ;; never upgrade from the version built-into Emacs
:preface
- ;; create an org-table-map so you can use C-c t as prefix
+ ;; create an org-table-map so we can use C-c t as prefix
(define-prefix-command 'org-table-map)
(global-set-key (kbd "C-c T") 'org-table-map)
:bind
@@ -117,7 +117,6 @@
(unbind-key "C-'" org-mode-map)
(unbind-key "C-," org-mode-map)
-
;; ORG-PROTOCOL
;; enable recognition of org-protocol:// as a parameter
(require 'org-protocol)
@@ -131,16 +130,15 @@
(setq org-list-allow-alphabetical t) ;; allow alpha ordered lists (i.e., a), A), a., etc.)
;; INDENTATION
- (setq org-startup-indented t) ;; load org files indented
- (setq org-adapt-indentation t) ;; adapt indentation to outline node level
- (setq org-indent-indentation-per-level 2) ;; indent two character-widths per level
+ (setq org-startup-indented t) ;; load org files indented
+ (setq org-adapt-indentation t) ;; adapt indentation to outline node level
+ (setq org-indent-indentation-per-level 2) ;; indent two character-widths per level
;; INLINE IMAGES
- (setq org-startup-with-inline-images t) ;; preview images by default
- (setq org-image-actual-width '(500)) ;; keep image
- ;; sizes in check
+ (setq org-startup-with-inline-images t) ;; preview images by default
+ (setq org-image-actual-width '(500)) ;; keep image sizes in check
- (setq org-bookmark-names-plist nil) ;; don't set org-capture bookmarks
+ (setq org-bookmark-names-plist nil) ;; don't set org-capture bookmarks
;; force pdfs exported from org to open in emacs
(add-to-list 'org-file-apps '("\\.pdf\\'" . emacs)))
diff --git a/modules/org-drill-config.el b/modules/org-drill-config.el
index 127a94f7..be0256d3 100644
--- a/modules/org-drill-config.el
+++ b/modules/org-drill-config.el
@@ -4,7 +4,7 @@
;; Notes: Org-Drill
;; Start out your org-drill with C-d s, then select your file.
-;; the javascript bookmark I use to capture information from the web is below:
+;; the javascript bookmark I use to capture information from the web for org-drill files:
;; javascript:location.href='org-protocol://capture?template=d&url=%27+encodeURIComponent(location.href)+%27&title=%27+encodeURIComponent(document.title)+%27&body=%27+encodeURIComponent(window.getSelection())
;; create a new bookmark and add "Drill Entry" to the name field and the above
@@ -12,60 +12,11 @@
;; ----------------------------------- Tasks -----------------------------------
-
;;; Code:
-(require 'custom-functions) ;; for cj/merge-list-to-list
-
-(defvar org-drill-files (directory-files (concat sync-dir "drill/")
- t directory-files-no-dot-files-regexp))
-
-(with-eval-after-load 'org
- (cj/merge-list-to-list
- 'org-capture-templates
- '(("d" "Drill Question - Web"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%:description]]\nCaptured On: %U" :prepend t)
- ("b" "Drill Question - EPUB"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
- ("f" "Drill Question - PDF"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%(org-capture-pdf-active-region)\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t))))
-
(use-package org-drill
:after org
:preface
- (defun cj/drill-start ()
- "Prompt user to pick a drill org file, then starts an org-drill session."
- (interactive)
- (let ((choices org-drill-files))
- (setq chosen-drill-file (completing-read "Choose Flashcard File:" choices ))
- (find-file chosen-drill-file)
- (org-drill)))
-
- (defun cj/drill-edit ()
- "Prompts the user to pick a drill org file, then opens it for editing."
- (interactive)
- (let* ((choices org-drill-files)
- (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices)))
- (find-file chosen-drill-file)))
-
- (defun cj/drill-capture ()
- "Quickly capture a drill question."
- (interactive)
- (org-capture nil "d"))
-
- (defun cj/drill-refile ()
- "Refile to a drill file."
- (interactive)
- (setq org-refile-targets '((nil :maxlevel . 1)
- (org-drill-files :maxlevel . 1)))
- (call-interactively 'org-refile))
-
;; create an org-drill-map so you can use C-d as prefix
(define-prefix-command 'org-drill-map)
(global-set-key (kbd "C-d") 'org-drill-map)
@@ -83,7 +34,49 @@
(setq org-drill-hide-item-headings-p t) ;; don't show heading text
(setq org-drill-maximum-items-per-session 1000) ;; drill sessions end after 1000 cards
(setq org-drill-maximum-duration 60) ;; each drill session can last up to a an hour
- (setq org-drill-add-random-noise-to-intervals-p t)) ;; slightly vary number of days to repetition
+ (setq org-drill-add-random-noise-to-intervals-p t) ;; slightly vary number of days to repetition
+
+ (defun cj/drill-start ()
+ "Prompt user to pick a drill org file, then starts an org-drill session."
+ (interactive)
+ (let ((choices (directory-files drill-dir nil "^[^.].*\\.org$")))
+ (setq chosen-drill-file (completing-read "Choose Flashcard File:" choices))
+ (find-file (concat drill-dir chosen-drill-file))
+ (require 'org-drill)
+ (org-drill)))
+
+ (defun cj/drill-edit ()
+ "Prompts the user to pick a drill org file, then opens it for editing."
+ (interactive)
+ (let* ((choices drill-dir)
+ (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices)))
+ (find-file chosen-drill-file)))
+
+ (defun cj/drill-capture ()
+ "Quickly capture a drill question."
+ (interactive)
+ (org-capture nil "d"))
+
+ (defun cj/drill-refile ()
+ "Refile to a drill file."
+ (interactive)
+ (setq org-refile-targets '((nil :maxlevel . 1)
+ (drill-dir :maxlevel . 1)))
+ (call-interactively 'org-refile))
+
+ ;; add useful org drill capture templates
+ (require 'custom-functions)
+ (cj/merge-list-to-list
+ 'org-capture-templates
+ '(("d" "Drill Question - Web" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%:description]]\nCaptured On: %U" :prepend t)
+ ("b" "Drill Question - EPUB" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
+ ("f" "Drill Question - PDF" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%(org-capture-pdf-active-region)\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t))))
(provide 'org-drill-config)
;;; org-drill-config.el ends here.
diff --git a/modules/system-utils.el b/modules/system-utils.el
index f5967520..62f73dc8 100644
--- a/modules/system-utils.el
+++ b/modules/system-utils.el
@@ -223,11 +223,9 @@ Don't automatically display output buffers, but keep them in buffer list."
;; install Webster's dictionary in StarDict format
;; http://jsomers.net/blog/dictionary
-(use-package sdcv-mode
+(use-package sdcv
:defer 1
- :ensure nil; custom-file
- :load-path "custom/sdcv-mode.el"
- :bind ("C-h d" . 'sdcv-search))
+ :bind ("C-h d" . 'sdcv-search-input))
;; ------------------------------ -Keyboard Macros -----------------------------
;; note that this leverages simple, easy to remember shortcuts
diff --git a/modules/test-code.el b/modules/test-code.el
index 74179c95..85e7bce6 100644
--- a/modules/test-code.el
+++ b/modules/test-code.el
@@ -7,6 +7,28 @@
;;; Code:
+;; ---------------------------------- Yeetube ----------------------------------
+;; youtube frontend for emacs
+
+(use-package yeetube
+ :init (define-prefix-command 'cj/yeetube-map)
+ :bind (("C-c y" . 'cj/yeetube-map)
+ :map cj/yeetube-map
+ ("s" . 'yeetube-search)
+ ("b" . 'yeetube-play-saved-video)
+ ("d" . 'yeetube-download-videos)
+ ("p" . 'yeetube-mpv-toggle-pause)
+ ("v" . 'yeetube-mpv-toggle-video)
+ ("V" . 'yeetube-mpv-toggle-no-video-flag)
+ ("k" . 'yeetube-remove-saved-video))
+ :custom
+ (yeetube-results-limit 50)
+ (yeetube-download-directory (expand-file-name "videos" "~"))
+ (yeetube-filter "Views")
+ (setq yeetube-display-thumbnails nil)
+ :config
+ (setf yeetube-mpv-disable-video nil))
+
;; --------------------------------- Recording ---------------------------------
@@ -22,12 +44,12 @@ If called with a prefix arg C-u, choose the location on where to save the record
otherwise use the default location in `cj/recording-location'."
(interactive "P")
(let* ((location (if arg
- (read-directory-name "Enter recording location: ")
- cj/recording-location))
- (directory (file-name-directory location)))
- (unless (file-directory-p directory)
- (make-directory directory t))
- (cj/ffmpeg-record location)))
+ (read-directory-name "Enter recording location: ")
+ cj/recording-location))
+ (directory (file-name-directory location)))
+ (unless (file-directory-p directory)
+ (make-directory directory t))
+ (cj/ffmpeg-record location)))
(defun cj/ffmpeg-record (directory)
"Start an ffmpeg recording. Save output to DIRECTORY."
@@ -39,13 +61,13 @@ otherwise use the default location in `cj/recording-location'."
(concat "ffmpeg -framerate 30 -f x11grab -i :0.0+ "
"-f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo "
"-ac 1 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor "
- "-ac 2 " filename)))
- ;; start the recording
+ "-ac 2 " filename)))
+ ;; start the recording
(setq cj/ffmpeg-process
(start-process-shell-command "ffmpeg-recording"
"*ffmpeg-recording*"
ffmpeg-command))
- (set-process-query-on-exit-flag cj/ffmpeg-process nil)
+ (set-process-query-on-exit-flag cj/ffmpeg-process nil)
(message "Started recording process."))))
(defun cj/stop-recording ()
@@ -62,22 +84,22 @@ otherwise use the default location in `cj/recording-location'."
"Prompt for a string, insert it before and after the word at point or selected region."
(interactive)
(let ((str (read-string "Enter a string: "))
- (regionp (use-region-p)))
- (save-excursion
- (if regionp
- (let ((beg (region-beginning))
- (end (region-end)))
- (goto-char end)
- (insert str)
- (goto-char beg)
- (insert str))
- (if (thing-at-point 'word)
- (let ((bounds (bounds-of-thing-at-point 'word)))
- (goto-char (cdr bounds))
- (insert str)
- (goto-char (car bounds))
- (insert str))
- (message "Can't insert around. No word at point and no region selected."))))))
+ (regionp (use-region-p)))
+ (save-excursion
+ (if regionp
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (goto-char end)
+ (insert str)
+ (goto-char beg)
+ (insert str))
+ (if (thing-at-point 'word)
+ (let ((bounds (bounds-of-thing-at-point 'word)))
+ (goto-char (cdr bounds))
+ (insert str)
+ (goto-char (car bounds))
+ (insert str))
+ (message "Can't insert around. No word at point and no region selected."))))))
(global-set-key (kbd "C-; i a") 'cj/insert-around-word-or-region)
@@ -115,19 +137,18 @@ otherwise use the default location in `cj/recording-location'."
(use-package wttrin
:defer .5
- :after xterm-color
:load-path ("~/code/emacs-wttrin")
+ :preface
+ ;; dependency for wttrin
+ (use-package xterm-color
+ :demand t)
:bind
("M-W" . wttrin))
-;; dependency for wttrin
-(use-package xterm-color
- :defer .5)
-
;; ------------------------------ ERC Yank To Gist -----------------------------
;; automatically create a Gist if pasting more than 5 lines
;; this module requires https://github.com/defunkt/gist
-;; via ruby: 'gem install gist' via the aur: yay -S gist
+;; via ruby: 'gem install gist' via the aur: yay -S gist
(use-package erc-yank
:defer 1
@@ -144,9 +165,9 @@ otherwise use the default location in `cj/recording-location'."
;; :after racket-mode
;; :commands (org-babel-execute:racket)
;; :quelpa (ob-racket
-;; :fetcher github
-;; :repo "hasu/emacs-ob-racket"
-;; :files ("*.el" "*.rkt")))
+;; :fetcher github
+;; :repo "hasu/emacs-ob-racket"
+;; :files ("*.el" "*.rkt")))
(provide 'test-code)
;;; test-code.el ends here.
diff --git a/modules/ui-theme.el b/modules/ui-theme.el
index 609acab3..8d544f9f 100644
--- a/modules/ui-theme.el
+++ b/modules/ui-theme.el
@@ -60,7 +60,7 @@ If FILENAME isn't readable, return nil."
(with-temp-buffer
(insert-file-contents filename)
(buffer-string))
- 'nil))
+ nil))
(defun cj/write-file-contents (content filename)
"Write CONTENT to FILENAME.
@@ -70,8 +70,8 @@ If FILENAME isn't writeable, return nil. If successful, return t."
(with-temp-buffer
(insert content)
(write-file filename))
- 't)
- 'nil))
+ t)
+ nil))
(defun cj/get-active-theme-name ()
"Return the name of the active UI theme as a string."
@@ -79,7 +79,7 @@ If FILENAME isn't writeable, return nil. If successful, return t."
(defun cj/save-theme-to-file ()
"Save the string representing the current theme to the theme-file."
- (if (equal (cj/write-file-contents (cj/get-active-theme-name) theme-file) 'nil)
+ (if (equal (cj/write-file-contents (cj/get-active-theme-name) theme-file) nil)
(message "Cannot save theme: %s is unwriteable" theme-file)
(message "%s theme saved to %s" (cj/get-active-theme-name) theme-file)))
@@ -94,15 +94,17 @@ Used to handle errors with loading persisted theme."
If the theme is nil, it disables all current themes. If an error occurs
loading the file name, the fallback-theme-name is applied and saved."
(let ((theme-name (cj/read-file-contents theme-file)))
- ;; if theme-name is nil, unload all themes
- (if (string= theme-name "nil")
- (mapcar #'disable-theme custom-enabled-themes)
- ;; apply theme name or if error, load fallback theme
- (progn
- (condition-case err
- (load-theme (intern theme-name) t)
- (error
- (cj/load-fallback-theme (concat "Error loading " theme-name "."))))))))
+ ;; if theme-name is nil, unload all themes and load fallback theme
+ (if (or (string= theme-name "nil") (not theme-name))
+ (progn
+ (mapcar #'disable-theme custom-enabled-themes)
+ (cj/load-fallback-theme "Theme file not found or theme name in it is nil."))
+ ;; apply theme name or if error, load fallback theme
+ (condition-case err
+ (load-theme (intern theme-name) t)
+ (error
+ (cj/load-fallback-theme (concat "Error loading " theme-name
+ ".")))))))
(cj/load-theme-from-file)
diff --git a/modules/user-constants.el b/modules/user-constants.el
new file mode 100644
index 00000000..2702f978
--- /dev/null
+++ b/modules/user-constants.el
@@ -0,0 +1,86 @@
+;;; user-constants.el --- User Constants -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; user file locations are defined here.
+;; if they aren't found, they are created.
+
+;;; Code:
+
+;; ------------------------ Directory And File Constants -----------------------
+
+(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/")
+ "Code repositories are located in this directory.")
+
+(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/")
+ "This directory is synchronized across machines.")
+
+(defconst roam-dir (concat sync-dir "roam/")
+ "The location of org-roam files.")
+
+(defconst drill-dir (concat sync-dir "drill/")
+ "The location of org-drill org files.")
+
+(defconst snippets-dir (concat sync-dir "snippets/")
+ "The location of ya-snippet snippets.")
+
+
+(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")
+ "The location of the org file that serves as the task inbox.")
+
+(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")
+ "The location of the org file containing new clipped pages to review.")
+
+(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")
+ "The location of the user's ledger file.")
+
+(defvar macros-file (concat sync-dir "macros.el")
+ "The location of the macros file for recorded saved macros via M-f3.")
+
+;; ------------------------- Verify Or Create Functions ------------------------
+
+(defun cj/verify-or-create-dir (dir)
+ "Verify the directory DIR exists; create it if it doesn't."
+ (unless (file-directory-p dir)
+ (make-directory dir t)
+ (message "Warning: Directory %s not found, so created it" dir)))
+
+(defun cj/verify-or-create-file (file)
+ "Verify the file FILE exists; create it if it doesn't."
+ (unless (file-exists-p file)
+ (write-region "" nil file)
+ (message "Warning: File %s not found, so created it" file)))
+
+;; ------------------------- Verify Or Create Constants ------------------------
+
+(mapc 'cj/verify-or-create-dir (list sync-dir
+ roam-dir
+ snippets-dir))
+
+(mapc 'cj/verify-or-create-file (list schedule-file
+ inbox-file
+ contacts-file
+ article-file
+ article-archive
+ ledger-file
+ macros-file))
+
+(provide 'user-constants)
+;;; user-constants.el ends here.
diff --git a/modules/vc-config.el b/modules/vc-config.el
index d2cb183b..a9b72507 100644
--- a/modules/vc-config.el
+++ b/modules/vc-config.el
@@ -30,11 +30,6 @@
(setq git-commit-major-mode 'org-mode) ;; edit commit messages in org-mode
(setq magit-display-buffer-function 'magit-display-buffer-fullframe-status-topleft-v1))
-;; -------------------------------- Magit Forge --------------------------------
-
-(use-package forge
- :after magit)
-
;; --------------------------------- Git Gutter --------------------------------
;; mark changed lines since last commit in the margin
diff --git a/modules/wrap-up.el b/modules/wrap-up.el
index fcc0b788..56cd65f0 100644
--- a/modules/wrap-up.el
+++ b/modules/wrap-up.el
@@ -22,7 +22,7 @@
(defun cj/bury-buffers-after-delay ()
"Run cj/bury-buffers after a delay."
- (run-with-timer 10 nil 'cj/bury-buffers))
+ (run-with-timer 1 nil 'cj/bury-buffers))
(add-hook 'emacs-startup-hook 'cj/bury-buffers-after-delay)