From 326f0d11a48daef8f9d935de9da22e1b165bfddf Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sat, 10 Dec 2022 20:52:28 -0800 Subject: [PATCH 1/3] 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. --- lisp/eshell/esh-var.el | 13 +++++++------ 1 file 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 @@ eshell-index-value (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 () -- 2.25.1