1 What Regexp to Use
I don't know how to hide `*-internal'.
To Filter Out prefix--*
:
\`-?\([^-]+\(-[^-]+\)*-?\)?\'
To Filter Out *-internal
:
\(\(\`\|[^l]\)\|\(\`\|[^a]\)l\|\(\`\|[^n]\)al\|\(\`\|[^r]\)nal\|\(\`\|[^e]\)rnal\|\(\`\|[^t]\)ernal\|\(\`\|[^n]\)ternal\|\(\`\|[^i]\)nternal\|\(\`\|[^-]\)internal\)\'
2 How to Avoid that Error
But Emacs signals an error Wrong type argument: stringp, nil
I've reported this as bug#64351. In short, don't set it globally.
3 The Answer to the Question
Hide Variables for Internal Use in *Completions*
when C-h v
shynur> I launched Emacs with “-Q” and evaluate:
shynur>
shynur> (advice-add 'describe-variable :around ;“C-h v”
shynur> (lambda (advice-added-function &rest arguments)
shynur> (let ((completion-regexp-list
shynur> '("^\\([^-]*$\\|\\([^-]+\\(-[^-]+\\)-?\\)\\)$")))
shynur> (apply advice-added-function arguments))))
shynur>
shynur> to filter out symbols “*--*”.
shynur>
shynur> Then type “C-h v advice TAB”, I can still see some variables
shynur> whose names are “*--*” (e.g., “advice--bytecodes”).
Andreas> Interactive completion runs before the function is called,
Andreas> inside call-interactively. You need to advice the
Andreas> interactive spec.
shynur> Thanks! This is a tricky issue to me, because I only want to
shynur> filter when calling “describe-variable”. I guess I have to
shynur> give up this idea...
So
(let ((shynur--completion-regexp-list '("\\`-?\\([^-]+\\(-[^-]+\\)*-?\\)?\\'"
"\\(\\(\\`\\|[^l]\\)\\|\\(\\`\\|[^a]\\)l\\|\\(\\`\\|[^n]\\)al\\|\\(\\`\\|[^r]\\)nal\\|\\(\\`\\|[^e]\\)rnal\\|\\(\\`\\|[^t]\\)ernal\\|\\(\\`\\|[^n]\\)ternal\\|\\(\\`\\|[^i]\\)nternal\\|\\(\\`\\|[^-]\\)internal\\)\\'"))
(functions-for-completion [try-completion
test-completion
all-completions]))
(seq-doseq (key ["C-h f"
"C-h v"])
(let ((key-original-function (keymap-global-lookup key)))
(global-set-key (kbd key) (lambda ()
(interactive)
(unwind-protect
(progn
(let ((completion-regexp-list+shynur--completion-regexp-list `(,@completion-regexp-list
,@shynur--completion-regexp-list)))
(seq-doseq (funtion-for-completion functions-for-completion)
(advice-add funtion-for-completion :around
(lambda (advised-function &rest arguments)
(let ((completion-regexp-list completion-regexp-list+shynur--completion-regexp-list))
(apply advised-function
arguments))) '((name . "shynur--let-bind-completion-regexp-list")))))
(call-interactively key-original-function))
(seq-doseq (funtion-for-completion functions-for-completion)
(advice-remove funtion-for-completion "shynur--let-bind-completion-regexp-list"))))))))
C-h v
, but also several other such help-commands for common users, all provide these variables… – shynur Mar 15 '23 at 10:00