Variable: eshell-parse-argument-hook
eshell-parse-argument-hook is a customizable variable defined in
esh-arg.el.gz.
Value
(eshell-parse-special-reference
#[0 "?\205? ?\205?\304\n!\205?\305\225\211\206`\211dU\206!\211f>\266\202\205?\305\225b\210\306\305!\211G\305V\203<\307\305G\310$\210\211\262\207"
[eshell-current-argument eshell-current-quoted eshell-number-regexp eshell-delimiter-argument-list looking-at 0 match-string add-text-properties
(number t)]
6]
#[0 "\204\f\305\306\307\310 \"\"\n\204\305\306\307\310\"\"\311\f\203!\202\"\n!\205<\312\225b\210\313\312!\211\2039\314\312G\315$\210\211\262\207"
[eshell-inside-quote-regexp eshell-special-chars-inside-quoting eshell-outside-quote-regexp eshell-special-chars-outside-quoting eshell-current-quoted format "[^%s]+" apply string looking-at 0 match-string set-text-properties nil]
6]
#[0 "\301\302\303!\204?\205+\302\304!\205+\305\211\262\205+\211\203%\306\307\224\307\225\310#\210\307\225b\210\311 \207"
[eshell-current-argument nil looking-at "[ ]+" "#\\([^<'].*\\|$\\)" t add-text-properties 0
(comment t)
eshell-finish-arg]
5]
eshell-parse-backslash
eshell-parse-literal-quote
eshell-parse-double-quote
eshell-parse-delimiter)
Documentation
Define how to process Eshell command line arguments.
When each function on this hook is called, point will be at the current position within the argument list. The function should either return nil, meaning that it did no argument parsing, or it should return the result of the parse as a sexp. It is also responsible for moving the point forward to reflect the amount of input text that was parsed.
If no function handles the current character at point, it will be treated as a literal character.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-arg.el.gz
(defcustom eshell-parse-argument-hook
(list
;; a term such as #<buffer NAME>, or #<process NAME> is a buffer
;; or process reference
'eshell-parse-special-reference
;; numbers convert to numbers if they stand alone
(lambda ()
(when (and (not eshell-current-argument)
(not eshell-current-quoted)
(looking-at eshell-number-regexp)
(eshell-arg-delimiter (match-end 0)))
(goto-char (match-end 0))
(let ((str (match-string 0)))
(if (> (length str) 0)
(add-text-properties 0 (length str) '(number t) str))
str)))
;; parse any non-special characters, based on the current context
(lambda ()
(unless eshell-inside-quote-regexp
(setq eshell-inside-quote-regexp
(format "[^%s]+"
(apply 'string eshell-special-chars-inside-quoting))))
(unless eshell-outside-quote-regexp
(setq eshell-outside-quote-regexp
(format "[^%s]+"
(apply 'string eshell-special-chars-outside-quoting))))
(when (looking-at (if eshell-current-quoted
eshell-inside-quote-regexp
eshell-outside-quote-regexp))
(goto-char (match-end 0))
(let ((str (match-string 0)))
(if str
(set-text-properties 0 (length str) nil str))
str)))
;; whitespace or a comment is an argument delimiter
(lambda ()
(let (comment-p)
(when (or (looking-at "[ \t]+")
(and (not eshell-current-argument)
(looking-at "#\\([^<'].*\\|$\\)")
(setq comment-p t)))
(if comment-p
(add-text-properties (match-beginning 0) (match-end 0)
'(comment t)))
(goto-char (match-end 0))
(eshell-finish-arg))))
;; parse backslash and the character after
'eshell-parse-backslash
;; text beginning with ' is a literally quoted
'eshell-parse-literal-quote
;; text beginning with " is interpolably quoted
'eshell-parse-double-quote
;; argument delimiter
'eshell-parse-delimiter)
"Define how to process Eshell command line arguments.
When each function on this hook is called, point will be at the
current position within the argument list. The function should either
return nil, meaning that it did no argument parsing, or it should
return the result of the parse as a sexp. It is also responsible for
moving the point forward to reflect the amount of input text that was
parsed.
If no function handles the current character at point, it will be
treated as a literal character."
:type 'hook
:group 'eshell-arg)