mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-02 08:22:22 +00:00
Improve/correct documentation about Eshell variable expansion
* lisp/eshell/esh-var.el: Correct documentation comment. (eshell-parse-variable-ref): Correct docstring. * doc/misc/eshell.texi (Dollars Expansion): Add documentation for $"var"/$'var' and $<command> syntaxes.
This commit is contained in:
parent
9e257aecc9
commit
2c3d1b6bf4
@ -583,6 +583,12 @@ of familiarity.
|
|||||||
Expands to the value bound to @code{var}. This is the main way to use
|
Expands to the value bound to @code{var}. This is the main way to use
|
||||||
variables in command invocations.
|
variables in command invocations.
|
||||||
|
|
||||||
|
@item $"var"
|
||||||
|
@item $'var'
|
||||||
|
Expands to the value bound to @code{var}. This is useful to
|
||||||
|
disambiguate the variable name when concatenating it with another
|
||||||
|
value, such as @samp{$"var"-suffix}.
|
||||||
|
|
||||||
@item $#var
|
@item $#var
|
||||||
Expands to the length of the value bound to @code{var}. Raises an error
|
Expands to the length of the value bound to @code{var}. Raises an error
|
||||||
if the value is not a sequence
|
if the value is not a sequence
|
||||||
@ -597,6 +603,11 @@ it can be used in a string, such as @samp{/some/path/$(lisp).txt}.
|
|||||||
Returns the output of @command{command}, which can be any valid Eshell
|
Returns the output of @command{command}, which can be any valid Eshell
|
||||||
command invocation, and may even contain expansions.
|
command invocation, and may even contain expansions.
|
||||||
|
|
||||||
|
@item $<command>
|
||||||
|
As with @samp{$@{command@}}, evaluates the Eshell command invocation
|
||||||
|
@command{command}, but writes the output to a temporary file and
|
||||||
|
returns the file name.
|
||||||
|
|
||||||
@item $var[i]
|
@item $var[i]
|
||||||
Expands to the @code{i}th element of the value bound to @code{var}. If
|
Expands to the @code{i}th element of the value bound to @code{var}. If
|
||||||
the value is a string, it will be split at whitespace to make it a list.
|
the value is a string, it will be split at whitespace to make it a list.
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
;;
|
;;
|
||||||
;; "-" is a valid part of a variable name.
|
;; "-" is a valid part of a variable name.
|
||||||
;;
|
;;
|
||||||
;; $<MYVAR>-TOO
|
;; $\"MYVAR\"-TOO
|
||||||
|
;; $'MYVAR'-TOO
|
||||||
;;
|
;;
|
||||||
;; Only "MYVAR" is part of the variable name in this case.
|
;; Only "MYVAR" is part of the variable name in this case.
|
||||||
;;
|
;;
|
||||||
@ -55,6 +56,11 @@
|
|||||||
;; Returns the value of an eshell subcommand. See the note above
|
;; Returns the value of an eshell subcommand. See the note above
|
||||||
;; regarding Lisp evaluations.
|
;; regarding Lisp evaluations.
|
||||||
;;
|
;;
|
||||||
|
;; $<command>
|
||||||
|
;;
|
||||||
|
;; Evaluates an eshell subcommand, redirecting the output to a
|
||||||
|
;; temporary file, and returning the file name.
|
||||||
|
;;
|
||||||
;; $ANYVAR[10]
|
;; $ANYVAR[10]
|
||||||
;;
|
;;
|
||||||
;; Return the 10th element of ANYVAR. If ANYVAR's value is a string,
|
;; Return the 10th element of ANYVAR. If ANYVAR's value is a string,
|
||||||
@ -426,9 +432,12 @@ variable.
|
|||||||
Possible options are:
|
Possible options are:
|
||||||
|
|
||||||
NAME an environment or Lisp variable value
|
NAME an environment or Lisp variable value
|
||||||
<LONG-NAME> disambiguates the length of the name
|
\"LONG-NAME\" disambiguates the length of the name
|
||||||
|
'LONG-NAME' as above
|
||||||
{COMMAND} result of command is variable's value
|
{COMMAND} result of command is variable's value
|
||||||
(LISP-FORM) result of Lisp form is variable's value"
|
(LISP-FORM) result of Lisp form is variable's value
|
||||||
|
<COMMAND> write the output of command to a temporary file;
|
||||||
|
result is the file name"
|
||||||
(cond
|
(cond
|
||||||
((eq (char-after) ?{)
|
((eq (char-after) ?{)
|
||||||
(let ((end (eshell-find-delimiter ?\{ ?\})))
|
(let ((end (eshell-find-delimiter ?\{ ?\})))
|
||||||
|
Loading…
Reference in New Issue
Block a user