From 4566ec69d269ecba8d9386a131b932ee5244aa8e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 5 May 2024 09:23:58 -0500 Subject: 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 --- modules/config-utilities.el | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'modules/config-utilities.el') 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) -- cgit v1.2.3