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


Message #26 received at 68915 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Rahguzar <rahguzar <at> zohomail.eu>
Cc: Philip Kaludercic <philipk <at> posteo.net>,
 Stefan Kangas <stefankangas <at> gmail.com>, 68915 <at> debbugs.gnu.org
Subject: Re: bug#68915: Request to include a couple of packages in GNU ELPA
Date: Sun, 04 Feb 2024 16:33:26 -0500
>> -       (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)))))

> 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





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

Previous Next


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