summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ai-config.el21
-rw-r--r--modules/config-utilities.el2
-rw-r--r--modules/custom-functions.el67
-rw-r--r--modules/dashboard-config.el5
-rw-r--r--modules/elfeed-config.el31
-rw-r--r--modules/flycheck-config.el18
-rw-r--r--modules/font-config.el14
-rw-r--r--modules/help-utils.el13
-rw-r--r--modules/org-capture-config.el133
-rw-r--r--modules/org-drill-config.el1
-rw-r--r--modules/org-roam-config.el10
-rw-r--r--modules/prog-c.el2
-rw-r--r--modules/prog-comments.el73
-rw-r--r--modules/prog-general.el42
-rw-r--r--modules/prog-go.el52
-rw-r--r--modules/prog-python.el61
-rw-r--r--modules/show-kill-ring.el25
-rw-r--r--modules/system-utils.el72
-rw-r--r--modules/test-code.el20
-rw-r--r--modules/text-config.el2
-rw-r--r--modules/ui-navigation.el25
21 files changed, 352 insertions, 337 deletions
diff --git a/modules/ai-config.el b/modules/ai-config.el
index 14380a2b..2240d0ac 100644
--- a/modules/ai-config.el
+++ b/modules/ai-config.el
@@ -41,11 +41,26 @@
. "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 concisely.")
+ . "You are a large language model and a writing assistant. Respond
+ concisely.")
(chat
- . "You are a large language model and a conversation partner. Respond concisely.")))
+ . "You are a large language model and a conversation partner. Respond
+ concisely.")))
+ ;; grab the secret from ~/.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.
+;;; ai-config.el ends here
diff --git a/modules/config-utilities.el b/modules/config-utilities.el
index 4e0fd923..240c6d14 100644
--- a/modules/config-utilities.el
+++ b/modules/config-utilities.el
@@ -45,7 +45,7 @@ Will recompile natively if supported, or byte-compiled if not."
;; removes all compiled files and deletes the eln directory
(defun cj/delete-emacs-home-compiled-files ()
- "Delete all compiled files recursively in \\='user-emacs-directory\\='."
+ "Delete all compiled files recursively in \='user-emacs-directory\='."
(interactive)
(message "Deleting compiled files under %s. This may take a while." user-emacs-directory)
(require 'find-lisp) ;; make sure the package is required
diff --git a/modules/custom-functions.el b/modules/custom-functions.el
index fe617ed1..414d3108 100644
--- a/modules/custom-functions.el
+++ b/modules/custom-functions.el
@@ -130,6 +130,32 @@ buffer."
(indent-region start-pos end-pos nil)
(untabify start-pos end-pos))))
+;; ------------------- Remove Leading And Trailing Whitespace ------------------
+;; removes leading and trailing whitespace on line, region, or buffer.
+
+(defun cj/remove-leading-trailing-whitespace (start end)
+ "Remove leading and trailing whitespace in a region or buffer.
+When called interactively, if a region is active, remove leading
+and trailing spaces in the region. Else, remove from the current line.
+If called with a prefix argument (C-u), remove throughout the entire buffer.
+START and END define region."
+ (interactive "r")
+ (let (deactivate-mark)
+ (if (or (use-region-p) current-prefix-arg)
+ (save-restriction
+ (if current-prefix-arg
+ (progn (widen) (setq start (point-min) end (point-max)))
+ (narrow-to-region start end))
+ (goto-char (point-min))
+ (while (re-search-forward "^[ \t]+" nil t) (replace-match ""))
+ (goto-char (point-min))
+ (while (re-search-forward "[ \t]+$" nil t) (replace-match "")))
+ (beginning-of-line)
+ (while (looking-at "^[ \t]+") (replace-match ""))
+ (end-of-line)
+ (while (re-search-backward "[ \t]+$" (line-beginning-position) t)
+ (replace-match "")))))
+
;; --------------------------- Arrayify / Unarrayify ---------------------------
;; unquoted text on newlines to quoted comma separated strings (and vice-versa).
@@ -137,7 +163,7 @@ buffer."
"Turn unquoted text on newlines into quoted comma-separated strings.
START and END indicate the region selected.
QUOTE is the characters used for quotations (i.e, \=' or \")"
- (interactive "r\nMQuote: ")
+ (interactive "r\nMQuotation character to use for array element: ")
(let ((insertion
(mapconcat
(lambda (x) (format "%s%s%s" quote x quote))
@@ -456,7 +482,16 @@ Uses `sortable-time-format' for the formatting the date/time."
(defadvice align-regexp (around align-regexp-with-spaces activate)
"Avoid tabs when aligning text."
(let ((indent-tabs-mode nil))
- ad-do-it))
+ ad-do-it))
+
+;; ----------------------------- Merge List To List ----------------------------
+;; Convenience method for merging two lists together
+;; https://emacs.stackexchange.com/questions/38008/adding-many-items-to-a-list/68048#68048
+
+(defun cj/merge-list-to-list (dst src)
+ "Merge content of the 2nd list SRC with the 1st one DST."
+ (set dst
+ (append (eval dst) src)))
;; ------------------------------ Personal Keymap ------------------------------
;; a keymap to use the above functions. prefix key: "C-;"
@@ -472,20 +507,20 @@ Uses `sortable-time-format' for the formatting the date/time."
(define-key map "D" 'cj/remove-duplicate-lines-from-region-or-buffer)
(define-key map ")" #'cj/jump-to-matching-paren)
- (define-key map "-" #'cj/hyphenate-whitespace-in-region)
- (define-key map "p" 'cj/append-to-lines-in-region-or-buffer)
- (define-key map "1" 'cj/alphabetize-and-replace-regibon)
- (define-key map "C" 'display-fill-column-indicator-mode)
- (define-key map "w" 'cj/wrap-region-as-code-span)
- (define-key map "f" 'cj/format-region-or-buffer)
- (define-key map "h" 'cj/hyphenate-region)
- (define-key map "j" 'cj/join-line-or-region)
- (define-key map "J" 'cj/join-paragraph)
- (define-key map "r" 'align-regexp)
- (define-key map "l" 'downcase-dwim)
- (define-key map "u" 'cj/title-case-region)
- (define-key map "U" 'upcase-region)
- (define-key map "#" 'cj/count-words-buffer-or-region)
+ (define-key map "-" #'cj/hyphenate-region)
+ (define-key map "U" 'upcase-region)
+ (define-key map "w" 'cj/remove-leading-trailing-whitespace)
+ (define-key map "#" 'cj/count-words-buffer-or-region)
+ (define-key map "1" 'cj/alphabetize-and-replace-region)
+ (define-key map "C" 'display-fill-column-indicator-mode)
+ (define-key map "J" 'cj/join-paragraph)
+ (define-key map "f" 'cj/format-region-or-buffer)
+ (define-key map "j" 'cj/join-line-or-region)
+ (define-key map "l" 'downcase-dwim)
+ (define-key map "p" 'cj/append-to-lines-in-region-or-buffer)
+ (define-key map "r" 'align-regexp)
+ (define-key map "u" 'cj/title-case-region)
+ (define-key map "c" 'cj/wrap-region-as-code-span)
map)
"My personal key map.")
(global-set-key (kbd "C-;") personal-keymap)
diff --git a/modules/dashboard-config.el b/modules/dashboard-config.el
index 6340c32b..f9c40ee5 100644
--- a/modules/dashboard-config.el
+++ b/modules/dashboard-config.el
@@ -94,11 +94,6 @@
(setq dashboard-set-footer nil) ;; don't show footer and quotes
;; == banner
- (custom-set-faces '(dashboard-banner-logo-title
- ((t(:slant oblique
- :height 170
- :family "Merriweather")))))
-
(setq dashboard-startup-banner (concat user-emacs-directory "assets/M-x_butterfly.png"))
(setq dashboard-banner-logo-title "Emacs: The Editor That Saves Your Soul")
diff --git a/modules/elfeed-config.el b/modules/elfeed-config.el
index 37a0e12f..901ae0b1 100644
--- a/modules/elfeed-config.el
+++ b/modules/elfeed-config.el
@@ -13,13 +13,13 @@
("w" . eww-open-in-new-buffer))
(:map elfeed-search-mode-map
("w" . cj/elfeed-eww-open) ;; opens in eww
- ("b" . cj/elfeed-browser-open) ;; opens in external browser
- ("d" . cj/elfeed-youtube-dl) ;; async download with yt-dlp and tsp
- ("p" . cj/play-with-mpv) ;; async play with mpv
- ("R" . cj/elfeed-mark-all-as-read) ;; capital marks all as read, since upper case marks one as read
- ("U" . cj/elfeed-mark-all-as-unread)) ;; capital marks all as unread, since lower case marks one as unread
+ ("b" . cj/elfeed-browser-open) ;; opens in external browser
+ ("d" . cj/elfeed-youtube-dl) ;; async download with yt-dlp and tsp
+ ("p" . cj/play-with-mpv) ;; async play with mpv
+ ("R" . cj/elfeed-mark-all-as-read) ;; capital marks all as read, since upper case marks one as read
+ ("U" . cj/elfeed-mark-all-as-unread)) ;; capital marks all as unread, since lower case marks one as unread
:config
- (setq elfeed-db-directory "~/sync/org/ElfeedDB")
+ (setq elfeed-db-directory (concat user-emacs-directory ".elfeed-db"))
(setq-default elfeed-search-title-max-width 150)
(setq-default elfeed-search-title-min-width 80)
(setq-default elfeed-search-filter "+mustread +unread"))
@@ -30,7 +30,8 @@
:defer .5
:after elfeed
:config
- (setq rmh-elfeed-org-files (list (concat sync-dir "elfeed-feeds.org")))
+ (setq rmh-elfeed-org-files
+ (list (concat user-emacs-directory "assets/elfeed-feeds.org")))
(elfeed-org))
;; ------------------------------ Elfeed Dashboard -----------------------------
@@ -40,7 +41,7 @@
:bind
("M-R" . elfeed-dashboard)
:config
- (setq elfeed-dashboard-file (concat user-emacs-directory "elfeed-dashboard.org"))
+ (setq elfeed-dashboard-file (concat user-emacs-directory "assets/elfeed-dashboard.org"))
;; update feed counts on elfeed-quit
(advice-add 'elfeed-search-quit-window :after #'elfeed-dashboard-update-links))
@@ -87,16 +88,16 @@
(add-hook 'eww-after-render-hook #'cj/eww-readable-nonce)
(eww-browse-url it))
(mapc #'elfeed-search-update-entry entries)
- (unless (use-region-p) (forward-line))))
+ (unless (use-region-p) (forward-line))))
;; hook for cj/elfeed-eww-open to open entry in eww readable mode
;; https://emacs.stackexchange.com/questions/36284/how-to-open-eww-in-readable-mode/47757
(defun cj/eww-readable-nonce ()
"Once-off call to eww-readable after EWW is done rendering."
(unwind-protect
- (progn
- (eww-readable)
- (goto-char (point-min)))
+ (progn
+ (eww-readable)
+ (goto-char (point-min)))
(remove-hook 'eww-after-render-hook #'cj/eww-readable-nonce)))
(defun cj/elfeed-browser-open (&optional use-generic-p)
@@ -126,8 +127,8 @@
(defun cj/yt-dl-it (url)
"Downloads the URL in an async shell."
(let ((default-directory "~/videos"))
- (save-window-excursion
- (async-shell-command (format "tsp yt-dlp --add-metadata -ic -o '%%(channel)s-%%(title)s.%%(ext)s' '%s'" url)))))
+ (save-window-excursion
+ (async-shell-command (format "tsp yt-dlp --add-metadata -ic -o '%%(channel)s-%%(title)s.%%(ext)s' '%s'" url)))))
(defun cj/play-with-mpv (&optional use-generic-p)
"MPV link."
@@ -144,7 +145,5 @@
"Play the URL with mpv in an async shell."
(async-shell-command (format "mpv '%s'" url)))
-
-
(provide 'elfeed-config)
;;; elfeed-config.el ends here
diff --git a/modules/flycheck-config.el b/modules/flycheck-config.el
index 1bad4cbd..f0ca71fe 100644
--- a/modules/flycheck-config.el
+++ b/modules/flycheck-config.el
@@ -6,7 +6,7 @@
;;; Code:
(defun cj/prose-helpers-on ()
- "Ensure that abbrev, flyspell, and flycheck are on."
+ "Ensure that abbrev, flyspell, and flycheck are all on."
(interactive)
(if (not (abbrev-mode))
(abbrev-mode))
@@ -19,7 +19,13 @@
(use-package flycheck
:defer .5
:hook (sh-mode emacs-lisp-mode)
- :bind ("C-; ?" . flycheck-list-errors)
+ :preface
+ (defun cj/flycheck-list-errors ()
+ "Display flycheck's error list and switch to its buffer."
+ (interactive)
+ (flycheck-list-errors)
+ (switch-to-buffer-other-window "*Flycheck errors*"))
+ :bind ("C-; ?" . cj/flycheck-list-errors)
:config
;; don't warn about double-spaces after period.
(setq-default checkdoc-arguments '("sentence-end-double-space" nil "warn-escape" nil))
@@ -35,13 +41,5 @@
:modes (text-mode markdown-mode gfm-mode))
(add-to-list 'flycheck-checkers 'proselint))
-;; ;; https://github.com/emacs-grammarly/flycheck-grammarly
-;; (use-package flycheck-grammarly
-;; :defer 1
-;; :after flycheck
-;; :config
-;; (with-eval-after-load 'flycheck
-;; (flycheck-grammarly-setup)))
-
(provide 'flycheck-config)
;;; flycheck-config.el ends here
diff --git a/modules/font-config.el b/modules/font-config.el
index a5ed2771..6678d2f9 100644
--- a/modules/font-config.el
+++ b/modules/font-config.el
@@ -41,10 +41,18 @@
:default-family "Codelia Ligatures")
(Liberation_Mono-Only
:default-family "Liberation Mono")
+ (12-point-font
+ :default-height 120)
+ (13-point-font
+ :default-height 130)
+ (11-point-font
+ :default-height 110)
+ (10-point-font
+ :default-height 100)
(t ;; shared fallback properties go here
:default-family "Berkeley Mono"
:default-weight regular
- :default-height 130
+ :default-height 110
:fixed-pitch-family nil ;; falls back to :default-family
:fixed-pitch-weight nil ;; falls back to :default-weight
:fixed-pitch-height 1.0
@@ -70,7 +78,7 @@ Note that server-after-make-frame-hook is available only in Emacs 27+."
(interactive)
(fontaine-set-preset 'Berkeley-Only)
(if (daemonp)
- (remove-hook 'server-after-make-frame-hook #'cj/apply-font-settings-after-ui-creation)))
+ (remove-hook 'server-after-make-frame-hook #'cj/apply-font-settings-after-ui-creation)))
(if (daemonp)
(add-hook 'server-after-make-frame-hook #'cj/apply-font-settings-after-ui-creation)
@@ -141,7 +149,7 @@ Note that server-after-make-frame-hook is available only in Emacs 27+."
(interactive)
(pop-to-buffer "*Available Fonts*" '(display-buffer-in-side-window . ((side . right)(window-width . fit-window-to-buffer))))
(let ((font-list (font-family-list)))
- (setq font-list (remove-duplicates (cl-sort font-list 'string-lessp :key 'downcase)))
+ (setq font-list (cl-remove-duplicates (cl-sort font-list 'string-lessp :key 'downcase)))
(with-current-buffer "*Available Fonts*"
(erase-buffer)
(dolist (font-family font-list)
diff --git a/modules/help-utils.el b/modules/help-utils.el
index 66286704..199e6815 100644
--- a/modules/help-utils.el
+++ b/modules/help-utils.el
@@ -10,7 +10,7 @@
(global-set-key (kbd "C-h P") 'list-packages) ;; bring up the package menu
-;;;; ---------------------------- Helpful ----------------------------
+;; ---------------------------------- Helpful ----------------------------------
(use-package helpful
:defer .5
@@ -27,7 +27,7 @@
(setq counsel-describe-variable-function #'helpful-variable))
-;;;; ------------------------------ Man ------------------------------
+;; ------------------------------------ Man ------------------------------------
(use-package man
:defer 1
@@ -35,7 +35,7 @@
:bind ("C-h M" . man))
-;;;; ------------------------------ Info -----------------------------
+;; ------------------------------------ Info -----------------------------------
(use-package info
:defer 1
@@ -58,7 +58,7 @@
(push (concat user-emacs-directory "assets/info") Info-directory-list)
(add-to-list 'auto-mode-alist '("\\.info\\'" . open-with-info-mode)))
-;;;; ---------------------------- Devdocs ----------------------------
+;; ---------------------------------- Devdocs ----------------------------------
(use-package devdocs
:defer 1
@@ -72,18 +72,17 @@
(define-key devdocs-mode-map "b" 'devdocs-go-back)
(define-key devdocs-mode-map "f" 'devdocs-go-forward))
-;;;; ------------------------------- TLDR ------------------------------
+;; ------------------------------------ TLDR -----------------------------------
(use-package tldr
:defer 1
:bind ("C-h T" . tldr))
-;;;; -------------------------- Wiki-Summary -------------------------
+;; -------------------------------- Wiki Summary -------------------------------
(use-package wiki-summary
:defer 1
:bind ("C-h W" . wiki-summary))
-
(provide 'help-utils)
;;; help-utils.el ends here
diff --git a/modules/org-capture-config.el b/modules/org-capture-config.el
index 2ce8494b..3cdb45fd 100644
--- a/modules/org-capture-config.el
+++ b/modules/org-capture-config.el
@@ -1,8 +1,8 @@
-;;; org-capture-config.el --- Org Capture/Refile -*- lexical-binding: t; -*-
+;;; org-capture-config.el --- Org Capture Configuration -*- lexical-binding: t; -*-
;;; Commentary:
;; Customizations related to org-capture and org-refile is here.
-;; This includes 'web-clipper' functionality.
+;; This includes 'org-webpage-clipper' functionality.
;; To ensure the code below is only loaded after org-mode, all code is wrapped in an
;; eval-after-load function.
@@ -13,93 +13,94 @@
(with-eval-after-load 'org
- ;; ---------------------- Org-Website-Clipper ----------------------
- ;; Saves a copy of the page eww is visiting in an org file for offline reading
- ;; In other words, it's a "Poor Man's Pocket/Instapaper"
+ ;; ---------------------- Org-Webpage-Clipper ----------------------
+ ;; Saves a copy of the page eww is visiting in the 'articles'-file for offline
+ ;; reading. In other words, it's a "Poor Man's Pocket/Instapaper"
-
- (defun org-website-clipper ()
- "Capture a web page for later viewing in an org-file.
+ (defun org-webpage-clipper ()
+ "Capture a web page for later viewing in an org-file.
Encodes all links and marks that may interfere with org mode
display, then inserts the content into a file for later offline use.
This is meant to be used in coordination with an org-capture-template.
Example Template:
- (\"w\" \"Website\" plain (function org-website-clipper)
- \"* %a\\nCaptured On: %U\\n\" :immediate-finish t)))
-
-Requires Emacs 15 and the 2017-02-12 or later version of org-eww.el."
- (interactive)
-
- ;; Ensure valid major mode before encoding
- (cond
- ((eq major-mode 'w3m-mode)
- (org-w3m-copy-for-org-mode))
- ((eq major-mode 'eww-mode)
- (org-eww-copy-for-org-mode))
- (t
- (error "Not valid -- must be in w3m or eww mode")))
-
- ;; Check for full path to the archive file. Create missing directories.
- (unless (file-exists-p article-file)
- (let ((dir (file-name-directory article-file)))
- (unless (file-exists-p dir)
- (make-directory dir))))
-
- ;; Move to end of file and insert blank line for org-capture to add timestamp, etc.
- (find-file article-file)
- (goto-char (point-max))
- (insert "\n\n\n\n\n")
-
- ;; Insert the web content keeping our place.
- (save-excursion (yank))
-
- ;; Remove page info from kill ring. Also, fix the yank pointer.
- (setq kill-ring (cdr kill-ring))
- (setq kill-ring-yank-pointer kill-ring)
-
- ;; Final repositioning.
- (forward-line -1))
+
+,@
+(\"w\" \"Website\" plain (function org-webpage-clipper)
+\"* %a\\nArticle Link: %L\\nCaptured On: %U\\n\\n\" :immediate-finish t)
+'@"
+ (interactive)
+
+ ;; Ensure valid major mode before encoding
+ (cond
+ ((eq major-mode 'w3m-mode)
+ (org-w3m-copy-for-org-mode))
+ ((eq major-mode 'eww-mode)
+ (org-eww-copy-for-org-mode))
+ (t
+ (error "Not valid -- must be in w3m or eww mode")))
+
+ ;; Check for full path to the archive file. Create missing directories.
+ (unless (file-exists-p article-file)
+ (let ((dir (file-name-directory article-file)))
+ (unless (file-exists-p dir)
+ (make-directory dir))))
+
+ ;; Move to end of file and insert blank line for org-capture to add timestamp, etc.
+ (find-file article-file)
+ (goto-char (point-max))
+ (insert "\n\n\n\n\n")
+
+ ;; Insert the web content keeping our place.
+ (save-excursion (yank))
+
+ ;; Remove page info from kill ring. Also, fix the yank pointer.
+ (setq kill-ring (cdr kill-ring))
+ (setq kill-ring-yank-pointer kill-ring)
+
+ ;; Final repositioning.
+ (forward-line -1))
;;;; --------------------------------- Functions -------------------------------
(defun org-capture-pdf-active-region ()
- "Capture the active region of the pdf-view buffer.
+ "Capture the active region of the pdf-view buffer.
Intended to be called within an org capture template."
- (let* ((pdf-buf-name (plist-get org-capture-plist :original-buffer))
- (pdf-buf (get-buffer pdf-buf-name)))
- (if (buffer-live-p pdf-buf)
- (with-current-buffer pdf-buf
- (car (pdf-view-active-region-text)))
- (user-error "Buffer %S not alive." pdf-buf-name))))
+ (let* ((pdf-buf-name (plist-get org-capture-plist :original-buffer))
+ (pdf-buf (get-buffer pdf-buf-name)))
+ (if (buffer-live-p pdf-buf)
+ (with-current-buffer pdf-buf
+ (car (pdf-view-active-region-text)))
+ (user-error "Buffer %S not alive" pdf-buf-name))))
;;;; --------------------------- Org-Capture Templates -------------------------
;; ORG-CAPTURE TEMPLATES
(setq org-protocol-default-template-key "L")
(setq org-capture-templates
- '(
- ("e" "Event" entry (file+headline schedule-file "Scheduled Events")
- "* %?\nWHEN: %^t" :prepend t)
+ '(
+ ("e" "Event" entry (file+headline schedule-file "Scheduled Events")
+ "* %?\nWHEN: %^t" :prepend t)
- ("E" "Epub Text" entry (file+headline inbox-file "Inbox")
- "* %?\n#+BEGIN_QUOTE\n %i\n#+END_QUOTE\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
+ ("E" "Epub Text" entry (file+headline inbox-file "Inbox")
+ "* %?\n#+BEGIN_QUOTE\n %i\n#+END_QUOTE\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
- ("P" "PDF Text" entry (file+headline inbox-file "Inbox")
- "* %?\n#+BEGIN_QUOTE\n %(org-capture-pdf-active-region)\n#+END_QUOTE\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
+ ("P" "PDF Text" entry (file+headline inbox-file "Inbox")
+ "* %?\n#+BEGIN_QUOTE\n %(org-capture-pdf-active-region)\n#+END_QUOTE\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
- ("p" "Link with Selection" entry (file+headline inbox-file "Inbox")
- "* TODO %?\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n[[%:link][%:description]]\nCaptured On: %U" :prepend t)
+ ("p" "Link with Selection" entry (file+headline inbox-file "Inbox")
+ "* TODO %?\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n[[%:link][%:description]]\nCaptured On: %U" :prepend t)
- ("L" "Link" entry (file+headline inbox-file "Inbox")
- "* TODO %?\n[[%:link][%:description]]\nCaptured On: %U" :prepend t)
+ ("L" "Link" entry (file+headline inbox-file "Inbox")
+ "* TODO %?\n[[%:link][%:description]]\nCaptured On: %U" :prepend t)
- ("m" "Mu4e Email" entry (file+headline inbox-file "Inbox")
- "* TODO %?\n[[%:link][%:description]]\nCaptured On: %U" :prepend t)
+ ("m" "Mu4e Email" entry (file+headline inbox-file "Inbox")
+ "* TODO %?%(if (string= \"%i\" \"\") \"\" \"\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\")\n[[%:link][%:description]]\nCaptured On: %U"
+ :prepend t)
- ("w" "Website" plain
- (function org-website-clipper)
- "* %a\nArticle Link: %L\nCaptured On: %U\n\n" :immediate-finish t)))
+ ("w" "Website" plain
+ (function org-webpage-clipper)
+ "* %a\nArticle Link: %L\nCaptured On: %U\n\n" :immediate-finish t)))
) ;; end with-eval-after-load 'org
diff --git a/modules/org-drill-config.el b/modules/org-drill-config.el
index f2120c33..127a94f7 100644
--- a/modules/org-drill-config.el
+++ b/modules/org-drill-config.el
@@ -14,6 +14,7 @@
;;; 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))
diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el
index 1852cde5..c9a5bad1 100644
--- a/modules/org-roam-config.el
+++ b/modules/org-roam-config.el
@@ -94,7 +94,7 @@ ARGS represents the node name to link."
;; -------------------------- Org Roam Find Functions --------------------------
(defun cj/org-roam-find-node (tag template-key template-file)
- "List all node of type \\=`TAG\\=` in completing read for selection or creation."
+ "List all node of type \='TAG\=' in completing read for selection or creation."
(interactive)
;; Add the project file to the agenda after capture is finished
(add-hook 'org-capture-after-finalize-hook #'cj/org-roam-add-node-to-agenda-files-finalize-hook)
@@ -111,24 +111,24 @@ ARGS represents the node name to link."
:unnarrowed t))))
(defun cj/org-roam-find-topic ()
- "List all node of type \\=`topic\\=` in completing read for selection or creation."
+ "List all node of type \=`topic\=` in completing read for selection or creation."
(interactive)
(cj/org-roam-find-node "Topic" "t" "~/sync/org/roam/templates/topic.org"))
(defun cj/org-roam-find-recipe ()
- "List all node of type \\=`recipe\\=` in completing read for selection or creation."
+ "List all node of type \=`recipe\=` in completing read for selection or creation."
(interactive)
(cj/org-roam-find-node "Recipe" "r" "~/sync/org/roam/templates/recipe.org"))
(defun cj/org-roam-find-project ()
- "List all node of type \\='project\\=' in completing read for selection or creation."
+ "List all node of type \='project\=' in completing read for selection or creation."
(interactive)
(cj/org-roam-find-node "Project" "p" "~/sync/org/roam/templates/project.org"))
;; ---------------------- Org Capture After Finalize Hook ----------------------
(defun cj/org-roam-add-node-to-agenda-files-finalize-hook ()
- "Add the captured project file to \\='org-agenda-files\\='."
+ "Add the captured project file to \='org-agenda-files\='."
;; Remove the hook since it was added temporarily
(remove-hook 'org-capture-after-finalize-hook #'cj/org-roam-add-node-to-agenda-files-finalize-hook)
diff --git a/modules/prog-c.el b/modules/prog-c.el
index d3e29d44..3dd4eade 100644
--- a/modules/prog-c.el
+++ b/modules/prog-c.el
@@ -8,7 +8,7 @@
;;;; ------------------------------ C-Mode Settings ------------------------------
(defun cj/c-mode-settings ()
- "Settings for \\='c-mode\\='."
+ "Settings for \='c-mode\='."
(setq-default indent-tabs-mode nil) ;; spaces, not tabs
(setq-default c-basic-offset 4) ;; 4 spaces offset
(setq c-default-style "stroustrup") ;; k&r c, 2nd edition
diff --git a/modules/prog-comments.el b/modules/prog-comments.el
index 61d5e328..62193d6f 100644
--- a/modules/prog-comments.el
+++ b/modules/prog-comments.el
@@ -30,47 +30,46 @@
;; per major mode.
(defun cj/comment-centered (&optional comment-char)
- "Insert comment text centered around the 'COMMENT-CHAR' character.
-Will default to the '#' character if called with no arguments. Uses
-\\="fill-column"\\= or 80 (whichever is less) to calculate the comment length.
-Will begin and end the line with the appropriate comment symbols based on
-programming mode."
+ "Insert comment text centered around the COMMENT-CHAR character.
+Will default to the '#' character if called with no arguments. Uses the value of
+fill-column or 80 (whichever is less) to calculate the comment length. Will
+begin and end the line with the appropriate comment symbols based on programming mode."
(interactive)
(if (not (char-or-string-p comment-char))
- (setq comment-char "#"))
+ (setq comment-char "#"))
(let* ((comment (capitalize (string-trim (read-from-minibuffer "Comment: "))))
- (fill-column (min fill-column 80))
- (comment-length (length comment))
- (comment-start-length (length comment-start))
- (comment-end-length (length comment-end))
- (current-column-pos (current-column))
- (space-on-each-side (/ (- fill-column
- current-column-pos
- comment-length
- (length comment-start)
- (length comment-end)
- ;; Single space on each side of comment
- (if (> comment-length 0) 2 0)
- ;; Single space after comment syntax sting
- 1)
- 2)))
+ (fill-column (min fill-column 80))
+ (comment-length (length comment))
+ (comment-start-length (length comment-start))
+ (comment-end-length (length comment-end))
+ (current-column-pos (current-column))
+ (space-on-each-side (/ (- fill-column
+ current-column-pos
+ comment-length
+ (length comment-start)
+ (length comment-end)
+ ;; Single space on each side of comment
+ (if (> comment-length 0) 2 0)
+ ;; Single space after comment syntax sting
+ 1)
+ 2)))
(if (< space-on-each-side 2)
- (message "Comment string is too big to fit in one line")
- (progn
- (insert comment-start)
- (when (equal comment-start ";") ; emacs-lisp line comments are ;;
- (insert comment-start)) ; so insert comment-char again
- (insert " ")
- (dotimes (_ space-on-each-side) (insert comment-char))
- (when (> comment-length 0) (insert " "))
- (insert comment)
- (when (> comment-length 0) (insert " "))
- (dotimes (_ (if (= (% comment-length 2) 0)
- (- space-on-each-side 1)
- space-on-each-side))
- (insert comment-char))
- (insert " ")
- (insert comment-end)))))
+ (message "Comment string is too big to fit in one line")
+ (progn
+ (insert comment-start)
+ (when (equal comment-start ";") ; emacs-lisp line comments are ;;
+ (insert comment-start)) ; so insert comment-char again
+ (insert " ")
+ (dotimes (_ space-on-each-side) (insert comment-char))
+ (when (> comment-length 0) (insert " "))
+ (insert comment)
+ (when (> comment-length 0) (insert " "))
+ (dotimes (_ (if (= (% comment-length 2) 0)
+ (- space-on-each-side 1)
+ space-on-each-side))
+ (insert comment-char))
+ (insert " ")
+ (insert comment-end)))))
(global-set-key (kbd "C-z c l") 'cj/comment-line)
;; ------------------------------- Comment Hyphen ------------------------------
diff --git a/modules/prog-general.el b/modules/prog-general.el
index b374daf3..1f1b8e4e 100644
--- a/modules/prog-general.el
+++ b/modules/prog-general.el
@@ -49,19 +49,16 @@
("<backtab>" . bicycle-cycle-global)))
;; --------------------------- Project Switch Actions --------------------------
-;; if there's a todo or readme file in the project, display it when switching
+;; when switching projects, display the todo file if it exists, or display
+;; magit-status if it doesn't.
(defun cj/project-switch-actions ()
"Opens TODO or README file on projectile switch project.
If none exists, it opens magit-status."
- ;; (dired-sidebar-hide-sidebar)
- ;; (dired-sidebar-show-sidebar)
- (let ((todo-file
- (cond
- ((file-exists-p (concat (projectile-project-root) "TODO.org")) "TODO.org")
- ((file-exists-p (concat (projectile-project-root) "todo.org")) "todo.org")
- ((file-exists-p (concat (projectile-project-root) "TODO.md")) "TODO.md")
- ((file-exists-p (concat (projectile-project-root) "TODO.txt")) "TODO.txt"))))
+ (let* ((files (directory-files (projectile-project-root)))
+ (todo-file (seq-find (lambda (file)
+ (string-match-p "todo\\.\\(org\\|md\\|txt\\)\\'"
+ (downcase file))) files)))
(if todo-file
(find-file (concat (projectile-project-root) todo-file))
(magit-status))))
@@ -69,16 +66,11 @@ If none exists, it opens magit-status."
;; --------------------------------- Projectile --------------------------------
;; project support
-;; notify user when scanning for projects
-(defun cj/projectile-identify-projects ()
- (message "No project cache found. Identifying projects....")
- (projectile-discover-projects-in-search-path))
-
;; only run discover projects when there's no bookmarks file
(defun cj/projectile-schedule-project-discovery ()
- (let ((bookmark-file (concat user-emacs-directory "/projectile-bookmarks.eld")))
- (unless (file-exists-p bookmark-file)
- (run-at-time "3" nil 'cj/projectile-identify-projects))))
+ (let ((projectile-bookmark-file (concat user-emacs-directory "/projectile-bookmarks.eld")))
+ (unless (file-exists-p projectile-bookmark-file)
+ (run-at-time "3" nil 'projectile-discover-projects-in-search-path))))
(use-package projectile
:defer .5
@@ -92,7 +84,9 @@ If none exists, it opens magit-status."
(projectile-project-search-path '("~/code"
"~/projects"))
:config
+ ;; scan for projects if none are defined
(cj/projectile-schedule-project-discovery)
+
;; don't reuse comp buffers between projects
(setq projectile-per-project-compilation-buffer t)
(projectile-mode)
@@ -120,7 +114,15 @@ If none exists, it opens magit-status."
:after projectile
:bind
(:map projectile-command-map
- ("G" . projectile-ripgrep)))
+ ("G" . projectile-ripgrep))
+ :config
+
+ ;; when running ripgrep searches, end with the results window selected
+ (defun switch-to-ripgrep-results (&rest _)
+ "Switch to *ripgrep-search* buffer in other window."
+ (pop-to-buffer "*ripgrep-search*"))
+
+ (advice-add 'ripgrep-regexp :after #'switch-to-ripgrep-results))
;; ---------------------------------- Snippets ---------------------------------
;; reusable code and text.
@@ -174,7 +176,7 @@ If none exists, it opens magit-status."
("WIP" . "#1E90FF"))))
;; --------------------------- Whitespace Management ---------------------------
-;; when saving your file, trims unneeded whitespace only from lines you've modified
+;; trims trailing whitespace only from lines you've modified when saving buffer
(use-package ws-butler
:defer .5
@@ -187,7 +189,7 @@ If none exists, it opens magit-status."
(setq ws-butler-convert-leading-tabs-or-spaces t))
;; ----------------- Auto-Close Successful Compilation Windows -----------------
-;; from 'enberg' on #emacs
+;; close compilation windows when successful. from 'enberg' on #emacs
(add-hook 'compilation-finish-functions
(lambda (buf str)
diff --git a/modules/prog-go.el b/modules/prog-go.el
index 617fceaa..70e1f832 100644
--- a/modules/prog-go.el
+++ b/modules/prog-go.el
@@ -5,6 +5,8 @@
;;; Code:
+;; ---------------------------------- Go Setup ---------------------------------
+;; golang preferences
(defun cj/go-setup ()
"My default code preferences for Golang."
@@ -20,7 +22,8 @@
(electric-pair-mode t)) ;; match delimiters automatically
(add-hook 'go-mode-hook 'cj/go-setup)
-;;;; ---------------------------- Go Mode ----------------------------
+;; ---------------------------------- Go Mode ----------------------------------
+;; go mode configuration
(use-package go-mode
:bind (:map go-mode-map
@@ -34,52 +37,5 @@
;; go install golang.org/x/tools/cmd/goimports@latest
(setq gofmt-command "goimports"))
-;; (use-package go-mode
-;; :config
-;; (general-define-key
-;; :keymaps 'go-mode-map
-;; :states '(normal)
-;; "K" #'godoc-at-point
-;; "C-]" #'godef-jump)
-
-;; (general-define-key
-;; :keymaps 'go-mode-map
-;; :states '(normal)
-;; :prefix mpereira/leader
-;; "tt" #'go-test-current-test
-;; "tT" #'go-test-current-file
-;; "pt" #'go-test-current-project))
-
-;; ------------- Configure Emacs To Find Go Project Root -------------
-
-;; Note: This appears to interfere with tramp. Before re-enabling, this
-;; should have a toggle and turned off when working in tramp.
-
-;; (require 'project)
-
-;; (defun project-find-go-module (dir)
-;; (when-let ((root (locate-dominating-file dir "go.mod")))
-;; (cons 'go-module root)))
-
-;; (cl-defmethod project-root ((project (head go-module)))
-;; (cdr project))
-
-;; (add-hook 'project-find-functions #'project-find-go-module)
-
-;; -------------------- Enable Eglot Integrations --------------------
-
-;; The depth of -10 places this before eglot's willSave notification,
-;; so that that notification reports the actual contents that will be saved.
-;; (defun eglot-format-buffer-on-save ()
-;; (add-hook 'before-save-hook #'eglot-format-buffer -10 t))
-;; (add-hook 'go-mode-hook #'eglot-format-buffer-on-save)
-
-;; -------------------- Configure Gopls Via Eglot --------------------
-
-;; (setq-default eglot-workspace-configuration
-;; '((:gopls .
-;; ((staticcheck . t)
-;; (matcher . "CaseSensitive")))))
-
(provide 'prog-go)
;;; prog-go.el ends here
diff --git a/modules/prog-python.el b/modules/prog-python.el
index 5dc06bf6..e85ae548 100644
--- a/modules/prog-python.el
+++ b/modules/prog-python.el
@@ -5,46 +5,52 @@
;;; Code:
-;; ------------------------- General Settings ------------------------
-
-(add-hook 'python-mode-hook (lambda () (setq indent-tabs-mode nil))) ;; use spaces, not tabs
+;; -------------------------------- Python Setup -------------------------------
+;; preferences for Python programming
+
+(defun cj/python-setup ()
+ "My default code preferences for Python coding."
+ (tree-sitter-hl-mode) ;; use tree-sitter's highlighting
+ (hs-minor-mode) ;; folding
+ (company-mode) ;; completion framework
+ (flyspell-prog-mode) ;; spell check comments
+ (superword-mode) ;; see-this-as-one-word
+ (setq-default fill-column 80) ;; wrap at 80 columns
+ (setq-default tab-width 4) ;; set the tab width to 4 spaces
+ (setq-default standard-indent 4) ;; indent 4 spaces
+ (setq-default indent-tabs-mode nil) ;; disable tab characters
+ (electric-pair-mode t)) ;; match delimiters automatically
;; ----------------------------------- Python ----------------------------------
-;; remove the guess indent python message
+;; configuration for Emacs' built-in Python editing support
(use-package python
- :config
- (setq python-indent-guess-indent-offset-verbose nil))
-
-;; --------------------------- Python Mode ---------------------------
-
-(use-package python-mode
:ensure nil ;; built-in
:hook
- ((python-mode . flyspell-prog-mode)
- (python-mode . superword-mode)
- (python-mode . company-mode)
- (python-mode . electric-pair-mode)) ;; auto-complete braces and pairs
+ (python-mode . cj/python-setup)
:custom
(python-shell-interpreter "python3")
- (setq python-indent-offset 4)) ;; 4 spaces default indent
+ :config
+ ;; remove the "guess indent" python message
+ (setq python-indent-guess-indent-offset-verbose nil))
;; ----------------------------------- Poetry ----------------------------------
;; virtual environments and dependencies
-;; (use-package poetry
-;; :defer t
-;; :config
-;; ;; Checks for the correct virtualenv. Better strategy IMO because the default
-;; ;; one is quite slow.
-;; (setq poetry-tracking-strategy 'switch-buffer)
-;; :hook (python-mode . poetry-tracking-mode))
+(use-package poetry
+ :defer t
+ :after (python)
+ :hook (python-mode . poetry-tracking-mode)
+ :config
+ ;; Checks for the correct virtualenv. Better strategy IMO because the default
+ ;; one is quite slow.
+ (setq poetry-tracking-strategy 'switch-buffer))
;; ---------------------------------- Blacken ----------------------------------
;; formatting on save
(use-package blacken
- :defer t
+ :defer 1
:custom
(blacken-allow-py36 t)
(blacken-skip-string-normalization t)
@@ -54,20 +60,21 @@
;; automatically insert NumPy style docstrings in Python function definitions
(use-package numpydoc
- :defer t
+ :defer 1
:custom
(numpydoc-insert-examples-block nil)
(numpydoc-template-long nil)
:bind (:map python-mode-map
("C-c C-n" . numpydoc-generate)))
-;; ------------------------------------ Toml -----------------------------------
+;; ------------------------------------ TOML -----------------------------------
+;; editing support and documentation for TOML files
(use-package toml-mode
- :defer .5)
+ :defer 1)
(use-package eldoc-toml
- :defer .5)
+ :defer 1)
(provide 'prog-python)
diff --git a/modules/show-kill-ring.el b/modules/show-kill-ring.el
index fdc400ee..e6405c6d 100644
--- a/modules/show-kill-ring.el
+++ b/modules/show-kill-ring.el
@@ -1,21 +1,24 @@
;;; show-kill-ring --- Displays Previous Kill Ring Entries -*- lexical-binding: t; -*-;; Show Kill Ring
;; Stolen from Steve Yegge when he wasn't looking
-
;;; Commentary:
;; Browse items you've previously killed.
-
;;; Code:
(require 'cl-lib)
(defvar show-kill-max-item-size 1000
- "This represents the size of a \\='kill ring\\=' entry.
-A positive number means to limit the display of \\='kill-ring\\=' items to
+ "This represents the size of a \='kill ring\=' entry.
+A positive number means to limit the display of \='kill-ring\=' items to
that number of characters.")
+(defun show-kill-ring-exit ()
+ "Exit the show-kill-ring buffer."
+ (interactive)
+ (quit-window t))
+
(defun show-kill-ring ()
"Show the current contents of the kill ring in a separate buffer.
This makes it easy to figure out which prefix to pass to yank."
@@ -39,7 +42,7 @@ This makes it easy to figure out which prefix to pass to yank."
;; show each of the items in the kill ring, in order
(while temp
;; insert our little divider
- (insert (concat "\n" bar item (prin1-to-string count) " "
+ (insert (concat "\n" bar item (prin1-to-string count) " "
(if (< count 10) bar2 bar) "\n"))
;; if this is the yank pointer target, grab it
@@ -52,12 +55,16 @@ This makes it easy to figure out which prefix to pass to yank."
(setq temp (cdr temp)))
;; show info about yank item
- (show-kill-insert-footer yptr ynum)
+ (show-kill-insert-footer yptr ynum)
+
+ (use-local-map (make-sparse-keymap))
+ (local-set-key "q" 'show-kill-ring-exit)
;; show it
- (goto-char (point-min))
- (set-buffer-modified-p nil)
- (display-buffer buf)))
+ (goto-char (point-min))
+ (setq buffer-read-only t)
+ (set-buffer-modified-p nil)
+ (pop-to-buffer buf)))
(defun show-kill-insert-item (item)
"Insert an ITEM from the kill ring into the current buffer.
diff --git a/modules/system-utils.el b/modules/system-utils.el
index bab4f01a..f5967520 100644
--- a/modules/system-utils.el
+++ b/modules/system-utils.el
@@ -18,27 +18,61 @@
(setq nerd-icons-ibuffer-color-icon t)
(setq nerd-icons-ibuffer-human-readable-size t))
-;; ------------------------------ Bury Alive List ------------------------------
-;; buries buffers on the 'cj/bury-alive-list' list rather than killing them. The
-;; keybinding for kill-buffer is remapped to this function.
-
-(defvar cj/bury-alive-list '("*dashboard*" "*scratch*" "*Messages*")
+;; ------------------------ Killing Buffers And Windows ------------------------
+;; Accidentally killing buffers can lose data. these functions override common
+;; buffer killing functions and buries buffers on the 'cj/buffer-bury-alive-list' list
+;; rather than killing them. Allows for interactive adding to the
+;; 'cj/buffer-bury-alive-list' via 'C-u C-x k'
+
+;; BUFFER BURY ALIVE LIST
+(defvar cj/buffer-bury-alive-list '("*dashboard*" "*scratch*" "*Messages*")
"Buffers that shouldn't be killed, but buried instead.")
-(defun cj/kill-or-bury-alive (target-buffer)
+;; KILL BUFFER AND WINDOW
+(defun cj/kill-buffer-and-window ()
+ "Kill current buffer and window.
+Buries buffers instead if they are on the cj/buffer-bury-alive-list."
+ (interactive)
+ (let ((target-buffer (current-buffer)))
+ (delete-window)
+ (cj/kill-buffer-or-bury-alive target-buffer)))
+(global-set-key (kbd "M-C") 'cj/kill-buffer-and-window)
+
+;; KILL OTHER WINDOW
+(defun cj/kill-other-window ()
+ "Close the next window and kill any buffer in it.
+Buries buffers instead if they are on the cj/buffer-bury-alive-list."
+ (interactive)
+ (other-window 1)
+ (let ((target-buffer (current-buffer)))
+ (if (not (one-window-p)) (delete-window))
+ (cj/kill-buffer-or-bury-alive target-buffer)))
+(global-set-key (kbd "M-O") 'cj/kill-other-window)
+
+;; KILL ALL OTHER BUFFERS AND WINDOWS
+(defun cj/kill-all-other-buffers-and-windows ()
+ "Save buffers, then kill all other buffers and windows.
+Buries buffers instead if they are on the cj/buffer-bury-alive-list."
+ (interactive)
+ (save-some-buffers)
+ (delete-other-windows)
+ (mapc 'cj/kill-buffer-or-bury-alive (delq (current-buffer) (buffer-list))))
+(global-set-key (kbd "M-M") 'cj/kill-all-other-buffers-and-windows)
+
+;; KILL BUFFER OR BURY ALIVE
+(defun cj/kill-buffer-or-bury-alive (target-buffer)
"Bury buffers on the bury-instead-list rather than killing them.
-With a prefix argument, add the TARGET-BUFFER to \='cj/bury-alive-list\='."
+With a prefix argument, add the TARGET-BUFFER to \='cj/buffer-bury-alive-list\='."
(interactive "bKill or Add to bury (don't kill) buffer list: ")
(with-current-buffer target-buffer
(if current-prefix-arg
(progn
- (add-to-list 'cj/bury-alive-list (buffer-name (current-buffer)))
+ (add-to-list 'cj/buffer-bury-alive-list (buffer-name (current-buffer)))
(message "Added %s to bury-alive-list" (buffer-name (current-buffer))))
- (if (member (buffer-name (current-buffer)) cj/bury-alive-list)
+ (if (member (buffer-name (current-buffer)) cj/buffer-bury-alive-list)
(bury-buffer)
(kill-buffer (current-buffer))))))
-
-(global-set-key [remap kill-buffer] #'cj/kill-or-bury-alive)
+(global-set-key [remap kill-buffer] #'cj/kill-buffer-or-bury-alive)
;; --------------------------- Emacs Server Shutdown ---------------------------
;; shuts down the Emacs server. useful with emacsclient.
@@ -243,14 +277,16 @@ The function offers the option to open the `macros-file' for editing when called
(write-region ";;; -*- lexical-binding: t -*-\n" nil macros-file)
(message "Saved macros file not found, so created: %s" macros-file)))
-;; ----------------------------- Merge List To List ----------------------------
-;; Convenience method for merging two lists together
-;; https://emacs.stackexchange.com/questions/38008/adding-many-items-to-a-list/68048#68048
+;; -------------------------------- Abbrev Mode --------------------------------
+;; word abbreviations mode. used to auto-correct spelling (see flyspell-config)
-(defun cj/merge-list-to-list (dst src)
- "Merge content of the 2nd list SRC with the 1st one DST."
- (set dst
- (append (eval dst) src)))
+(use-package abbrev-mode
+ :ensure nil ;; built-in
+ :defer .5
+ :custom
+ (abbrev-file-name (concat user-emacs-directory "assets/abbrev_defs")) ;; keep project root clean
+ :config
+ (abbrev-mode)) ;; use abbrev mode everywhere
;; -------------------------------- Log Silently -------------------------------
;; utility function to log silently to the Messages buffer (for debugging/warning)
diff --git a/modules/test-code.el b/modules/test-code.el
index 6c586f03..74179c95 100644
--- a/modules/test-code.el
+++ b/modules/test-code.el
@@ -118,25 +118,7 @@ otherwise use the default location in `cj/recording-location'."
:after xterm-color
:load-path ("~/code/emacs-wttrin")
:bind
- ("C-c w" . wttrin)
- :custom
- (wttrin-unit-system "u")
- (wttrin-default-cities '(
- "Albuquerque, New Mexico"
- "Berkeley, CA"
- "Boston, Massachussetts"
- "Chicago, Illinois"
- "Huntington Beach, CA"
- "Littlestown, PA"
- "London, UK"
- "New Orleans, LA"
- "New York, New York"
- "Oakland, California"
- "Paris, FR"
- "San Francisco, California"
- "Santa Fe, New Mexico"
- "Yerevan, AM"
- )))
+ ("M-W" . wttrin))
;; dependency for wttrin
(use-package xterm-color
diff --git a/modules/text-config.el b/modules/text-config.el
index 2924521d..221ca71b 100644
--- a/modules/text-config.el
+++ b/modules/text-config.el
@@ -8,7 +8,7 @@
;; ------------------------------- Text Settings -------------------------------
(defun cj/text-mode-settings ()
- "Personal settings for \\='text-mode\\='."
+ "Personal settings for \='text-mode\='."
(turn-on-visual-line-mode) ;; wrap text in text modes (additional modes set elsewhere)
(setq-default indent-tabs-mode nil) ;; indentation should not insert tabs
(setq sentence-end-double-space nil)) ;; in the 21st century, sentences may end w/ a single space
diff --git a/modules/ui-navigation.el b/modules/ui-navigation.el
index 44e5ae5d..e9f3cdc5 100644
--- a/modules/ui-navigation.el
+++ b/modules/ui-navigation.el
@@ -95,31 +95,6 @@ This function won't work with more than one split window."
;; SWAP WINDOW POSITIONS
(global-set-key (kbd "M-S") 'window-swap-states)
-;; ------------------------------ Killing Windows ------------------------------
-
-;; KILL THIS WINDOW
-(global-set-key (kbd "M-C") 'kill-buffer-and-window)
-
-;; KILL OTHER WINDOW
-(defun cj/kill-other-window ()
- "Close the next window and kill any buffer in it."
- (interactive)
- (other-window 1)
- (kill-this-buffer)
- (if (not (one-window-p))
- (delete-window)))
-(global-set-key (kbd "M-O") 'cj/kill-other-window)
-
-
-;; KILL-ALL-OTHER-BUFFERS
-(defun cj/kill-all-other-buffers-and-windows ()
- "Save buffers, then kill all other buffers and windows."
- (interactive)
- (save-some-buffers)
- (delete-other-windows)
- (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))
-(global-set-key (kbd "M-M") 'cj/kill-all-other-buffers-and-windows)
-
;; ---------------------------- Buffer Manipulation ----------------------------
;; MOVE BUFFER