Commit Graph

235 Commits

Author SHA1 Message Date
Qi Xiao
2f9f2fa3e4 website/ref/edit.md: Document that some keys may not be available from the terminal. 2024-05-03 15:17:09 +01:00
Qi Xiao
1aeb2f6e98 pkg/eval: Link to the upvalue explanation from the doc of "eval".
Also make the upvalue explanation its own subsection.
2024-05-02 21:00:35 +01:00
Qi Xiao
8cc1fa6546 website/ref/language.md: Add missing str: to has-suffix in example. 2024-04-30 10:29:25 +01:00
Qi Xiao
081455fc49 website: Link to get/default-shell.html from ref/command.html.
This addresses #694.
2024-04-09 11:02:41 +01:00
Duncan Giles
0898cc7403 formatting 2024-04-02 10:51:47 +01:00
Duncan Giles
f0590d9b0c use anchor 2024-04-02 10:51:47 +01:00
Duncan Giles
422f551986 exception capture link 2024-04-02 10:51:47 +01:00
Qi Xiao
1b1d8e276c website/ref: Use a concrete command in the combined output-exception capture example.
The command relies on the failing command outputting a single value.

This addresses #1780.
2024-04-01 22:26:37 +01:00
Qi Xiao
1d45b6e9ed website/ref: Add examples for try from #1783 by @Duncan3142. 2024-04-01 22:12:45 +01:00
Qi Xiao
b0abf3cb11 website/ref: Expand the doc on ~ and : as part of variable names.
- Mention them in notes of the metacharacters section (originally proposed in
  #1781 by @marco-m).

- Add a new subsection for qualified names.

- Add examples of the correspondance between command foo and variable $foo~.
2024-04-01 21:46:54 +01:00
Qi Xiao
0fc462b69a pkg/eval: Require "catch" when using "else" in the try command.
This addresses the comment raised in #1782.
2024-04-01 20:54:12 +01:00
Duncan Giles
943e15dfc5 try / else docs
Clarify code examples regarding required catch or finally when using else
2024-04-01 20:46:07 +01:00
Qi Xiao
1bca28f24e website: Document the Alt-* keys in readline-binding. 2024-03-14 18:36:30 +00:00
Qi Xiao
6dcf93ccaf website: Use sentence case for most article titles. 2024-03-04 19:41:49 +00:00
Qi Xiao
01649f8fb1 website: Update .gitignore and add ttyshot files back. 2024-02-28 16:15:03 +00:00
Qi Xiao
1412473b4a website: Revamp homepage, site-wide styles and ttyshots.
- Homepage revamp:

  - Rewrite the homepage in a linear format of sections, with every other
    section styled with full-width gray background.

  - The first section is a short intro, with big buttons for "download" and
    "learn".

  - Create a new "case studies" page to house the explainers for the examples.

- Site-wide styles:

  - Restyle code blocks and ttyshots, using a more subtle gray border box
    instead of gray background.

  - Support headers for code blocks and ttyshots, in a style that vaguely
    resembles title bars of desktop windows. In Markdown sources, additional
    content after the language tag becomes the header.

  - Reorganize the global stylesheet and template, including using 2 spaces for
    indentation and putting dark mode color rules next to the light mode rules.

  - Change debug hotkey to toggle dark mode to Shift-D.

- Ttyshots:

  - Handle trailing spaces in more places in the ttyshot tool - there seems to
    be more of them in the latest tmux version.

  - Base the ttyshot tool's parser on pkg/transcript.

  - Support per-ttyshot cols and rows.

  - Rename x.elvts and x.ttyshot.html to x-ttyshot.elvts and x-ttyshot.html.

  - Change the syntax from "@ttyshot filename" to code block with a special
   "ttyshot" language tag to work better with the header syntax.
2024-02-26 18:23:16 +00:00
Qi Xiao
4f822ab654 New md: module. 2024-02-26 10:40:24 +00:00
Qi Xiao
3b27569e2c pkg/elvdoc: Remove support for "#doc:fn".
This construct is only used in two places - grouping numerical comparison
commands together and grouping string comparison commands together. However,
grouping them together makes it impossible to look up their individual elvdocs,
for example using "doc:show '<'", so abandon this half-baked grouping mechanism.

In future a more general mechanism to group symbols together may be introduced.

Document != and !=s as if they only take two arguments, addressing #1767. The
actual change will be done in a separate commit.
2024-02-18 10:47:17 +00:00
Qi Xiao
71a682629d Remove support for ~/.elvish. 2024-02-10 16:07:04 +00:00
Kurtis Rader
3c666ef9cd Fix broken readline binding link
The primary purpose of this change is to fix a broken link to the
readline binding source. A secondary purpose is a baby step to
addressing issue #1719.

Related #1719
2024-01-23 09:56:26 +00:00
Qi Xiao
1cfe72a692 website/cmd/md2html: Fix [foo]() (unqualified) outside builtin.html.
This syntax has been documented to have an implicit destination of
builtin.html#foo, but it never worked correctly outside builtin.html itself.

Also do some minor cleanups of the package, including removing bogus package
godocs that were inherited from the previous version where the components were
separate programs.
2024-01-08 22:45:28 +00:00
Qi Xiao
266e01d474 Reformat os.md to placate the style checker 2024-01-03 12:05:00 +00:00
Wyatt Campbell
a1a56e9789 Changed os reference documentation to use follow-symlink instead of old eval-symlinks 2024-01-03 12:05:00 +00:00
Kurtis Rader
204eed9aae Fix a typo detected by spellcheck
While working on an unrelated change I noticed that `make all-checks`
found a typo. I was using codespell 2.2.5 so this also upodates the
.github/workflows/ci.yml file to depend on that release since doing so
does not introduce any false positives.
2023-08-11 21:14:39 -07:00
Qi Xiao
db0f599a34 Remove a paragraph on unstable symbols being at the end, since it no longer applies. 2023-08-06 12:08:26 -04:00
Qi Xiao
e847e677fe Move a lot of symbols from path: to os:.
Most of the symbols moved originate from Go's os package. However,
eval-symlink, which is provided by Go's path/filepath package, is also moved to
the os: module since it requires actual filesystem access. The idea is that
Elvish's path: will only provide functionalities for lexically manipulating
file paths without referencing the actual filesystem, akin to Python's
pathlib.PurePath.

The old symbols in path: are not formally deprecated since the compiler can't
statically check symbols in modules yet.
2023-08-06 12:06:41 -04:00
Qi Xiao
93423d3244 Support (struct)map with 'r' or 'w' fields in redirections.
Now that pipe is a structmap and structmaps are considered indistinguishable to
normal maps, IO redirection should support arbitrary maps too.

Update the relevant section in the language spec and rewrite it a bit.
2023-07-18 17:52:06 +01:00
Qi Xiao
6992c0b693 Make pseudomaps print like [^tag &key=value].
Also make file:pipe output a struct map rather than a pseudomap.
2023-07-17 23:41:43 +01:00
Qi Xiao
96752afa4d Make struct maps indistinguishable from maps to Elvish code.
Struct map is a mechanism to let Go code expose simple structs to Elvish code.
The difference between struct maps and maps is convenience for Go code; they
also have different performance characteristics, but since struct maps are
always quite small, the difference is not meaningful for Elvish's use cases.

As a result, there is no good reason that Elvish code needs to be aware of the
difference between struct maps and normal maps. Making them indistinguishable to
Elvish code simplifies the language.

This commit does the following:

- Change Equal, Hash, Kind and Repr to treat struct maps like maps.

- Change Assoc and Dissoc to "promote" struct maps to maps.

- Remove the custom Repr method of parse.Source.

- Update documentation to reflect this change.
2023-07-14 23:57:38 +01:00
Qi Xiao
cf41f7a01c New "os" module.
This addresses #1659.
2023-05-08 22:40:02 +01:00
Qi Xiao
ba8614bab3 website: Overhaul styling.
Also rewrite some texts to fit within the now narrower body.
2023-04-29 16:55:10 +01:00
Qi Xiao
c0d5b015d0 website: Reduce the width of ttyshots.
This is to prepare for a stylesheet overhaul that will reduce the width of the
body text.

Also change home/pipelines.elvts to use XKCD instead, which is a bit more
interesting than GitHub and makes for a shorter URL.
2023-04-24 21:34:05 +01:00
Sidharth Kshatriya
e9628bfc47 doc: small fix in lang spec 6.10. Order of evaluation 2023-04-10 23:24:40 +01:00
Qi Xiao
bda2879228 pkg/glob: When enumerating files, keep going if Lstat fails.
When encountering files that can't be lstat'ed, simply ignore them instead of
terminating the entire globbing process. This is consistent with how directories
that can't be read are already silently ignored.

This fixes #1674.
2023-04-10 23:22:21 +01:00
Qi Xiao
5f0eebab1f website/ref/str.md: Note that some string utilities are in the builtin module. 2023-03-31 13:28:50 +01:00
Qi Xiao
dede073b31 Use .elvts as the standard extension of Elvish transcripts.
Rename the existing ttyshot instruction files to use the new extension too.
2023-03-01 22:39:06 +00:00
Qi Xiao
3845a2cf7f Expose stack traces in exceptions as opaque values.
Also document the correct way to compare the causes of exceptions.

This fixes #1632.
2023-02-26 23:52:26 +00:00
Qi Xiao
7e513edb0a Document implicit string conversion in compound expressions. 2023-01-28 19:26:24 +00:00
Qi Xiao
d7ea00fb7f Fix the example for pragma unknown-command. 2023-01-25 15:11:34 +00:00
dunsany
1205dc5dab Small corrections in builtin module doc 2023-01-14 19:40:02 +00:00
Qi Xiao
08007a52ce website/cmd/md2html: Support implicit link targets to elvdoc sections.
For example, [`put`]() links to the elvdoc for "put".

Also remove the @cf macro now that implicit targets make it easier to link to
other elvdoc sections.
2023-01-02 02:36:58 +00:00
Qi Xiao
f2aeab0362 website/cmd/elvdoc: Simplify the implementation by using pkg/mods/doc. 2022-12-31 23:07:13 +00:00
Qi Xiao
5e6954dbf3 Add a doc: module for accessing documentation of Elvish modules.
This fixes #1432.
2022-12-26 21:36:07 +00:00
Qi Xiao
eeabec9e06 Update the autofix ttyshot. 2022-12-25 14:14:33 +00:00
Qi Xiao
cc6e02d206 pkg/edit: Make smart-enter and completion:smart-start apply autofix. 2022-12-25 13:50:17 +00:00
Qi Xiao
b09c05b8cc pkg/edit: Show autofix commands, and support applying it. 2022-12-11 21:25:13 +00:00
Qi Xiao
1acc45cfc2 pkg/edit: Show dedup binding in history listing mode.
Also fix a lot of elvdoc.
2022-12-06 22:51:15 +00:00
dunsany
6a5c678f7e
Small documentation fixes (#1627)
* Update language.md

* Update str.d.elv
2022-12-03 00:53:32 +00:00
Qi Xiao
dc523d45be website: Preserve $ in the HTML ID of docs for variables.
We are no longer using Pandoc, so this limitation can be lifted.

Also make @cf generate internal links where applicable in non-builtin modules:
"@cf mod:fn" in the doc of "mod" now links to just "#mod:fn" instead of
"mod.html#mod:fn".
2022-11-22 23:42:19 +00:00
Qi Xiao
6c6797b4c1 Remove use of "e.g.," and "i.e.,".
Some of the uses are replaced by plain English phrases like "such as", and the
remaining have the trailing commas removed.
2022-11-20 15:44:29 +00:00