(defconst winny/child-widget-regex "^\\(Hide\\|Show Value\\)") (defun winny/forward-child-widget (&optional arg) "Navigate to next child widget by ARG. Use a Negative ARG to navigate backwards." (interactive "p") (when (and (looking-at winny/child-widget-regex) (> arg 0)) (setq arg (+ 1 arg))) (re-search-forward winny/child-widget-regex nil nil arg) ;; Ensure point is at the beginning of the line. (move-beginning-of-line nil)) (defun winny/backward-child-widget (&optional arg) "Navigate to previous child widget by ARG. Use a Negative ARG to navigate forwards." (interactive "p") (winny/forward-child-widget (- arg))) (define-key custom-mode-map (kbd "M-n") 'winny/forward-child-widget) (define-key custom-mode-map (kbd "M-p") 'winny/backward-child-widget) (define-key custom-mode-map (kbd "M-RET") 'Custom-newline)