From b83771e534fbddf50fc05135ac299f95955fc1e3 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 20 Feb 2026 22:00:48 +0100 Subject: [PATCH] New command to skip over the head of Customize buffers * lisp/cus-edit.el (custom-mode-map): Bind it. (Custom-goto-first-choice): New command. (Bug#80218) --- lisp/cus-edit.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index d62976a8d37..173b7e00957 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -433,6 +433,7 @@ "C-c C-c" #'Custom-set "C-x C-s" #'Custom-save "C-c C-k" #'Custom-reset-standard + "C-c C-i" #'Custom-goto-first-choice "q" #'Custom-buffer-done "u" #'Custom-goto-parent "n" #'widget-forward @@ -861,6 +862,21 @@ setting was merely edited before, this sets it then saves it." (dolist (widget edited-widgets) (widget-apply widget :custom-state-set-and-redraw))))) +(defun Custom-goto-first-choice () + "Move point to the first choice button in a menu. +If no such button can be found, move to the first menu item." + (interactive) + (catch 'done + (dolist (ov (sort (overlays-in (point-min) (point-max)) + :key #'overlay-start)) + (let ((button (overlay-get ov 'button))) + (when (eq (plist-get (cdr button) :action) + 'custom-toggle-hide-variable) + (goto-char (overlay-start ov)) + (when (plist-get (cdr button) :value) + (widget-forward 1)) + (throw 'done t)))))) + (defun custom-reset (_widget &optional event) "Select item from reset menu." (let* ((completion-ignore-case t)