diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-12-10 20:52:28 -0800 |
---|---|---|
committer | Jim Porter <jporterbugs@gmail.com> | 2022-12-15 21:41:03 -0800 |
commit | 66ac920b0c233e472c7f54d108503dfe9236d3c0 (patch) | |
tree | e50acd82d3b26294ceb011613810685d237135bb /lisp/eshell/esh-var.el | |
parent | c585ca89a64ab613e08576b5603949767ad8d079 (diff) | |
download | emacs-66ac920b0c233e472c7f54d108503dfe9236d3c0.tar.gz |
Support completion of variables with the length operator in Eshell
These are forms like '$#VARIABLE'.
* lisp/eshell/esh-var.el (eshell-complete-variable-reference): Support
the length operator.
Diffstat (limited to 'lisp/eshell/esh-var.el')
-rw-r--r-- | lisp/eshell/esh-var.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 57ea42f4933..5824da6dc0e 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -751,12 +751,13 @@ For example, to retrieve the second element of a user's record in (defun eshell-complete-variable-reference () "If there is a variable reference, complete it." - (let ((arg (pcomplete-actual-arg)) index) - (when (setq index - (string-match - (concat "\\$\\(" eshell-variable-name-regexp - "\\)?\\'") arg)) - (setq pcomplete-stub (substring arg (1+ index))) + (let ((arg (pcomplete-actual-arg))) + (when (string-match + (rx "$" (? "#") + (? (group (regexp eshell-variable-name-regexp))) + string-end) + arg) + (setq pcomplete-stub (substring arg (match-beginning 1))) (throw 'pcomplete-completions (eshell-variables-list))))) (defun eshell-variables-list () |