Commit Graph

394 Commits

Author SHA1 Message Date
Qi Xiao
8a2c9a24db pkg/eval/vals: Add an optimized version of UnifyNums for two numbers. 2021-05-31 21:02:12 +01:00
Kurtis Rader
20decc5976 Implement edit:command-history &dedup
This implements `&dedup` and `&newest-first` options for
`edit:command-history`. This makes it noticably cheaper to feed unique
command history into external commands like `fzf`.

Related #1053
Fixes #568
2021-05-30 23:49:46 +01:00
Kurtis Rader
f67c7ed387 A couple of TODO cleanups 2021-05-30 00:40:42 +01:00
Kurtis Rader
9b61cdc727 Be consistent about sync.WaitGroup var naming
Also, remove the unused dbStore.Waits() method. This came to my
attention while writing `peach` unit tests.
2021-05-30 00:40:42 +01:00
Qi Xiao
cc1a07b28b Fixup for file:truncate. 2021-05-30 00:32:30 +01:00
Supreet
fc28dddb38 file:truncate added to file module, with requested changes 2021-05-30 00:15:43 +01:00
Qi Xiao
f7a82908e2 Reimplement some math functions to be exactness-preserving.
This addresses #1300.
2021-05-09 20:03:21 +01:00
Qi Xiao
79fe6947cf Reorder test cases in math.go and math_test.go. 2021-05-09 14:40:34 +01:00
Qi Xiao
320b77ea1b pkg/eval/vals: Convert any number type to float64.
This addresses #1300.
2021-05-09 14:32:50 +01:00
Qi Xiao
3d078ec653 pkg/eval/mods/path: Skip symlink tests if unable to create symlinks.
Creating symlinks requires a special permission on Windows, which the
use may not have.

Also remove the support for symlinks in testutil.ApplyDir. Because of
this issue on Windows, any test that requires creating symlinks needs to
be broken out to an individual test case, meaning that symlinks can't be
created alongside other files, so there is less benefit of keeping it
inside the same Dir structure.
2021-05-08 13:22:21 +01:00
Qi Xiao
b80f9ed09e pkg/eval/mods/path: Fix test on Windows. 2021-05-08 02:32:42 +01:00
Qi Xiao
b1d50754e2 Remove the NEXT-RELEASE.md symlink.
GitHub displays symlinks simply as the path of the destination, meaning
that we can't just link to it for the notes of the next release.
2021-05-05 22:26:12 +01:00
Kurtis Rader
e2f810048e Add $edit:after-command and $edit:command-duration
The `edit:after-command` hooks are called with a single argument:
a pseudo-map with these keys:

    "command": the command line that was run
    "duration": the execution duration in seconds
    "error": any error that occurred ($nil if no error occurred)

The `edit:command-duration` variable is the elapsed seconds (as a
float64) of the most recently run interactive command.

Resolves #1029
2021-05-05 22:17:19 +01:00
Qi Xiao
91b6f6dd72 Use the integrated persistent package. 2021-05-03 22:17:46 +01:00
Qi Xiao
543b123661 Add some design notes in eval/vals/num.go. 2021-05-02 01:17:27 +01:00
Qi Xiao
2ac9d891ca Improve readability of argument mismatch error message.
* Use 0-based indexing.

* Use more natural-sounding English.

Inspired by #1290.
2021-05-02 00:27:38 +01:00
Qi Xiao
9cd90c49bb Minor fixup for #1274. 2021-05-02 00:22:28 +01:00
Qi Xiao
698d55ef07
Merge branch 'master' into issue-1248 2021-05-01 19:17:17 -04:00
Qi Xiao
7b66e9f104 Minor fixups for #1273.
Also fix a test broken by bad merge.
2021-05-02 00:13:22 +01:00
Qi Xiao
82f1912c5e
Merge branch 'master' into readonly-var-msg 2021-05-01 19:06:39 -04:00
Qi Xiao
90acb4a242 Minor fixup for path:temp-{dir file}.
* Remove `MatchesRegexp` from eval/vals since it is not part of the
  Elvish value protocol.

* Simplify implementation of value matching in `eval/evaltest`.

* Documentation wording tweaks.
2021-04-25 23:03:44 +01:00
Kurtis Rader
bc37099c92 Add equivalent of mktemp as builtin commands.
This implements `path:temp-dir` and `path:temp-file`.

Resolves #1255
2021-04-25 17:34:23 -04:00
Qi Xiao
a2ba33f6c5 Remove unneeded tests.
These tests exercise the arity checking logic, which is implemented
generically for every builtin function and does not need to be tested
individually.
2021-04-19 23:49:09 +01:00
Supreet
8f2accb0b9 File module with pipe function. Pipe command marked deprecated in compiler.go and builtin_fn_io.go
Prclose and pwclose with Deprecation marked in specific file. Give
feedback regarding the test cases.

