Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 30 12:57

    xiaq on master

    pkg/diag: Increase test coverag… (compare)

  • Nov 30 01:40

    xiaq on master

    pkg/diag: Document why Ranging … pkg/eval: Refactor index tracki… pkg/eval: Don't use panics for … and 5 more (compare)

  • Nov 28 20:17
    hanche commented #1626
  • Nov 26 17:03

    xiaq on master

    pkg/eval: Document which keys a… (compare)

  • Nov 26 17:00
    xiaq commented #1529
  • Nov 26 17:00
    xiaq closed #1529
  • Nov 26 17:00

    xiaq on master

    pkg/eval: Remove leftover regis… pkg/edit: Show bindings for tog… (compare)

  • Nov 26 13:20
    xiaq commented #1626
  • Nov 26 13:18

    xiaq on master

    pkg/parse: Allow $x[]. $x[ ] i… (compare)

  • Nov 26 12:57
    xiaq commented #1605
  • Nov 26 12:57

    xiaq on master

    pkg/pprof: Support -allocsprofi… (compare)

  • Nov 26 12:26
    hanche commented #1626
  • Nov 26 12:05
    xiaq closed #1605
  • Nov 26 12:05

    xiaq on master

    Fix recording of CPU profiles w… (compare)

  • Nov 26 11:31
    hanche commented #1626
  • Nov 26 11:05
    xiaq closed #1552
  • Nov 26 11:05
    xiaq commented #1552
  • Nov 26 10:55
    xiaq commented #1626
  • Nov 26 10:54
    xiaq commented #1626
  • Nov 26 10:42

    xiaq on master

    pkg/eval: Move time-related bui… (compare)

Kurtis Rader
@krader1961:matrix.org
[m]
My plan for handling external modules is to embed Elvish script into the binary and evaluate that to parse the .elv files found in $runtime:lib-dirs. If parsing those files on the fly every time the help command is used is fast enough then do so to satisfy the KISS principle. However, I suspect it will be necessary provide a help option that explicitly performs that parsing and caches the result in a JSON file.
1 reply
Kurtis Rader
@krader1961:matrix.org
[m]
I consider "Stranger in a Strange Land" one of the greatest S.F. books ever written. I think I've read it four times.
1 reply
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
Another reason is that doing so leaves one way to write elvdocs - today there are two ways, either in .go files or in .elv files. Putting elvdocs in .elv files also makes it possible to generate signatures automatically from the function declaration.
The Markdown parser and renderer I implemented is definitely fast enough to render elvdocs on the fly; caching will only complicate things. The only place where it might not be fast enough is full text search but that remains to be seen.
Even if it’s not fast enough for full text search, it should be possible to optimize pkg/md specifically for this purpose. This is another benefit of having a new markdown implementation instead of depending on an existing one.
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
BTW, I am planning to implement the help command pretty soon down the road. Full text search might take a bit longer.
DrunkenElf
@irc_liberachat_drunkenelf:elv.sh
[m]
Hello! Quick question: how to terminate a background job?
sneaky-thunder97
@sneaky-thunder97:linuxdelta.com
[m]
Holding down Ctrl+C sometimes works (on my machine) but I think its a bug...
DrunkenElf
@irc_liberachat_drunkenelf:elv.sh
[m]
I'd like to do this in the script.
Kurtis Rader
@krader1961:matrix.org
[m]
I don't think there is anyway to do that. Elvish doesn't even have fg, bg, and jobs builtins. However, in the several years I've been using Elvish I haven't found that to be a problem. If you provide more context regarding why you need to do that we can probably provide an alternative solution.
DrunkenElf
@irc_liberachat_drunkenelf:elv.sh
[m]
I just found a way. It's hacky, but it works. The reason I (think I) need this is that I want to monitor some changes in directory structure in the background, then let the user stop that process (waiting for line input) and continue with the script, without monitoring anymore.
Well… I'm not sure if it's clear the way I put it.
DrunkenElf
@irc_liberachat_drunkenelf:elv.sh
[m]
Basically it's a script for creating patches. Go to the directory, run the script, make some changes in the files in that directory, press Enter in the script after you're done, then revert your changes and you get a patch.
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
You can bring it for the foreground with fg (which does exist but is undocumented) but you need to know the PID (which ps will probably tell you)
DrunkenElf
@irc_liberachat_drunkenelf:elv.sh
[m]
If I knew a PID, I would just kill it. But I just wrote myself a find_pid function. Works like this:
var p = (file:pipe)
some_monitoring_process >$p
find_pid <$p
Or rather:
some_monitoring_process >$p &
var pid = (find_pid <$p)
Do you think I can rely on pipes created in Elvish like that?
2 replies
Kurtis Rader
@krader1961:matrix.org
[m]
Arguably simpler is something like this: elvish -c 'echo $pid >/tmp/x; exec sleep 999' &. Obviously, replace /tmp/x with a unique temp file created by path:temp-file.
Kurtis Rader
@krader1961:matrix.org
[m]
Is something wrong with my system or is there a problem with the CI/pre-push checks? I'm seeing the following failure on the master branch from running tools/pre-push:
python3 tools/check-rellinks.py ./_dst
Found broken links:
README.html
    LICENSE
    pkg/diff
    pkg/rpc
    pkg/diff/LICENSE
    pkg/rpc/LICENSE
    pkg/persistent
    pkg/persistent/LICENSE
    pkg/md/spec
    pkg/md/spec/LICENSE
    CONTRIBUTING.md
    PACKAGING.md
    CONTRIBUTING.md
    SECURITY.md
