summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-09-23 17:08:47 -0500
committerCase Duckworth2021-09-23 17:09:23 -0500
commit22d38c37996d3aa0020b2affd1012248de7246ea (patch)
tree525becd5807efc606ba532794ab753cfaf620589
parentMerge branch 'main' of tildegit.org:acdw/emacs (diff)
downloademacs-22d38c37996d3aa0020b2affd1012248de7246ea.tar.gz
emacs-22d38c37996d3aa0020b2affd1012248de7246ea.zip
Break out cus-edit functions
-rw-r--r--init.el29
-rw-r--r--lisp/acdw-cus-edit.el32
2 files changed, 35 insertions, 26 deletions
diff --git a/init.el b/init.el index b0d9d77..48f3d39 100644 --- a/init.el +++ b/init.el
@@ -345,6 +345,7 @@ In short, DO NOT USE THIS FUNCTION!!!"
345 (blink-cursor-mode +1)) 345 (blink-cursor-mode +1))
346 346
347(setup cus-edit 347(setup cus-edit
348 (:also-load acdw-cus-edit)
348 (:option custom-file (acdw/dir "custom.el") 349 (:option custom-file (acdw/dir "custom.el")
349 custom-magic-show nil 350 custom-magic-show nil
350 custom-magic-show-button t 351 custom-magic-show-button t
@@ -359,34 +360,10 @@ In short, DO NOT USE THIS FUNCTION!!!"
359 360
360 ;; `Custom-mode-hook' fires /before/ the widgets are built, so I have to 361 ;; `Custom-mode-hook' fires /before/ the widgets are built, so I have to
361 ;; install advice after the widgets are made. 362 ;; install advice after the widgets are made.
362 (:advise custom-buffer-create :after 363 (:advise custom-buffer-create-internal :after #'acdw-cus/expand-widgets)
363 (defun custom-buffer@expand-widgets (&rest _)
364 "Expand descriptions in `Custom-mode' buffers."
365 (interactive)
366 ;; "More/Hide" widgets (thanks alphapapa!)
367 (widget-map-buttons (lambda (widget _)
368 (pcase (widget-get widget :off)
369 ("More" (widget-apply-action widget)))
370 nil))
371 ;; "Show Value" widgets (the little triangles)
372 (widget-map-buttons (lambda (widget _)
373 (pcase (widget-get widget :off)
374 ("Show Value"
375 (widget-apply-action widget)))
376 nil))))
377 364
378 (:with-mode Custom-mode 365 (:with-mode Custom-mode
379 (:local-set imenu-generic-expression ; thanks u/oantolin! 366 (:local-set imenu-generic-expression acdw-cus/imenu-generic-expression)))
380 '(("Faces" (rx (seq bol
381 (or "Show" "Hide") " "
382 (group (zero-or-more nonl))
383 " face: [sample]"))
384 1)
385 ("Variables" (rx (seq bol
386 (or "Show Value" "Hide") " "
387 (group (zero-or-more
388 (not (any "\n:"))))))
389 1)))))
390 367
391(setup debugger 368(setup debugger
392 (:hook visual-line-mode)) 369 (:hook visual-line-mode))
diff --git a/lisp/acdw-cus-edit.el b/lisp/acdw-cus-edit.el new file mode 100644 index 0000000..c40f137 --- /dev/null +++ b/lisp/acdw-cus-edit.el
@@ -0,0 +1,32 @@
1;;; acdw-cus-edit.el -*- lexical-binding: t -*-
2
3(defun acdw-cus/expand-widgets (&rest _)
4 "Expand descriptions in `Custom-mode' buffers."
5 (interactive)
6 ;; "More/Hide" widgets (thanks alphapapa!)
7 (widget-map-buttons (lambda (widget _)
8 (pcase (widget-get widget :off)
9 ("More" (widget-apply-action widget)))
10 nil))
11 ;; "Show Value" widgets (the little triangles)
12 (widget-map-buttons (lambda (widget _)
13 (pcase (widget-get widget :off)
14 ("Show Value"
15 (widget-apply-action widget)))
16 nil)))
17
18(defvar acdw-cus/imenu-generic-expression ; thanks u/oantolin!
19 '(("Faces" (rx (seq bol
20 (or "Show" "Hide") " "
21 (group (zero-or-more nonl))
22 " face: [sample]"))
23 1)
24 ("Variables" (rx (seq bol
25 (or "Show Value" "Hide") " "
26 (group (zero-or-more
27 (not (any "\n:"))))))
28 1))
29 "Show faces and variables in `imenu'.")
30
31(provide 'acdw/cus-edit)
32;;; acdw-cus-edit.el ends here