Quantcast
Channel: Active questions tagged help - Emacs Stack Exchange
Viewing all articles
Browse latest Browse all 40

Format isearch-filter-predicate as describe-variable does

$
0
0

If I modify the isearch-filter-predicate variable with add-function and I do:

(message "%s" isearch-filter-predicate)

I get:

"#[128 \304\300"\205\0\304\301"\207 [skip-comments isearch-filter-visible :before-while nil apply] 4 advice]"

But if I do M-x descrive-function RET isearch-filter-predicate RET I get the variable in this format:

Its value is#f(advice skip-comments :before-while isearch-filter-visible)

I searched for a function to format the printed value of the variables in the help-fns.el file, where describe-variable is defined and, of course, I made a search on the web but I didn't find such a function.

Is there a way to achieve this kind of format using an existing function?

Edit. I'm building a function that allows me to temporarily modify isearch-filter-predicate. To do this, I'm doing something like this:

(defvar-local typ-isearch-filter-predicates-list '()"List of predicates usable through the `with-temp-isearch-filter-predicate' function.")(add-to-list 'typ-isearch-filter-predicates-list 'skip-comments)(defun with-temp-isearch-filter-predicate ()"Temporarily assigns a series of predicates to the variable`isearch-filter-predicate' to make only portions of the bufferthat match specific criteria visible/invisible to search andreplace functions."  (interactive)  (let* ((isearch-filter-predicate isearch-filter-predicate)         (IFP-DEFAULT isearch-filter-predicate)         (DEFAULT "skip-comments")         ;; See: https://emacs.stackexchange.com/q/80307/15606         (set-message-function nil)         (PREDICATES (completing-read-multiple"Specify, separating by commas, which predicates you want to activate: "                      typ-isearch-filter-predicates-list                      nil                      t                      nil                      nil                      DEFAULT))         (enable-recursive-minibuffers t))    (dolist (predicate PREDICATES)      (add-function :before-while isearch-filter-predicate (intern-soft predicate)))    (read-string     (format"The value assigned to the variable `isearch-filter-predicate' is currently `%s'.Press ENTER to restore the default value [%s] at the end of the operations:"      isearch-filter-predicate      IFP-DEFAULT))))

Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>