<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/test/lisp/eshell/em-cmpl-tests.el, branch scratch/handler-bind</title>
<subtitle>Emacs is the extensible, customizable, self-documenting real-time display editor. 
</subtitle>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/'/>
<entry>
<title>Add a new Eshell special reference type for markers</title>
<updated>2023-10-24T19:28:00+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-10-10T03:25:28+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=64aa01f60ad17af2bd438895a19343f3c369bc43'/>
<id>64aa01f60ad17af2bd438895a19343f3c369bc43</id>
<content type='text'>
* lisp/eshell/esh-arg.el (eshell-get-marker, eshell-insert-marker)
(eshell-complete-marker-ref): New functions...
(eshell-special-ref-alist): ... Add them to the new "marker" entry.

* test/lisp/eshell/esh-arg-tests.el
(esh-arg-test/special-reference/marker)
(esh-arg-test/special-reference/nested)
(esh-arg-test/special-reference/lisp-form):
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/special-ref-completion/type)
(em-cmpl-test/special-ref-completion/marker): New tests.

* doc/misc/eshell.texi (Arguments): Document the new special ref type.

* etc/NEWS: Announce this change (bug#66458).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/eshell/esh-arg.el (eshell-get-marker, eshell-insert-marker)
(eshell-complete-marker-ref): New functions...
(eshell-special-ref-alist): ... Add them to the new "marker" entry.

* test/lisp/eshell/esh-arg-tests.el
(esh-arg-test/special-reference/marker)
(esh-arg-test/special-reference/nested)
(esh-arg-test/special-reference/lisp-form):
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/special-ref-completion/type)
(em-cmpl-test/special-ref-completion/marker): New tests.

* doc/misc/eshell.texi (Arguments): Document the new special ref type.

* etc/NEWS: Announce this change (bug#66458).
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid parsing some Eshell forms when performing completion</title>
<updated>2023-03-28T19:03:29+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-03-21T00:25:54+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=cde38f0df3fa3540ce411a48d95da1c2f1be1b60'/>
<id>cde38f0df3fa3540ce411a48d95da1c2f1be1b60</id>
<content type='text'>
During completion, we want to evaluate most Eshell forms
(e.g. variable references), but skip others (e.g. globbing,
subcommands).  For globbing, we want to pass the literal glob to
Pcomplete so it can use the glob for selecting completion candidates.
For subcommands (including Lisp forms), we especially want to avoid
evaluation, since they can produce arbitary side effects!  (Bug#50470)

* lisp/eshell/esh-cmd.el (eshell-allow-commands): New variable...
(eshell-commands-forbidden): New error...
(eshell-named-command, eshell-lisp-command): ... use them.

* lisp/eshell/em-cmpl.el (eshell-complete--eval-argument-form):
Disallow command forms and handle errors ourselves.
(eshell-complete-parse-arguments): Don't parse glob characters.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/unevaluated-subcommand)
(em-cmpl-test/parse-arguments/unevaluated-lisp-form)
(em-cmpl-test/parse-arguments/unevaluated-inner-subcommand)
(em-cmpl-test/file-completion/glob, em-cmpl-test/command-completion)
(em-cmpl-test/subcommand-completion): New tests.
(em-cmpl-test/parse-arguments/pipeline): Remove superfluous
let-binding.
(em-cmpl-test/file-completion/after-list): Use a list variable rather
than a subexpression; the latter is no longer evaluated during
completion.
(em-cmpl-test/lisp-function-completion): Check "$(func)" syntax.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During completion, we want to evaluate most Eshell forms
(e.g. variable references), but skip others (e.g. globbing,
subcommands).  For globbing, we want to pass the literal glob to
Pcomplete so it can use the glob for selecting completion candidates.
For subcommands (including Lisp forms), we especially want to avoid
evaluation, since they can produce arbitary side effects!  (Bug#50470)

* lisp/eshell/esh-cmd.el (eshell-allow-commands): New variable...
(eshell-commands-forbidden): New error...
(eshell-named-command, eshell-lisp-command): ... use them.

* lisp/eshell/em-cmpl.el (eshell-complete--eval-argument-form):
Disallow command forms and handle errors ourselves.
(eshell-complete-parse-arguments): Don't parse glob characters.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/unevaluated-subcommand)
(em-cmpl-test/parse-arguments/unevaluated-lisp-form)
(em-cmpl-test/parse-arguments/unevaluated-inner-subcommand)
(em-cmpl-test/file-completion/glob, em-cmpl-test/command-completion)
(em-cmpl-test/subcommand-completion): New tests.
(em-cmpl-test/parse-arguments/pipeline): Remove superfluous
let-binding.
(em-cmpl-test/file-completion/after-list): Use a list variable rather
than a subexpression; the latter is no longer evaluated during
completion.
(em-cmpl-test/lisp-function-completion): Check "$(func)" syntax.
</pre>
</div>
</content>
</entry>
<entry>
<title>; Fix typo in docstring</title>
<updated>2023-03-12T07:51:20+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-03-12T07:51:20+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=31f18480ca7291070837a305c64685c3e76afde3'/>
<id>31f18480ca7291070837a305c64685c3e76afde3</id>
<content type='text'>
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): Fix typo.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): Fix typo.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for completing special references (e.g. buffers) in Eshell</title>
<updated>2023-03-12T02:49:28+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-01-25T05:22:06+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=9199fa00caa69dd834cceac998e20fcc55cac9d3'/>
<id>9199fa00caa69dd834cceac998e20fcc55cac9d3</id>
<content type='text'>
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle
special references.

* lisp/eshell/em-arg.el (eshell-parse-special-reference): Ensure point
is just after the "#&lt;" when incomplete, and handle backslash escapes
more thoroughly.
(eshell-complete-special-reference): New function.

* test/lisp/eshell/esh-arg-tests.el
(esh-arg-test/special-reference/default)
(esh-arg-test/special-reference/buffer)
(esh-arg-test/special-reference/special):
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/special-ref-completion/type)
(em-cmpl-test/special-ref-completion/implicit-buffer)
(em-cmpl-test/special-ref-completion/buffer): New tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle
special references.

