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

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

bug#59956: 29.0.60: Failure when completing arguments in Eshell after va


From: Stefan Monnier
Subject: bug#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation
Date: Fri, 16 Dec 2022 09:13:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> Still, like Stefan and Augusto mentioned, there's probably a larger issue
> here: should Eshell be allowed to feed Pcomplete non-strings? Since
> Pcomplete was written for Eshell initially, there's some basis for why it
> *might* support non-string values, but actually requiring that is an awful
> lot to ask of every programmer who ever wants to write a pcomplete function.

A "general" solution might be the one below, tho it looks more like
a general workaround, I think.

John?


        Stefan


diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 4e3a88bbda8..6a4d754b8c0 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -646,12 +646,14 @@ pcomplete-arg
 The OFFSET argument is added to/taken away from the index that will be
 used.  This is really only useful with `first' and `last', for
 accessing absolute argument positions."
-  (nth (+ (pcase index
-          ('first 0)
-          ('last  pcomplete-last)
-          (_      (- pcomplete-index (or index 0))))
-         (or offset 0))
-       pcomplete-args))
+  (let ((arg (nth (+ (pcase index
+                      ('first 0)
+                      ('last  pcomplete-last)
+                      (_      (- pcomplete-index (or index 0))))
+                    (or offset 0))
+                 pcomplete-args)))
+    (when arg
+      (if (stringp arg) arg (format "%S" arg)))))
 
 (defun pcomplete-begin (&optional index offset)
   "Return the beginning position of the INDEXth argument.






reply via email to

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