aboutsummaryrefslogtreecommitdiff
path: root/modules/custom-whitespace.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-29 04:41:40 -0400
committerCraig Jennings <c@cjennings.net>2026-06-29 04:41:40 -0400
commit37d53dacf0636ae299b092b54dde78c0658a51c1 (patch)
tree6eb61c1a9220bbbf13bafc931476d87b61c5b27d /modules/custom-whitespace.el
parent256027866f9ff2cbc3b6155950f21a92b54ea307 (diff)
downloaddotemacs-37d53dacf0636ae299b092b54dde78c0658a51c1.tar.gz
dotemacs-37d53dacf0636ae299b092b54dde78c0658a51c1.zip
refactor: split custom-misc.el into focused modules
custom-misc.el was an incoherent grab-bag, so anything small defaulted to landing there. I split its eight commands by concern. Three moved into new modules: custom-format (region/buffer reformat), custom-counts (word and character counts), and custom-text-transform (fraction glyphs). The other three went to existing homes: the previous-buffer toggle to custom-buffer-file, the delimiter jump to custom-line-paragraph, and the align-regexp space advice with its alignment and fill bindings to custom-whitespace. The C-; bindings, which-key labels, and the six test files moved with their functions, and custom-misc.el is deleted. No behavior change: every command keeps its name and its C-; key.
Diffstat (limited to 'modules/custom-whitespace.el')
-rw-r--r--modules/custom-whitespace.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/custom-whitespace.el b/modules/custom-whitespace.el
index cbf3eff12..52cc4e54d 100644
--- a/modules/custom-whitespace.el
+++ b/modules/custom-whitespace.el
@@ -228,5 +228,21 @@ Operate on the active region designated by START and END."
"C-; w t" "untabify"
"C-; w T" "tabify"))
+;; --- align-regexp space enforcement + alignment/fill bindings ---
+;; (formerly in custom-misc.el)
+(defun cj/align-regexp-with-spaces (orig-fun &rest args)
+ "Call ORIG-FUN with ARGS while temporarily disabling tabs for alignment.
+This advice ensures =align-regexp' uses spaces by binding =indent-tabs-mode'
+to nil."
+ (let ((indent-tabs-mode nil))
+ (apply orig-fun args)))
+
+;; avoid double advice stacking in case the file is reloaded
+(advice-remove 'align-regexp #'cj/align-regexp-with-spaces)
+(advice-add 'align-regexp :around #'cj/align-regexp-with-spaces)
+
+(cj/register-command "A" #'align-regexp "align regexp")
+(cj/register-command "|" #'display-fill-column-indicator-mode "fill column")
+
(provide 'custom-whitespace)
;;; custom-whitespace.el ends here.