Subject: Re: bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last

From: Gregory Heytings <[email-masked]>
Date: Wed, 04 Jan 2023 15:39:26 +0000

>
> Your implementation with the 'last condition doesn't make sense.
>

Can you please try to make it fail?

>
> It is not a good idea to treat 'last specially such that we return a
> different type in this case.
>

I'm not the one who wrote that code.  According to my analysis of the 
code, the only place where pcomplete-arg is called with a 'last' argument 
is pcomplete-parse-arguments, where you will see the following:

(defun pcomplete-parse-arguments (&optional expand-p)
   ...
   (let ((results (funcall pcomplete-parse-arguments-function)))
     (when results
       (setq ...
 	    pcomplete-stub (pcomplete-arg 'last))
       (let ...
 	(if (and (listp pcomplete-stub) ;??
 		 (not pcomplete-expand-only-p))
 	    ;; If `pcomplete-stub' is a list, it means it's a list of
             ;; completions computed during parsing, e.g. Eshell uses
             ;; that to turn globs into lists of completions.