emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 66ac920b0c 1/3: Support completion of variables with the length o


From: Jim Porter
Subject: master 66ac920b0c 1/3: Support completion of variables with the length operator in Eshell
Date: Fri, 16 Dec 2022 01:09:37 -0500 (EST)

branch: master
commit 66ac920b0c233e472c7f54d108503dfe9236d3c0
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    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 57ea42f493..5824da6dc0 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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]