Giter Site home page Giter Site logo

elvish-modules's Issues

`edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir` causes error message "Exception: value should be function" regarding `$dir`

In Elvish 0.12 on macOS Sierra 10.13.6, I added the following to ~/.elvish/rc.elv per the dir.org file:

use github.com/zzamboni/elvish-modules/dir
edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir
edit:insert:binding[Alt-f] = $dir:&right-word-or-next-dir
edit:insert:binding[Alt-i] = $dir:&dir-chooser

which upon restarting Elvish generates the following error message:

Exception: value should be function
/Users/alchou/.elvish/rc.elv, line 18: edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir

wherein the substring $dir: is underlined.

iterm2: Makes histlist slow in iTerm (including quickfix)

For some reason that I have not finally debugged, adding ftcs-command-start >/dev/tty to the prompt causes the histlist (bound by default to Ctrl-R) to render much slower than usual. (Usually comes up within a split second, on a full screen terminal takes 1-2 seconds to come up after iterm2:init has been called.) Occurs only in iTerm, calling iterm2:init in Terminal.app doesn't have this effect.

I fixed it by emitting iterm2:ftcs-command-finished before producing the history list, using the following stanza in rc.elv (after calling iterm2:init):

set edit:insert:binding[Ctrl-R] = {
	iterm2:ftcs-command-finished
	edit:histlist:start
}

I hope to spare somebody a few minutes of googling and debugging by this. If anybody more knowledgeable than me can explain to me a bit more thoroughly what's going on, I wouldn't mind :)

semver module: missing MINOR, PATCH should not be ignored

(Reported by @krader1961)

According to the documentation:

A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers

Currently semver considers missing Y or Z as zeros, so that:

> semver:eq 1.0 1.0.0
▶ $true

This should produce an error - maybe there should be a &non-strict option to allow parsing non-strictly-compliant numbers.

Useless use of `cat`

FYI, while responding to elves/elvish#1416 I noticed that alias.org has two lines of this form:

var content = (cat $file | slurp)

There isn't any need for cat and a pipeline, just do var content = (slurp < $file). I know your alias module is probably no longer being actively maintained now that Elvish has edit:add-var but you should still probably review all your Elvish code for useless uses of cat. 😺

Should aliases be persistent?

The alias module at the moment automatically saves aliases defined with alias:new to individual files under ~/.elvish/aliases/. This is nice for interactive use, but I am not convinced of this being a good thing. For the most part, aliases should be defined in the config file, and I think it is a good thing that, if they need to be persistent, they should be defined there so that the config file is a "single source of truth". Maybe a new alias:save function could be added for when you want to save certain aliases, but not be the default behavior.

long-running-notifications should use the `edit:after-command` hook

This question was posed by @dcuadrado on IM an hour ago:

in the notifier is there a way to know if the process failed? I'd like it to say something out loud if the command failed

The answer is, no, given the current implementation. However, if the implementation were changed to use the edit:after-command hook introduced by commit elves/elvish@e2f8100 it could both report sub-second durations and the status of the command; i.e., whether or not it failed and if it failed how it failed.

dir module not working on elvish 0.15?

Absolute beginner in Elvish, sorry if this is something silly, but I just tried this:

#! /usr/bin/env nix-shell
#! nix-shell -i elvish -p elvish

use epm
epm:install github.com/zzamboni/elvish-modules

use github.com/zzamboni/elvish-modules/dir

use github.com/zzamboni/elvish-modules/alias
alias:new cd "use github.com/zzamboni/elvish-modules/dir; dir:cd"

cd bastion
cd -

And got:

Exception: compilation error: variable $edit:current-command not found
/Users/juliano/.elvish/lib/github.com/zzamboni/elvish-modules/dir.elv, line 89:   if (> (count $edit:current-command) 0) {
/Users/juliano/git/NoRedInk/tf-all.elv, line 7: use github.com/zzamboni/elvish-modules/dir

error loading modules

Hello, I just discovered elvish, and I am loving it.
I can use:
use github.com/iwoloschin/elvish-packages/update
use epm
epm:install &silent-if-installed ^
github.com/zzamboni/elvish-modules ^
github.com/zzamboni/elvish-completions ^
github.com/zzamboni/elvish-themes ^
github.com/xiaq/edit.elv ^
github.com/muesli/elvish-libs ^

without issues

But, I am trying to use bang-bang or aliases and is failing
use github.com/zzamboni/elvish-completions/alias
Exception: no such module: github.com/zzamboni/elvish-completions/alias
[tty 46], line 1: use github.com/zzamboni/elvish-completions/alias

Any idea of what am I doing wrong?

Thanks

long-running-notifications: Allow specifying commands to ignore

For interactive applications like editors (vim, nano), pagers (less), shells (elvish, bash) and others getting a notification of the time the command ran isn't really useful.

It would be nice if it was possible to pass a list of command names to ignore to long-running-notifications

Aliases Broken

Not sure which commit, but something in the last day seems to have broken aliases. As far as I can tell aliases are simply not being found and launched. The best example is probably just ls:

alias:def ls e:ls -G

If you type 'ls' it should return with colors (on macOS at least), but instead it's just a plain boring white ls output.

util:getfile no longer works correctly

At some point, Apple in their infinite wisdom has changed the escape conventions for filenames dragged from the Finder into the terminal, so the current code no longer works.

This seems to be the new convention:

  • If the dragged pathname is free of special characters, it is input as is. So far so good.
  • If there are special characters, the pathname is quoted using single quotes. If so,
    • single quotes in the path name are escaped with a preceding backslash,
    • and so is any backslash.

Example: A file named a'b\c gets entered as '…/a\'b\\c', where is the directory part.

I don't know of any shell that obeys these escape conventions – certainly not bash or zsh – so I don't know what Apple has been thinking. And since these seem so awfully wrong, I suspect it may get changed yet again. If not, the new convention is easy enough to parse, but I don't have a moment to spare for this in the foreseeable future.

[dir] Error messages: option to disable / customize output

The error messages (e.g. "Beginning/End of directory history!") are messing with my prompt. I have to press Enter or run clear to have it restored. Would it be possible to implement some mechanism to disable them or customize where/how they will be printed? E.g. I was thinking about showing them in the rprompt.

An idea: have some variable, say dir:print-error, whose default value would be the current behaviour:

print-error = [msg]{

    echo $msg > /dev/tty
}

and then functions like e.g. back would use it:

fn back {
  if (> $-cursor 0) {
    -cursor = (- $-cursor 1)
    builtin:cd $-dirstack[$-cursor]
  } else {
    $print-error "Beginning of directory history!"   # <= here
  }
}

Then I would be able to override dir:print-error in my rc.elv to implement the behaviour that I want.

dir.org README should contain better instructions for using the alias package

  1. The hyperlink to the alias.org README renders as code rather than a clickable link.
  2. I haven't looked at zzamboni/elvish-modules packages other than alias, bang-bang, and dir, so I don't know if any others refer to using alias, but if they do, they as well as this one should mention, as reported in #5 , that the -exports- = (alias:export) needs to appear in the rc.elv file and come after all uses of the alias command.

semver module: build metadata should be ignored

(Reported by @krader1961)

According to the documentation:

Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3—-117B344092BD.

Currently the metadata is considered as part of the build string, so it's used in the comparison:

semver:eq 1.0.0-alpha+001 1.0.0+20130313144700 1.0.0-beta+exp.sha.5114f85 1.0.0+21AF26D3—-117B344092BD
▶ $false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.