Function: eshell-get-delimited-modifier-argument
eshell-get-delimited-modifier-argument is a byte-compiled function
defined in em-pred.el.gz.
Signature
(eshell-get-delimited-modifier-argument &optional CHAINED-P)
Documentation
Starting at point, get the delimited modifier argument, if any.
If the character after point is a predicate/modifier
delimiter (see eshell-pred-delimiter-pairs, read the value of
the argument and update point to be just after the closing
delimiter.
If CHAINED-P is true, then another delimited modifier argument
will immediately follow this one. In this case, when the opening
and closing delimiters are the same, update point to be just
before the closing delimiter. This allows modifiers like
:s/match/repl to work as expected.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-pred.el.gz
(defun eshell-get-delimited-modifier-argument (&optional chained-p)
"Starting at point, get the delimited modifier argument, if any.
If the character after point is a predicate/modifier
delimiter (see `eshell-pred-delimiter-pairs', read the value of
the argument and update point to be just after the closing
delimiter.
If CHAINED-P is true, then another delimited modifier argument
will immediately follow this one. In this case, when the opening
and closing delimiters are the same, update point to be just
before the closing delimiter. This allows modifiers like
`:s/match/repl' to work as expected."
(when-let* ((open (char-after))
(close (cdr (assoc open eshell-pred-delimiter-pairs)))
(end (eshell-find-delimiter open close nil nil t)))
(prog1
(replace-regexp-in-string
(rx-to-string `(seq "\\" (group (or "\\" ,open ,close)))) "\\1"
(buffer-substring-no-properties (1+ (point)) end))
(goto-char (if (and chained-p (eq open close))
end
(1+ end))))))