diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/pcomplete.el | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 0457f1b00c0..3dde001328d 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el | |||
| @@ -685,35 +685,13 @@ parts of the list. | |||
| 685 | 685 | ||
| 686 | The OFFSET argument is added to/taken away from the index that will be | 686 | The OFFSET argument is added to/taken away from the index that will be |
| 687 | used. This is really only useful with `first' and `last', for | 687 | used. This is really only useful with `first' and `last', for |
| 688 | accessing absolute argument positions. | 688 | accessing absolute argument positions." |
| 689 | 689 | (nth (+ (pcase index | |
| 690 | When the argument has been transformed into something that is not | 690 | ('first 0) |
| 691 | a string by `pcomplete-parse-arguments-function', the text | 691 | ('last pcomplete-last) |
| 692 | representation of the argument, namely what the user actually | 692 | (_ (- pcomplete-index (or index 0)))) |
| 693 | typed in, is returned, and the value of the argument is stored in | 693 | (or offset 0)) |
| 694 | the pcomplete-arg-value text property of that string." | 694 | pcomplete-args)) |
| 695 | (let ((arg | ||
| 696 | (nth (+ (pcase index | ||
| 697 | ('first 0) | ||
| 698 | ('last pcomplete-last) | ||
| 699 | (_ (- pcomplete-index (or index 0)))) | ||
| 700 | (or offset 0)) | ||
| 701 | pcomplete-args))) | ||
| 702 | (if (or (stringp arg) | ||
| 703 | ;; FIXME: 'last' is handled specially in Emacs 29, because | ||
| 704 | ;; 'pcomplete-parse-arguments' accepts a list of strings | ||
| 705 | ;; (which are completion candidates) as return value for | ||
| 706 | ;; (pcomplete-arg 'last). See below: "it means it's a | ||
| 707 | ;; list of completions computed during parsing, | ||
| 708 | ;; e.g. Eshell uses that to turn globs into lists of | ||
| 709 | ;; completions". This special case will be dealt with | ||
| 710 | ;; differently in Emacs 30: the pcomplete-arg-value | ||
| 711 | ;; property will be used by 'pcomplete-parse-arguments'. | ||
| 712 | (eq index 'last)) | ||
| 713 | arg | ||
| 714 | (propertize | ||
| 715 | (car (split-string (pcomplete-actual-arg index offset))) | ||
| 716 | 'pcomplete-arg-value arg)))) | ||
| 717 | 695 | ||
| 718 | (defun pcomplete-begin (&optional index offset) | 696 | (defun pcomplete-begin (&optional index offset) |
| 719 | "Return the beginning position of the INDEXth argument. | 697 | "Return the beginning position of the INDEXth argument. |