GNU bug report logs - #68915
Request to include a couple of packages in GNU ELPA

Previous Next

Package: elpa;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Sat, 3 Feb 2024 22:32:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Rahguzar <rahguzar <at> zohomail.eu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Philip Kaludercic <philipk <at> posteo.net>, Stefan Kangas <stefankangas <at> gmail.com>, 68915 <at> debbugs.gnu.org
Subject: bug#68915: Request to include a couple of packages in GNU ELPA
Date: Mon, 05 Feb 2024 22:40:33 +0100
Hi Stefan and Philip,

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> -       (string-match (rx-to-string
>>> -                      `(: bos (= ,(abs level) (: (1+ (not ".")) (?? ".")))))
>>> +       (string-match (rx bos (= ,(literal (abs level)) (: (1+ (not ".")) (?? "."))))
>>>                       module)
>>
>> I think this is not a valid rx form. Literal can only be a literal
>> string to match and in (= N rx) N can only be a literal positive integer.
>
> Indeed.  Maybe it would make sense to have a feature request to be able
> to write just:
>
>     (rx bos (= (abs level) (: (1+ (not ".")) (?? "."))))
>
> but currently I think you have to write that as
>
>     (rx bos (regexp (rx-to-string `(= ,(abs level) (: (1+ (not ".")) (?? "."))))))
>
> which is unsatisfactory.  You could make it marginally more efficient with:
>
>     (rx bos (regexp (rx-to-string `(= ,(abs level) (regexp ,(rx (: (1+ (not ".")) (?? "."))))))))
>
> but it's yet less satisfactory from a readability point of view.
>
>>> -       (string-match (rx-to-string
>>> -                      `(: (= ,(abs level) (: (1+ (not ".")) (?? "."))) eos))
>>> +       (string-match (rx (= (literal (abs level)) (: (1+ (not ".")) (?? "."))) eos)
>
> Same here.
>
>>> -  (let* ((restriction-rx (rx-to-string `(: ,(if (not arg)
>>> -                                                '(or "+" "-")
>>> -                                              (if (> arg 0) "+" "-"))
>>> -                                         (0+ (not space))
>>> -                                         (or (1+ space) eos)))))
>>> +  (let* ((restriction-rx (rx
>>> +			  (literal (if (not arg)
>>> +                                       '(or "+" "-")
>>> +                                     (if (> arg 0) "+" "-")))
>>> +			  (0+ (not space)))))
>>
>> Here too I think literal in rx can't handle arbitrary lisp expressions.
>
> Indeed, I suspect it should be
>
>     (let* ((restriction-rx (rx (: (regexp (if (not arg)
>                                               (rx (or "+" "-"))
>                                             (if (> arg 0) (rx "+") (rx "-")))
>                                   (0+ (not space))
>                                   (or (1+ space) eos)))))
>

For now I have left the regexps are they are except for the useless (or
(1+ space) eos) form that Philip caught. I think they are cleaner
without mixing rx and rx-to-string. They are used in interactive
commands for editing minibuffer strings so I think performance is not a
concern.

>> I think it is not too tightly integrated. If there is another easy
>> way to define an async completion table (i.e. candidates can arrive in
>> batches) adapting to it would be fairly easy.
>
> IIUC there's another such protocol for Company, but there isn't one
> that's "generic" :-(
>
>
>         Stefan

Thanks again,
Rahguzar




This bug report was last modified 1 year and 110 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.