From a6a027876d5b2a02aa695a164df3a251fd48349b Mon Sep 17 00:00:00 2001
From: Case Duckworth
Date: Tue, 10 Aug 2021 18:47:20 -0500
Subject: Enhance `customize' buffer for browsing

I rarely use `customize' to actually set any options, preferring the
programmatic `setup' macro.  However, I often use `customize' to browse through
my options for different packages.  This setup removes the buttons and shows
all hidden elements so I can more easily scroll through the `customize' buffer.
---
 init.el | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/init.el b/init.el
index e6ce498..92a74b0 100644
--- a/init.el
+++ b/init.el
@@ -167,31 +167,29 @@
   (:option custom-file (acdw/dir "custom.el")
            custom-magic-show nil
            custom-magic-show-button t
+           custom-raised-buttons nil
            custom-unlispify-tag-names nil
-           custom-variable-default-form 'edit)
+           custom-variable-default-form 'lisp)
 
-  (defun unpackaged/custom-toggle-all-more-hide ()
+  (defun unpackaged/custom-toggle-all-more-hide (&rest _)
     "Toggle all \"More/Hide\" widgets in current buffer."
     (interactive)
     (widget-map-buttons (lambda (widget _)
                           (pcase (widget-get widget :off)
                             ("More" (widget-apply-action widget)))
                           nil)))
-  (add-hook 'Custom-mode-hook #'unpackaged/custom-toggle-all-more-hide)
+  (advice-add 'custom-buffer-create
+              :after #'unpackaged/custom-toggle-all-more-hide)
 
-  (defun unpackaged/custom-set-at-point ()
-    "Set current value of widget at point."
+  (defun acdw/custom-toggle-showing-all-values (&rest _)
+    "Toggle all \"Show Value\" widgets in current buffer."
     (interactive)
-    (cl-labels ((find-widget (widget property)
-                             (if (widget-get widget property)
-                                 widget
-                               (find-widget (widget-get widget :parent) property))))
-      (when-let* ((widget (find-widget (widget-at) :custom-set)))
-        (when (eq (widget-get widget :custom-state) 'modified)
-          (widget-apply widget :custom-set)))))
-  
-  (:with-map custom-field-keymap
-    (:bind "C-c C-c" unpackaged/custom-set-at-point)))
+    (widget-map-buttons (lambda (widget _)
+                          (pcase (widget-get widget :off)
+                            ("Show Value" (widget-apply-action widget)))
+                          nil)))
+  (advice-add 'custom-buffer-create
+              :after #'acdw/custom-toggle-showing-all-values))
 
 (setup debugger
   (:hook visual-line-mode)
-- 
cgit 1.4.1-21-gabe81