File module now has prclose and pwclose

Wrote test cases for prclose and pwclose, need better test cases

Deprecation for prclose and pwclose marked in respective files.
2021-04-19 18:48:22 -04:00
Qi Xiao
2a1eda6bb0
Fix elvdoc of the src command 2021-04-11 01:17:39 +01:00
Qi Xiao
9b276a3431 Replace references to f{open close} in file module's elvdoc. 2021-04-09 13:03:47 +01:00
Qi Xiao
42d6e94dd7 Remove support for $-exports-. 2021-04-09 00:02:40 +01:00
Qi Xiao
c30a6a2fbe Remove support for using a lone "a=b" for assignment. 2021-04-08 23:57:40 +01:00
Qi Xiao
b53a92b964 Remove all builtin commands deprecated since 0.15.0. 2021-04-08 23:07:50 +01:00
Qi Xiao
318c4c14fd Clean up temporary files properly in the test for the file: module. 2021-04-08 23:07:11 +01:00
Qi Xiao
e1552ab4f5 Minor fixes for the file module:
* Add to release notes.

* Fix the deprecation level of fopen and fclose.

* Fix format of elvdoc and add ref doc.

* Minor style adjustments.
2021-04-08 22:55:33 +01:00
Supreet
77c40b9abb Links file module, marks fopen and fclose deprecation in compiler.go
aand builtin_fn_io.go
2021-04-08 22:45:16 +01:00
Qi Xiao
c2a232a156 Merge branch 'num'
This fixes #241.
2021-04-08 00:43:19 +01:00
Qi Xiao
5eec2c049d Remove special treatment of the builtin: namespace.
This fixes #1227.
2021-04-08 00:42:58 +01:00
Qi Xiao
fd212c1f75 More doc, and add exact-num. 2021-04-07 07:05:08 +01:00
Qi Xiao
a5baad65f8 pkg/eval/vals: Clean up FromGo. 2021-04-06 22:38:56 +01:00
Qi Xiao
6052a4dc4a Remove the "fix int" terminology; just call it "int". 2021-04-06 22:35:58 +01:00
Qi Xiao
e2c4030728 pkg/eval: Handle non-positive step and overflow in the range builtin. 2021-04-06 22:33:02 +01:00
Qi Xiao
5c643181a4 Cleanup, docs and tests. 2021-04-05 20:48:22 +01:00
Kurtis Rader
12980c2719 Some golint cleanups 2021-04-05 15:31:53 +01:00
Qi Xiao
da67ba8a4a Use machine word (int) instead of int64 for fixnum. 2021-04-04 13:37:38 +01:00
Qi Xiao
4612b58759 Support exact integer and rational numbers. 2021-04-04 00:58:53 +01:00
Kurtis Rader
e2759f777b Initialize a command var to $nop~
You cannot assign $nil to a command var so that should not be the initial
value of `var x~`. Instead, assign $builtin:nop~.

Fixes #1248
2021-03-28 22:51:30 -07:00
Kurtis Rader
ddf9bf040e Correctly highlight read-only except var
Using a read-only variable as the target of an `except` clause should
highlight just the var name rather than the entire `try...except...`
statement.

Resolves #1258
2021-03-28 22:01:31 +01:00
Kurtis Rader
1e0885310e Include name in error msg setting a readonly var
When attempting to update a read-only var return an error struct rather
than a simple string (i.e., a Go `error` type).  This makes it possible
to include the var name in the error message.  This builds on commit
a33ecb2d that highlights the offending var name in the stack trace but
does not include the var name in the error message. With this change the
error message includes the offending var name.

Related #255
2021-03-26 18:38:22 -07:00
Qi Xiao
959120162b pkg/eval: Use cmpd.StringLiteral in one more place.
Also remove an unused method that is now superseded by the cmpd package.
2021-03-19 23:18:42 +00:00
Kurtis Rader
69a8adb2e9 Allow quoted var names in an except... block
Related #1258
2021-03-19 22:59:25 +00:00
Qi Xiao
b2591e95a7 Add new edit:clear command.
This fixes #1238.
2021-02-26 00:36:09 +00:00
Qi Xiao
634d71dcba Extract utilities for compound nodes into pkg/parse/cmpd. 2021-02-24 00:02:47 +00:00
Qi Xiao
e3b0b27931 Do not append slash after expanding ~username.
This fixes #1246.
2021-02-23 23:25:48 +00:00