CONTRIBUTING.html
    Makefile
    tools
    tools/pre-push
    website/ref/builtin.md#usage-notation
    cmd/elvmdfmt
    LICENSE
make: *** [check-rellinks] Error 1
Exception: tools/pre-push exited with 2
1 reply
Kurtis Rader
@krader1961:matrix.org
[m]
It looks like links such as see [LICENSE](LICENSE) in README.md are no longer considered valid since there is no LICENSE/index.html file. However, on Github that link resolves to the raw file: https://github.com/elves/elvish/blob/master/LICENSE. I don't think that explains all the failures but it does explain most of them. TBD is why I'm seeing these errors and xiaqqaix (Telegram) isn't.
Kurtis Rader
@krader1961:matrix.org
[m]
Yes, that explains it. I recently changed my "elvdoc" script to also render the CONTRIBUTING.md and README.md files so that I can preview changes via my local web server before opening a pull-request. ISTM that check-rellinks should be able to handle those files since they also contain links, such as [rc.elv](https://elv.sh/ref/command.html#rc-file), that should be verified as being correct. Obviously that's a really low priority but I may take a stab at it.
Kurtis Rader
@krader1961:matrix.org
[m]
BTW, I found a CSS definition that closely approximates the one Github uses to render those files. For example, see https://www.skepticism.us/elvish/CONTRIBUTING.html and compare that to the one displayed on the Github site. It might even be worthwhile to include that file on the elv.sh site.
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
Well, I'm not sure why the Elvish website needs to look the same as GitHub...
Kurtis Rader
@krader1961:matrix.org
[m]
It doesn't. But the CONTRIBUTING document is semi-special. The only reason I went to the trouble of making it look like the same as Github was to make it easier to perform a side-by-side comparison. If it was embedded on elv.sh it could you a completely different style.
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
You can push to your GitHub repo and view the diff on GitHub. There's a "rich diff" option that allows you to see the diff of the rendered page. No need to reinvent GitHub's tooling
Kurtis Rader
@krader1961:matrix.org
[m]

No need to reinvent GitHub's tooling

LOL! Reinventing the wheel is the sine-quo-non of many projects and companies. On a more serious note, despite using Github for many years I didn't notice that capability. I'll see if that works for me. Nonetheless, it still seems to me like check-rellinks should handle the links in those two files. Furthermore, they should be rendered by default (without the Github compatible CSS) to facilitate checking their links. I only noticed a problem with a change I'm working on because of this issue where I indirectly changed a link from #generating-code to #generated-code.

Kurtis Rader
@krader1961:matrix.org
[m]

Also, note that CONTRIBUTING.md contains these two references (in close proximity to each other):

a) [here](website/ref/builtin.md#usage-notation)

b) [rc.elv](https://elv.sh/ref/command.html#rc-file)

I don't see any reason why the first one should refer to a file on Github while the second refers to a document on the elv.sh web site. Regardless of that inconsistency, both links should be validated by the check-rellinks script.

1 reply
hhanche (Telegram)
@telegram_558831502:elv.sh
[m]

Nice to see some recent activity in the repo. But these surprised me. Perhaps they shouldn't?:

⬥ cat /dev/null | file:is-tty 0
⮕ $true
⬥ file:is-tty 2 2>/dev/null
⮕ $true

1 reply
hhanche (Telegram)
@telegram_558831502:elv.sh
[m]
I could make an issue …
1 reply
hhanche (Telegram)
@telegram_558831502:elv.sh
[m]
That was quick. 😊
Kurtis Rader
@krader1961:matrix.org
[m]
xiaqqaix (Telegram): I am confused. Do you want to allow uses of i.e. and e.g. or not? I'm asking because you recently committed changes that introduced uses of those abbreviations. Yet you chastised me for using them in https://github.com/elves/elvish/pull/1615#discussion_r1027311627. I've been working on a change that replaces i.e. with that is and e.g. with for example. The change also includes a check for those abbreviations by the CI and tools/pre-push. Do you want to allow those abbreviations or not?
1 reply
xiaqqaix (Telegram)
@telegram_84517825:elv.sh
[m]
(Wrong chat window)
hhanche (Telegram)
@telegram_558831502:elv.sh
[m]

Here is a minor puzzle for all ye elves out there: What is the result of this code?

var @v = [a b c] [d e f] [g h i]
set @v[1] = x y z
put $@v[1]

Try running it. Doees the result surprise you? Should it surprise you?

More seriously: Have you ever combined the use of $@ with indexing in this manner? I suspect not many have. This is an obscure corner of the language where I expect few would venture, but I think even obscure corners should be as devoid of surprises as can be. See https://b.elv.sh/1626

Kurtis Rader
@krader1961:matrix.org
[m]
It doesn't surprise me. Your first statement assigns a list of lists to v. It is equivalent to var v = [[a b c] [d e f] [g h i]]. Your second statement assigns a list to the second element of the list referred to by v. It is equivalent to set v[1] = [x y z]. This is documented at https://elv.sh/ref/language.html#set (and indirectly elsewhere in that document). Note that the number of elements need not be identical. For example, set @v[1] = a and set @v[1] = a b c d also works and produces the expected (at least by me) result. It's not obvious to me that the "rest" behavior introduced by prefixing a var with @ is improved by disallowing its use in your set statement.
hhanche (Telegram)
@telegram_558831502:elv.sh
[m]

It didn't surprise me either, in the sense that I could easily figure out what is going on, just like you did. But what could certainly surprise some users, is the apparent violation of the principle that when you set something and then query it, you get back what you set it to. The “something” in this case being @v[1]. It violates POLA at first glance.

If you head over to the issue I created, you will see that xiaq is pondering a change of syntax. (It seems he was already considering it before I posted the issue.) If you have an opinion on it, now may be a good time to contribute to the discussion.

Kurtis Rader
@krader1961:matrix.org
[m]
Ah! Now I realize you were pointing out the semi surprising behavior of $@varname[index], not the assignment statements. I too would have expected the index op to bind more tightly than the rest op and produce x y z in your example. I didn't notice because I did a simple put $v to verify the assignments worked as expected.
Diego Zamboni (Telegram)
@telegram_5398062939:elv.sh
[m]
Hey everyone - long time no see, hope everything's going well!
Haven't had much time to tinker with Elvish lately, but just learned about this neat utility, I think it can be very useful within Elvish: https://github.com/kellyjonbrazil/jc
3 replies
Diego Zamboni (Telegram)
@telegram_5398062939:elv.sh
[m]
Nice! Looks a bit like bat on steroids :)
1 reply
blooalien (Telegram)
@telegram_345630763:elv.sh
[m]
I'ma Python guy, so I use Rich a lot. And their TUI module, Textual sometimes, too.
MathiasRiise (Telegram)
@telegram_216907732:elv.sh
[m]
Greatings, Elves.
Discovering the shell, I was wondering if it was possible to append a value to a list or a map...
[1 2]
-> [1 2 3]
Sorry for the daft question!
Kurtis Rader
@krader1961:matrix.org
[m]
elvish> var v = [1 2]
elvish> set v = [$@v 3]
elvish> put $v
▶ [1 2 3]
2 replies
Somewhat surprisingly https://elv.sh/ref/language.html#list doesn't explain how to do this. Nor does it seem to be documented anywhere else.
1 reply
chaotika53 (Telegram)
@telegram_721189228:elv.sh
[m]
7