From: Shynur Xie <one.last.kiss@outlook.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "64351@debbugs.gnu.org" <64351@debbugs.gnu.org>
Subject: bug#64351: probabe bug associated with “completion-regexp-list”
Date: Fri, 30 Jun 2023 19:36:44 +0000 [thread overview]
Message-ID: <PH0PR11MB7470E96041D8DCC487BB7BFAD72AA@PH0PR11MB7470.namprd11.prod.outlook.com> (raw)
In-Reply-To: <jwvo7kwdbey.fsf-monnier+emacs@gnu.org>
> Stefan> I'd be interested to hear about your use-case, tho.
I tried to filter out internal variables “*--*” when typing “C-h v”
several days ago, so I wrote this:
(advice-add 'describe-variable :around ;“C-h v”
(lambda (advice-added-function &rest arguments)
(let ((completion-regexp-list
'("^\\([^-]*$\\|\\([^-]+\\(-[^-]+\\)-?\\)\\)$")))
(apply advice-added-function arguments))))
It didn’t work. I wanted to find out why, so to save time, I set its
value globally:
(setq completion-regexp-list
'("^\\([^-]*$\\|\\([^-]+\\(-[^-]+\\)-?\\)\\)$"))
Somehow, Emacs threw an error. I guess this is a bug, so I tried to
narrow it down and then reported it.
> Stefan> Maybe I can provide a good alternative.
I think it would be nice if Emacs can provides an option, say,
“completions-filter-function” (or “completions-help-filter-function”
only for functions “describe-*”), which receives 2 arguments -- TYPE
and COMPLETION. If I evaluate:
(setq completions-filter-function
(lambda (type completion)
(pcase type
('variable
(not (string-match-p "--" (symbol-name completion)))))))
I can filter out “*--*” variables. It’s also easier to add other
rules than the original “completion-regexp-list”. Using regexp to
filter is not very convenient, say if I want to filter out
“*-internal”, I have to write this regexp:
"\\([^l]\\|[^a]l\\|[^n]al\\|[^r]nal\\|[^e]rnal\\|[^t]ernal\\|[^n]ternal\\|[^i]nternal\\|[^-]internal\\)$"
I don’t know whether “completions-filter-function” is a good idea, I’m
just making a suggestion. Thanks.
next prev parent reply other threads:[~2023-06-30 19:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 18:53 bug#64351: probabe bug associated with “completion-regexp-list” Shynur Xie
2023-06-30 6:21 ` Eli Zaretskii
2023-06-30 12:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 13:15 ` Eli Zaretskii
2023-06-30 14:17 ` Shynur Xie
2023-06-30 14:27 ` Andreas Schwab
2023-06-30 15:23 ` Shynur Xie
2023-06-30 18:33 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 18:45 ` Shynur Xie
2023-06-30 19:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 19:36 ` Shynur Xie [this message]
2023-06-30 23:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30 19:52 ` Shynur Xie
2023-06-30 19:08 ` Eli Zaretskii
2023-07-01 14:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-02 6:18 ` Eli Zaretskii
2023-07-01 8:21 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR11MB7470E96041D8DCC487BB7BFAD72AA@PH0PR11MB7470.namprd11.prod.outlook.com \
--to=one.last.kiss@outlook.com \
--cc=64351@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).