diff options
| author | Jim Porter | 2023-09-05 18:27:21 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-10-10 13:00:38 -0700 |
| commit | 239db5d5162f6f9a4a6735e176c8d306f18e50e7 (patch) | |
| tree | 75bfe543f88fa6fe0bdcabbc96a927f8d3e35e24 /lisp/pcomplete.el | |
| parent | f7185ca29b5086b1b0f32e64b7a5ba0bc21152c8 (diff) | |
| download | emacs-239db5d5162f6f9a4a6735e176c8d306f18e50e7.tar.gz emacs-239db5d5162f6f9a4a6735e176c8d306f18e50e7.zip | |
Revert commits dafa6d6badd6 and 72c45fa9109a
These were there to work around deficiencies in how Eshell produces
completions for 'pcomplete-argument' (Eshell passed various non-string
objects to Pcomplete, which broke things). Now, Eshell always returns
a stringified form of the argument, with the original value stored via
the text property 'pcomplete-arg-value'.
* lisp/pcomplete.el (pcomplete-arg): Revert changes back to a simpler
form.
Diffstat (limited to 'lisp/pcomplete.el')
| -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. |