For example, I would like to k开发者_如何学编程now the values of all variables with prefix "comint-*"
If you just want to get customizable variables, then you can use M-x customize-apropos.
Otherwise, try something like this:
(with-output-to-temp-buffer "*Variables*"
(set-buffer standard-output)
(insert (mapconcat (lambda (sym) (format "%s: %s" sym (eval sym)))
(apropos-internal "^comint-.*" 'boundp) "\n\n")))
That'll produce a *Variables*
buffer with contents like:
comint-accum-marker: nil
comint-buffer-maximum-size: 1024
comint-completion-addsuffix: t
...
Not "perfect" but you could do C-h v prefix
and then hit tab to get all the variables that start with that `prefix.
If you want to try it out manually, the function you need to dig into is completion--do-completion
.
Here's how I'd do it:
(require 'cl)
(loop for sym being the symbols
when (and (boundp sym) (string-match "^comint-" (symbol-name sym)))
collect (cons sym (symbol-value sym)))
On my system, this evaluates to:
((comint-output-filter-functions comint-watch-for-password-prompt)
(comint-mode-abbrev-table . [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0])
(comint-exec-hook (lambda nil (set-process-query-on-exit-flag ... nil)))
(comint-file-name-prefix . ""))
精彩评论