GNU bug report logs - #60464
29.0.60; Regression - pcomplete-arg fails with argument 'last

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sun, 1 Jan 2023 10:48:02 UTC

Severity: normal

Found in version 29.0.60

Full log


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

From: Gregory Heytings <gregory <at> heytings.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Daniel Mendler <mail <at> daniel-mendler.de>, Eli Zaretskii <eliz <at> gnu.org>,
 60464 <at> debbugs.gnu.org, Jim Porter <jporterbugs <at> gmail.com>
Subject: Re: bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument
 'last
Date: Sun, 01 Jan 2023 19:13:18 +0000
>>                    (_      (- pcomplete-index (or index 0))))
>>                  (or offset 0))
>>                pcomplete-args)))
>> -    (if (stringp arg)
>> +    (if (or (stringp arg)
>> +            (eq index 'last))
>>          arg
>>        (propertize
>> -       (buffer-substring (pcomplete-begin index offset)
>> -                         (pcomplete-begin (1- (or index 0)) offset))
>> +       (car (split-string (pcomplete-actual-arg index offset)))
>>         'pcomplete-arg-value arg))))
>
> I'm not sure what specific problem this is trying to solve (is it the 
> choice of the "index" or is it the precise buffer positions of the 
> bounds)?
>

I admit I don't understand your question.  It tries to use 
pcomplete-actual-arg, which uses buffer-substring, to get the text 
representation of the argument.  It's not guaranteed to work in all cases, 
though, because it simply assumes that arguments are separated by spaces. 
But it should be "good enough".

The (eq index 'last) means that when index is 'last we return the 
argument, even when it is not a string (or more precisely: when it is a 
list of strings, and the code assumes that a non-string arg is a list of 
string), because that's in fact what the caller expects (or at least 
that's what Eshell expects) in that case: that list is displayed in 
*Completions*.





This bug report was last modified 2 years and 152 days ago.

Previous Next


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