bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Gregory Heytings
Subject: 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*.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]