diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-07 12:54:29 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-07 12:54:29 -0400 |
commit | 42fd433acabc97cec035748be0508234bda39750 (patch) | |
tree | b86ba7440960d0d70ac9fde00a9e146adc4d220a /lisp/pcomplete.el | |
parent | 3bf53ad05c60794bc4586d2c7afd8bfa11ba99c7 (diff) | |
download | emacs-42fd433acabc97cec035748be0508234bda39750.tar.gz emacs-42fd433acabc97cec035748be0508234bda39750.tar.bz2 emacs-42fd433acabc97cec035748be0508234bda39750.zip |
* lisp/pcomplete.el (pcomplete-arg): Simplify
Diffstat (limited to 'lisp/pcomplete.el')
-rw-r--r-- | lisp/pcomplete.el | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 6fe29d9dcfb..8cb0aa3b7ad 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -646,15 +646,12 @@ parts of the list. 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." - (setq index - (if (eq index 'first) - 0 - (if (eq index 'last) - pcomplete-last - (- pcomplete-index (or index 0))))) - (if offset - (setq index (+ index offset))) - (nth index pcomplete-args)) + (nth (+ (pcase index + ('first 0) + ('last pcomplete-last) + (_ (- pcomplete-index (or index 0)))) + (or offset 0)) + pcomplete-args)) (defun pcomplete-begin (&optional index offset) "Return the beginning position of the INDEXth argument. |