(defcustom apropos-value-exclude-list '(kill-ring values minibuffer-history buffer-name-history command-history ivy--all-candidates) "List of variable names to be excluded from `apropos-value' searches." :type '(repeat variable)) (defun my-apropos-value (pattern &optional do-all) "Allow `apropos-value' to limit scope of its searches. With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also looks at function definitions (arguments, documentation and body) and at the names and values of properties. With two \\[universal-argument] prefixes, excludes the variables listed in `apropos-value-exclude-list' from its search. With three \\[universal-argument] prefixes, performs a search only on the variables listed in `apropos-value-exclude-list'. See also variable `apropos-value-limited-print'." (interactive (list (apropos-read-pattern "value") current-prefix-arg)) (apropos-parse-pattern pattern) (or do-all (when apropos-do-all (setq do-all '(4)))) (setq apropos-accumulator ()) (let (f v p) (if (equal do-all '(64)) ; C-u C-u C-u (dolist (symbol apropos-value-exclude-list) (when (setq v (apropos-value-internal 'boundp symbol 'symbol-value)) (setq apropos-accumulator (cons (list symbol (apropos-score-str v) nil v nil) apropos-accumulator)))) (mapatoms (lambda (symbol) (setq f nil v nil p nil) (or (memq symbol '(apropos-regexp apropos-pattern apropos-all-words-regexp apropos-words apropos-all-words do-all apropos-accumulator apropos-value-exclude-list symbol f v p)) (and (equal do-all '(16)) ; C-u C-u (memq symbol apropos-value-exclude-list)) (setq v (apropos-value-internal 'boundp symbol 'symbol-value))) (when (equal do-all '(4)) ; C-u (setq f (apropos-value-internal 'fboundp symbol 'symbol-function) p (apropos-format-plist symbol "\n " t))) (if (apropos-false-hit-str v) (setq v nil)) (if (apropos-false-hit-str f) (setq f nil)) (if (apropos-false-hit-str p) (setq p nil)) (if (or f v p) (setq apropos-accumulator (cons (list symbol (+ (apropos-score-str f) (apropos-score-str v) (apropos-score-str p)) f v p) apropos-accumulator))))))) (let ((apropos-multi-type (if (equal do-all '(4)) t nil))) (apropos-print nil "\n----------------\n")))