From a55a5248bd2dae5f849476d0f7b5dcd8d91cf929 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 8 Apr 2024 17:16:29 -0500 Subject: fit and finish work - gptel: added gptel-send-region with global keybinding - projectile: made project-switch-actions more efficient with regexp - prog-go: removed disabled code - mu4e: capture template captures region if selected - system utils: merged bury alive with other killing buffer code - org-capture: renamed *website-clipper to org-webpage-clipper - rg: auto switch to ripgrep-results window when ripgrep search completes - dashboard: remove dashboard banner custom face General - moved abbrev_defs to assets - removed gitmodules file - updated packages - fixed docstring and formatting throughout Custom-Functions - move cj/merge-list-to-list to custom-functions - add remove leading trailing whitespace function - corrected arrayify prompt Font-Config - added font point sizes in fontaine menu - make default font point size 11 Python - adding back python poetry support - added cj/python-setup method - merge python and python-mode configurations (they are the same built-in package) Show-Kill-Ring - show-kill-ring displays in another read-only buffer - show-kill-ring exits with q Elfeed - moved elfeed-feeds.org to assets - removed Wired from elfeed feeds - moved ElfeedDB to user-emacs-directory/.elfeed-db - moved elfeed-dashboard.org to assets --- modules/prog-general.el | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'modules/prog-general.el') 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 @@ ("" . 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) -- cgit v1.2.3