summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-10 18:47:20 -0500
committerCase Duckworth2021-08-10 18:47:20 -0500
commita6a027876d5b2a02aa695a164df3a251fd48349b (patch)
treec073966858827e492fb69bf9ca055db2bf4025f1
parentCustomize 'customize' (diff)
downloademacs-a6a027876d5b2a02aa695a164df3a251fd48349b.tar.gz
emacs-a6a027876d5b2a02aa695a164df3a251fd48349b.zip
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.
-rw-r--r--init.el28
1 files 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 @@
167 (:option custom-file (acdw/dir "custom.el") 167 (:option custom-file (acdw/dir "custom.el")
168 custom-magic-show nil 168 custom-magic-show nil
169 custom-magic-show-button t 169 custom-magic-show-button t
170 custom-raised-buttons nil
170 custom-unlispify-tag-names nil 171 custom-unlispify-tag-names nil
171 custom-variable-default-form 'edit) 172 custom-variable-default-form 'lisp)
172 173
173 (defun unpackaged/custom-toggle-all-more-hide () 174 (defun unpackaged/custom-toggle-all-more-hide (&rest _)
174 "Toggle all \"More/Hide\" widgets in current buffer." 175 "Toggle all \"More/Hide\" widgets in current buffer."
175 (interactive) 176 (interactive)
176 (widget-map-buttons (lambda (widget _) 177 (widget-map-buttons (lambda (widget _)
177 (pcase (widget-get widget :off) 178 (pcase (widget-get widget :off)
178 ("More" (widget-apply-action widget))) 179 ("More" (widget-apply-action widget)))
179 nil))) 180 nil)))
180 (add-hook 'Custom-mode-hook #'unpackaged/custom-toggle-all-more-hide) 181 (advice-add 'custom-buffer-create
182 :after #'unpackaged/custom-toggle-all-more-hide)
181 183
182 (defun unpackaged/custom-set-at-point () 184 (defun acdw/custom-toggle-showing-all-values (&rest _)
183 "Set current value of widget at point." 185 "Toggle all \"Show Value\" widgets in current buffer."
184 (interactive) 186 (interactive)
185 (cl-labels ((find-widget (widget property) 187 (widget-map-buttons (lambda (widget _)
186 (if (widget-get widget property) 188 (pcase (widget-get widget :off)
187 widget 189 ("Show Value" (widget-apply-action widget)))
188 (find-widget (widget-get widget :parent) property)))) 190 nil)))
189 (when-let* ((widget (find-widget (widget-at) :custom-set))) 191 (advice-add 'custom-buffer-create
190 (when (eq (widget-get widget :custom-state) 'modified) 192 :after #'acdw/custom-toggle-showing-all-values))
191 (widget-apply widget :custom-set)))))
192
193 (:with-map custom-field-keymap
194 (:bind "C-c C-c" unpackaged/custom-set-at-point)))
195 193
196(setup debugger 194(setup debugger
197 (:hook visual-line-mode) 195 (:hook visual-line-mode)