elisp 如何访问一个groups下的所有变量, defgroup,defcustom

(defgroup sly-ui nil
  "Interaction with the Superior Lisp Environment."
  :prefix "sly-"
  :group 'sly)

(defcustom sly-truncate-lines t
  "Set `truncate-lines' in popup buffers.
This applies to buffers that present lines as rows of data, such as
debugger backtraces and apropos listings."
  :type 'boolean
  :group 'sly-ui)

(defcustom sly-kill-without-query-p nil
  "If non-nil, kill SLY processes without query when quitting Emacs.
This applies to the *inferior-lisp* buffer and the network connections."
  :type 'boolean
  :group 'sly-ui)

;;===========

(get 'sly-ui 'custom-group)
;; => ((sly-truncate-lines custom-variable) (sly-kill-without-query-p custom-variable))


看了下源碼研究出來的。

defcustom 用了 custom-declare-variable,后者用 custom-add-to-group 來加变量名到 Group,实貭是个 put,所以用 get 就能看 Group 下的 Custom 項。


Update 有現成的 function custom-group-members