|
From: | Gregory Heytings |
Subject: | bug#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation |
Date: | Mon, 19 Dec 2022 15:00:55 +0000 |
The more I think about it, the more my workaround sounds appealing.
What do you think of this (based on Augusto's suggestion)? It seems to me that it's a more elegant workaround, with which further improvements become possible, which isn't the case if we squeeze the value into a string.
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 4e3a88bbda8..2a2bbf114e0 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -645,13 +645,25 @@ 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)) +accessing absolute argument positions. + +When the INDEXth argument has been transformed into something +that is not a string by `pcomplete-parse-arguments-function', the +text representation of the argument is returned, and its value is +stored in its pcomplete-arg-value text property." + (let ((arg + (nth (+ (pcase index + ('first 0) + ('last pcomplete-last) + (_ (- pcomplete-index (or index 0)))) + (or offset 0)) + pcomplete-args))) + (if (stringp arg) + arg + (propertize + (buffer-substring (pcomplete-begin index offset) + (pcomplete-begin (1- (or index 0)) offset)) + 'pcomplete-arg-value arg)))) (defun pcomplete-begin (&optional index offset) "Return the beginning position of the INDEXth argument.
[Prev in Thread] | Current Thread | [Next in Thread] |