comint-insert-previous-argument counts args from start or from end
This function is invoked in shell-mode by the user, and is meant to emulate what M-. does in zsh and bash: it inserts an argument from a previous command. Without a prefix argument, it inserts the last arg from the previous command; with an argument INDEX, it inserts the INDEX-th argument. bash counts from the start, while zsh counts from the end. This patch adds a variable `comint-insert-previous-argument-from-end' that emulates the zsh behavior if non-nil. * lisp/comint.el (comint-arguments): can take in negative arguments to count from the end, same as indexing in python. (comint-insert-previous-argument): if comint-insert-previous-argument-from-end is non-nil, INDEX counts arguments from the end; if nil, from the beginning (Bug#25271) * etc/NEWS: Document this.
Showing with 41 additions and 13 deletions