GNU bug report logs -
#60464
29.0.60; Regression - pcomplete-arg fails with argument 'last
Previous Next
Full log
View this message in rfc822 format
> For the first, would the patch below help?
Well, obviously not because I didn't bother to look at the rest of
the code.
Maybe this one would be closer, tho it probably needs some handling for
the boundary case where `index` is the last.
Stefan
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 2d3730e294a..36968d3b73c 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 <at> gnu.org>
;; Keywords: processes abbrev
@@ -652,18 +652,17 @@ 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
- (buffer-substring (pcomplete-begin index offset)
- (pcomplete-begin (1- (or index 0)) offset))
+ (buffer-substring (nth index pcomplete-begins)
+ (nth (1+ index) pcomplete-begins))
'pcomplete-arg-value arg))))
(defun pcomplete-begin (&optional index offset)
This bug report was last modified 2 years and 152 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.