* lisp/eshell/em-arg.el (eshell-parse-special-reference): Ensure point
is just after the "#&lt;" when incomplete, and handle backslash escapes
more thoroughly.
(eshell-complete-special-reference): New function.

* test/lisp/eshell/esh-arg-tests.el
(esh-arg-test/special-reference/default)
(esh-arg-test/special-reference/buffer)
(esh-arg-test/special-reference/special):
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/special-ref-completion/type)
(em-cmpl-test/special-ref-completion/implicit-buffer)
(em-cmpl-test/special-ref-completion/buffer): New tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>Be more cautious in completing Eshell variable assignments</title>
<updated>2023-02-26T04:38:55+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-02-25T05:49:54+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=9565e34762af6e0db51e9ae01683eb5d4c97ff3d'/>
<id>9565e34762af6e0db51e9ae01683eb5d4c97ff3d</id>
<content type='text'>
Previously, Eshell treated cases like the second argument in "tar
--directory=dir" as a variable assignment, but that prevented
'pcomplete/tar' from implementing its own completion for that
argument (bug#61778).

* lisp/eshell/esh-var.el (eshell-complete-variable-assignment): Only
handle completion when all initial arguments are variable assignments.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, Eshell treated cases like the second argument in "tar
--directory=dir" as a variable assignment, but that prevented
'pcomplete/tar' from implementing its own completion for that
argument (bug#61778).

* lisp/eshell/esh-var.el (eshell-complete-variable-assignment): Only
handle completion when all initial arguments are variable assignments.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't add a space after the trailing slash when completing ~USER in Eshell</title>
<updated>2023-02-23T22:09:36+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-02-02T01:48:47+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=9d48c9844bf6b27fede6fe8f864e6dfb6909586b'/>
<id>9d48c9844bf6b27fede6fe8f864e6dfb6909586b</id>
<content type='text'>
This provides a programmed completion function that works similarly to
~USER completion in 'completion-file-name-table'.

* lisp/eshell/em-dirs.el (eshell-complete-user-reference): Throw a
programmed completion function.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/user-ref-completion): Update test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This provides a programmed completion function that works similarly to
~USER completion in 'completion-file-name-table'.

* lisp/eshell/em-dirs.el (eshell-complete-user-reference): Throw a
programmed completion function.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/user-ref-completion): Update test.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for completing quoted variables in Eshell like $'FOO'</title>
<updated>2023-02-23T22:09:36+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-02-02T01:48:43+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=4b364a990a06cd73b553fdc9e9a65bc7398dbea6'/>
<id>4b364a990a06cd73b553fdc9e9a65bc7398dbea6</id>
<content type='text'>
This also adds the ability for Pcomplete handlers to set their own
exit functions that will get called as appropriate.

* lisp/pcomplete.el (pcomplete-default-exit-function): New function.
(pcomplete-exit-function): New variable...
(pcomplete-completions-at-point): ... let-bind and use it.

* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle
quoted variables.  We also build the 'posns' list from right-to-left
now.

