[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: |
Stefan Monnier |
Subject: |
bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last |
Date: |
Sun, 01 Jan 2023 13:38:28 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> (let ((arg
> (nth (+ (pcase index
> ('first 0)
> @@ -659,11 +660,11 @@ pcomplete-arg
> (_ (- 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)?
For the first, would the patch below help?
[ For the second, I suspect we can't provide 100% reliably correct
information anyway, so I think we'll need to find concrete usecases
where it matters before we can judge how much effort is warranted. ]
Stefan
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 2d3730e294a..815ad252fbd 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -1,6 +1,6 @@
;;; pcomplete.el --- programmable completion -*- lexical-binding: t -*-
-;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2023 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Keywords: processes abbrev
@@ -652,13 +652,12 @@ pcomplete-arg
representation of the argument, namely what the user actually
typed in, is returned, and the value of the argument is stored in
the pcomplete-arg-value text property of that string."
- (let ((arg
- (nth (+ (pcase index
+ (let* ((index (+ (pcase index
('first 0)
('last pcomplete-last)
(_ (- pcomplete-index (or index 0))))
- (or offset 0))
- pcomplete-args)))
+ (or offset 0)))
+ (arg (nth index pcomplete-args)))
(if (stringp arg)
arg
(propertize
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, (continued)
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Daniel Mendler, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Stefan Monnier, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Daniel Mendler, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Eli Zaretskii, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Eli Zaretskii, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Stefan Monnier, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last,
Stefan Monnier <=
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Stefan Monnier, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/01
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Jim Porter, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Stefan Monnier, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Daniel Mendler, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Gregory Heytings, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Daniel Mendler, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Eli Zaretskii, 2023/01/04
- bug#60464: 29.0.60; Regression - pcomplete-arg fails with argument 'last, Daniel Mendler, 2023/01/04