summaryrefslogtreecommitdiff
path: root/modules/config-utilities.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-05-05 09:23:58 -0500
committerCraig Jennings <c@cjennings.net>2024-05-05 09:34:19 -0500
commit4566ec69d269ecba8d9386a131b932ee5244aa8e (patch)
treefa00edae4ba8c93eee7861fa795052511d4e0f29 /modules/config-utilities.el
parent5f19638abc20eb24511a4129df2be09e1554591c (diff)
downloaddotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.tar.gz
dotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.zip
enhancements, functions, tests, and misc
enhancements - move accent-company to C-` and ensure it's on for org mode - re-enable narrow-to-region - turn on network repos by default - remove setq in company's use-package custom clause - increase company delay to .7 secs - recipe templates should have visibility show all - move video recordings code to separate module - move geiser-guile to prog-lisp functions - improve cj/reformat-region-or-buffer via restriction - improvements to test-format-region - adding tests for clear-blank-lines - Add prepend-lines and replace-fraction-glyphs functions - add cj/clear-blank-lines function - create cj/load-all-tests utility function tests - add keybinding for ert-run-tests-interactively - ensure ert libraries are available to load-all-tests - remove running the tests when evaluating the buffer - fix clear-blank-lines and adding better tests misc - updated packages - adding the luddite blog to elfeed - more abbrevs
Diffstat (limited to 'modules/config-utilities.el')
-rw-r--r--modules/config-utilities.el35
1 files changed, 30 insertions, 5 deletions
diff --git a/modules/config-utilities.el b/modules/config-utilities.el
index 3aaa006d..90268b7d 100644
--- a/modules/config-utilities.el
+++ b/modules/config-utilities.el
@@ -6,6 +6,24 @@
;;; Code:
+
+;; ------------------------------- Load ERT Tests ------------------------------
+
+(defun cj/load-all-tests ()
+ "`load' all ert libraries in test which are not already loaded."
+ (interactive)
+ (require 'ert)
+ (setq ert--tests (make-hash-table :test 'equal)) ;; forget all existing tests
+ (eval-buffer)
+ (let ((libraries-loaded (mapcar #'file-name-sans-extension
+ (delq nil (mapcar #'car load-history))))
+ (dir (concat user-emacs-directory "tests/")))
+ (dolist (file (directory-files dir t ".+\\.elc?$"))
+ (let ((library (file-name-sans-extension file)))
+ (unless (member library libraries-loaded)
+ (load library nil t)
+ (push library libraries-loaded))))))
+
;; ------------------------------ Reload Init File -----------------------------
;; it does what it says it does.
@@ -23,13 +41,19 @@
Will recompile natively if supported, or byte-compiled if not."
(interactive)
(let* ((native-comp-supported (boundp 'native-compile-async))
- (elt-dir (expand-file-name (if native-comp-supported "eln" "elc") user-emacs-directory))
- (message-format (format "Please confirm recursive %s recompilation of %%s: " (if native-comp-supported "native" "byte")))
- (compile-message (format "%scompiling all emacs-lisp files in %%s" (if native-comp-supported "Natively " "Byte-"))))
+ (elt-dir
+ (expand-file-name (if native-comp-supported "eln" "elc")
+ user-emacs-directory))
+ (message-format
+ (format "Please confirm recursive %s recompilation of %%s: "
+ (if native-comp-supported "native" "byte")))
+ (compile-message (format "%scompiling all emacs-lisp files in %%s"
+ (if native-comp-supported "Natively " "Byte-"))))
(if (yes-or-no-p (format message-format user-emacs-directory))
(progn
(message "Deleting all compiled files in %s" user-emacs-directory)
- (dolist (file (directory-files-recursively user-emacs-directory "\\(\\.elc\\|\\.eln\\)$"))
+ (dolist (file (directory-files-recursively user-emacs-directory
+ "\\(\\.elc\\|\\.eln\\)$"))
(delete-file file))
(when (file-directory-p elt-dir)
(delete-directory elt-dir t t))
@@ -46,7 +70,8 @@ Will recompile natively if supported, or byte-compiled if not."
(defun cj/delete-emacs-home-compiled-files ()
"Delete all compiled files recursively in \='user-emacs-directory\='."
(interactive)
- (message "Deleting compiled files under %s. This may take a while." user-emacs-directory)
+ (message "Deleting compiled files under %s. This may take a while."
+ user-emacs-directory)
(require 'find-lisp) ;; make sure the package is required
(mapc (lambda (path)
(when (or (string-suffix-p ".elc" path)