* lisp/eshell/esh-var.el (eshell-envvar-names): Ensure that variable
aliases are included in this list.
(eshell-complete-variable-reference): Handle quoted variables and set
the exit function on the completions.
(eshell-variables-list): Simplify.  We now add the trailing slash for
directories in the exit function inside
'eshell-complete-variable-reference'.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/quoted-variable-ref-completion)
(em-cmpl-test/variable-ref-completion/directory): New tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also adds the ability for Pcomplete handlers to set their own
exit functions that will get called as appropriate.

* lisp/pcomplete.el (pcomplete-default-exit-function): New function.
(pcomplete-exit-function): New variable...
(pcomplete-completions-at-point): ... let-bind and use it.

* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Handle
quoted variables.  We also build the 'posns' list from right-to-left
now.

* lisp/eshell/esh-var.el (eshell-envvar-names): Ensure that variable
aliases are included in this list.
(eshell-complete-variable-reference): Handle quoted variables and set
the exit function on the completions.
(eshell-variables-list): Simplify.  We now add the trailing slash for
directories in the exit function inside
'eshell-complete-variable-reference'.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/quoted-variable-ref-completion)
(em-cmpl-test/variable-ref-completion/directory): New tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>During completion, convert all Eshell arguments to strings</title>
<updated>2023-01-31T01:49:11+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-01-22T21:20:46+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=e7d0aa248e684a6de0d655d93bfcfee06cc8ff09'/>
<id>e7d0aa248e684a6de0d655d93bfcfee06cc8ff09</id>
<content type='text'>
Eshell was already converting some types (numbers, nil) to strings, as
well as fixing up multiple-dot forms like ".../", so this way is more
consistent and should produce fewer problems for Pcomplete functions.

* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always
convert parsed arguments to strings.

* test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal,
eshell-arguments-equal--equal-explainer): New functions.
(em-cmpl-test/parse-arguments/pipeline)
(em-cmpl-test/parse-arguments/multiple-dots)
(em-cmpl-test/parse-arguments/variable/numeric)
(em-cmpl-test/parse-arguments/variable/nil)
(em-cmpl-test/parse-arguments/variable/list)
(em-cmpl-test/parse-arguments/variable/splice): Use
'eshell-arguments-equal'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Eshell was already converting some types (numbers, nil) to strings, as
well as fixing up multiple-dot forms like ".../", so this way is more
consistent and should produce fewer problems for Pcomplete functions.

* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always
convert parsed arguments to strings.

* test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal,
eshell-arguments-equal--equal-explainer): New functions.
(em-cmpl-test/parse-arguments/pipeline)
(em-cmpl-test/parse-arguments/multiple-dots)
(em-cmpl-test/parse-arguments/variable/numeric)
(em-cmpl-test/parse-arguments/variable/nil)
(em-cmpl-test/parse-arguments/variable/list)
(em-cmpl-test/parse-arguments/variable/splice): Use
'eshell-arguments-equal'.
</pre>
</div>
</content>
</entry>
<entry>
<title>Properly parse Eshell variable splices for interactive completion</title>
<updated>2023-01-31T01:49:11+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-01-16T00:44:23+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=cc5a2ed457eb34543bb7aaf6b39663af2599805d'/>
<id>cc5a2ed457eb34543bb7aaf6b39663af2599805d</id>
<content type='text'>
Previously, the code simply ignored the splice operator, which usually
worked, but isn't actually correct.

* lisp/eshell/em-cmpl.el (eshell-complete-eval-argument-form): New
function.
(eshell-complete-parse-arguments): Properly parse variable splices.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/variable/splice): New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the code simply ignored the splice operator, which usually
worked, but isn't actually correct.

* lisp/eshell/em-cmpl.el (eshell-complete-eval-argument-form): New
function.
(eshell-complete-parse-arguments): Properly parse variable splices.

* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/parse-arguments/variable/splice): New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add regression tests for Eshell completions</title>
<updated>2023-01-31T01:49:11+00:00</updated>
<author>
<name>Jim Porter</name>
</author>
<published>2023-01-16T00:44:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=79154f625cc4f1db3cd2b9df1a3d88def27e0d56'/>
<id>79154f625cc4f1db3cd2b9df1a3d88def27e0d56</id>
<content type='text'>
* lisp/eshell/esh-cmd.el (eshell-complete-lisp-symbols): Fix
docstring.

* test/lisp/eshell/em-cmpl-tests.el: New file.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/eshell/esh-cmd.el (eshell-complete-lisp-symbols): Fix
docstring.

* test/lisp/eshell/em-cmpl-tests.el: New file.
</pre>
</div>
</content>
</entry>
</feed>
