Commit Graph

5730 Commits

Author SHA1 Message Date
Qi Xiao
603421d8cc Update ttyshots with a comment on how to regenerate.
Also explain in ttyshot/README.md that the output of commands has to be manually appended.
2021-12-28 13:24:33 +00:00
Qi Xiao
71d885c4fa website/Makefile: add @ttyshot dependencies.
Also rename the ref-deps script to extra-deps now that its scope is a bit larger.
2021-12-28 13:13:43 +00:00
Qi Xiao
1ec9c95142 Fix the doc for ttyshots.
- Wrap the command in "print" to get byte output.

- Use global-binding to ensure that the key works in all modes.
2021-12-28 13:01:21 +00:00
Qi Xiao
1d36d299b8 Put flags for prettier in .prettierrc.
Also reformat tools/checkstyle-md.sh.
2021-12-28 12:54:30 +00:00
Qi Xiao
327d3e716b language.md: Revise the doc for escape sequences.
- Arrange all sequences into 3 groups.

- For escape sequences that contain variable characters, only put the leading
  marker in `code font`.
2021-12-28 12:43:36 +00:00
Qi Xiao
7da4b58f2f Revise doc for the builtin module.
- Revise the introduction section.

- Link to the notes on commands taking value inputs from all such commands.

- Revise the doc on the "all" command.

- Revise references to the builtin module from the language reference.
2021-12-28 12:01:35 +00:00
Qi Xiao
44e300095b website/learn/tour.md: Fix "\n". 2021-12-28 11:12:46 +00:00
Qi Xiao
a5ae894a5c website/ref/language.md: Fix the comment on "echo \*". 2021-12-28 11:12:26 +00:00
Qi Xiao
560bd17c17 pkg/eval: Break up builtin_fn_container.go.
- range -> builtin_fn_num.go

- all, one, take, drop, count, order -> new builtin_fn_stream.go

- repeat -> builtin_fn_io.go

- compare -> builtin_fn_pred.go
2021-12-26 12:22:14 +00:00
Christopher Loessl
bd76b46b8e
Doc update (#1457)
* docs(effective-elvish): follow same style as other docs

e.g., https://elv.sh/ref/language.html

* docs(builtin): ref from take to drop

* docs(language): remove mention of :up and :down ns

* docs(fundamentals): update to new lambda format

* docs(tour): update to new lambda syntax

* docs(builtin): update to new lambda syntax

* docs(language): update to new lambda syntax

* docs(unique-semantics): update to new lambda syntax

* docs(tour): fix typo

* Revert "docs(effective-elvish): follow same style as other docs"

This reverts commit db4306a400c61f5f7b6acec7a1e1f39feb9b1ba0.

https://github.com/elves/elvish/pull/1457#discussion_r775102178
2021-12-26 12:02:00 +00:00
Qi Xiao
8ecac48251 More tweaks to the tour.
- Wording tweaks

- Retake all ttyshots
2021-12-24 01:56:41 +00:00
Qi Xiao
b1460e4269 Wording tweak for the doc of edit:add-var. 2021-12-24 01:40:26 +00:00
Kurtis Rader
9cf2cfffa6 Cleanups to rc.elv references 2021-12-24 01:40:01 +00:00
Christopher Loessl
95a0deae6f docs(effective-elvish): update to new lambda 2021-12-23 20:30:34 +00:00
Qi Xiao
3bdd7b49e8 Fixup for #1452 2021-12-20 13:31:53 +00:00
Kurtis Rader
91f21858ac More improvements to edit:add-var documentation
The existing `edit:add-var` documentation incorrectly implies the `$init`
value is optional. It also doesn't include any examples that are useful
in practice. This addresses both shortcomings.
2021-12-20 13:13:56 +00:00
Qi Xiao
db0cf05893 Expand the doc of edit:add-var. 2021-12-18 11:58:12 +00:00
Qi Xiao
c71f46642b Update eawk's doc.
* Remove a superfluous line break in the equivalent Elvish code.

* Keep code in transcripts on the same line to be correctly highlited.

* Add another example using digit-only argument names.
2021-12-17 19:53:30 +00:00
Qi Xiao
848b585b1c Document which characters can be used in variable names without quoting. 2021-12-17 19:31:49 +00:00
Qi Xiao
046e02869d pkg/eval/vals: Document the use of 0 in UnifyNums. 2021-12-17 10:52:44 +00:00
Qi Xiao
a42b29802a Update .codecov.yml with file rename. 2021-12-17 01:07:20 +00:00
Qi Xiao
51a388b9ec Add imports-graph.elv, a script to visualize package dependencies.
This script focuses on showing the dependencies between source packages in src.elv.sh. It outputs a DOT file.
2021-12-17 00:52:59 +00:00
Qi Xiao
7463203bda pkg/mods: Import pkg/mods/unix. 2021-12-17 00:50:53 +00:00
Qi Xiao
71e5bff8da Replace direct reference to persistent types with their aliases in eval/vals. 2021-12-17 00:21:20 +00:00
Qi Xiao
82d92ad467 pkg/eval/vals: De-export the Eq util and move into a _test file. 2021-12-16 23:55:24 +00:00
moko256
c054b0a24d pkg/cli/term: Use ENABLE_WRAP_AT_EOL_OUTPUT on Windows. 2021-12-16 22:20:44 +00:00
Qi Xiao
089752147a Fixup for #1447. 2021-12-13 01:23:14 +00:00
Kurtis Rader
87656c99fa Replace AnyError in tests with a specific error
The `AnyError` placeholder error can cause tests to succeed for errors
other than what was expected. That is, the use of `AnyError` can mask
bugs in a unit test. So replace it with the specific error, or error type,
the test expects to be raised.

This does not remove the anyError structure because it is used in
the TestCase.DoesNotCompile() method. To keep the size of this change
as small as possible I want to defer updating that use to a separate
change. However, remove the public AnyError var so future test writers
don't attempt to use it.
2021-12-13 01:08:24 +00:00
Qi Xiao
95baad069e Document the new "tmp" special command. 2021-12-11 12:14:45 +00:00
Qi Xiao
da66d3cdc1 Publish 0.17.0. 2021-12-10 17:40:28 +00:00
Qi Xiao
973fe39798 Implement the tmp special command.
This addresses #1114.
2021-12-09 22:12:38 +00:00
Qi Xiao
c1adf58b6d Document using "range n | each" to execute something n times.
This addresses #1433.
2021-12-08 00:32:32 +00:00
Qi Xiao
8cbd39f006 Support calling edit:notify with a styled text.
This fixes #1438.
2021-12-08 00:26:17 +00:00
Qi Xiao
2941f5308e Fix deprecated code in epm. 2021-12-07 00:44:28 +00:00
Qi Xiao
0cef608fe6 Document that "range" now supports counting down in the 0.17.0 release notes. 2021-12-07 00:33:22 +00:00
Harald Hanche-Olsen
fe8af31f2d Fix deprecated code in readline-bindings 2021-12-07 00:30:33 +00:00
Qi Xiao
cf390553bf Upgrade dependencies. 2021-12-06 00:37:48 +00:00
Qi Xiao
6a9931e662 Bump version and deprecation level
Now that v0.17-release has been branched, the HEAD build will show deprecations
intended for 0.17.0, and be considered a pre-release version of 0.18.0.
2021-12-06 00:30:36 +00:00
Qi Xiao
14a81d12f8 pkg/eval: Initialize ns variables to an empty ns, rather than nil.
This fixes #1257.
2021-12-06 00:18:09 +00:00
Qi Xiao
ab88de7c15 Fix ScanToGo's error message when ptr points to an interface.
When the destination to scan into is an interface, its zero value is simply a
nil interface, losing the information of the original type and resulting in
error messages like "need nil, got $actual-type".

ScanToGo now handles this case specifically, and uses the string representation
of the interface type in the error message.

Before:

~> ns []
Exception: wrong type of argument 0: wrong type: need nil, got list
~> var x~ = x
Exception: wrong type: need nil, got string

After:

~> ns []
Exception: wrong type of argument 0: wrong type: need !!hashmap.Map, got list
~> var x~ = x
Exception: wrong type: need !!eval.Callable, got string

This is still not ideal, since the "need" type is not given as an Elvish "kind",
but it's much less confusing than than old "need nil" messages.

This fixes #715.
2021-12-05 23:49:49 +00:00
Qi Xiao
82dda13def Fixup for #1435. 2021-12-05 20:51:17 +00:00
Qi Xiao
0bbae88544
Merge pull request #1435 from krader1961/add-compare-builtin
Add a builtin:compare command
2021-12-05 20:38:30 +00:00
Qi Xiao
713a16bc6e
Merge branch 'master' into add-compare-builtin 2021-12-05 20:37:13 +00:00
Qi Xiao
b1154a95dc Fixup for #1439.
* Fix the case when start is near the overflow point and add regression tests.

* Rewrite the implementation in a less abstract way.

* Rewrite the elvdoc.
2021-12-05 20:22:44 +00:00
Kurtis Rader
2ba69c32dd Augment builtin:range to support counting down
Resolves #1436
2021-12-05 18:44:59 +00:00
Qi Xiao
6bb91a5312 Document performance improvement. 2021-12-02 00:49:36 +00:00
Qi Xiao
64661d6b33 pkg/eval: Execute the last form in a pipeline on the current goroutine.
This simple optimization improves the performance of pipelines containing only
one form drastically. Pipelines containing more than one form also execute a
little bit faster.

A subset of the benchmark results, on MacBook Air M1 2020:

| Benchmark | Before      | After       | Speedup |
| --------- | ----------- | ----------- | ------- |
| nop       |  3398 ns/op | 934.1 ns/op | 3.6x    |
| nop-nop   | 13596 ns/op | 11423 ns/op | 1.2x    |
| put-x     |  4163 ns/op |  1611 ns/op | 2.6x    |
2021-12-02 00:34:36 +00:00
Qi Xiao
9e6555a4fb pkg/eval: Reorganize benchmarks.
Use b.Run to run benchmarks. Also remove the dedicated tests for output capture.
2021-12-02 00:30:01 +00:00
Qi Xiao
9dfda4c753 Use onclick="" to make :hover work on mobile.
Anchor link will be shown after clicking the header. Not sure how this works,
but it does work. Seen on https://stackoverflow.com/a/25673064/566659.
2021-11-30 01:45:53 +00:00
Qi Xiao
090c8ccf82 Tweak styling of header anchors.
* Use normal text color.

* Add a small padding-left.

* Also show when parent is :active, for mobile friendliness.
2021-11-30 01:36:09 +00:00