Giter Site home page Giter Site logo

Comments (4)

ParetoOptimalDev avatar ParetoOptimalDev commented on August 16, 2024

I tried naively adding .# to nix--pcomplete-flags even though it's not a flag and that didn't work:

 ("build"
         (nix--pcomplete-flags
          (append nix-toplevel-options '("--arg" "--argstr" "--dry-run"
                                         "-f" "--file" "-I" "--include"
                                         "--no-link" "-o" "--out-link" ".#"))))

For others toying around with this or other nix related (p)completion I found this to be a useful resource:

https://www.masteringemacs.org/article/pcomplete-context-sensitive-completion-emac

from nix-mode.

ParetoOptimalDev avatar ParetoOptimalDev commented on August 16, 2024

I tried using edebug to understand pcomplete/nix and figured out that while nix build hits its code path, nix build . hits it, nix build .# does not.

.# seems to be special in emacs completion somehow and this special behavior will need to be overriden to get completion for it.

from nix-mode.

ParetoOptimalDev avatar ParetoOptimalDev commented on August 16, 2024

.# is special because it's an eshell glob. I can progress a bit further following the control flow in edebug by removing # from eshell-glob-chars-list but things aren't quite working. I think it's because the command getting run and it's result is:

~ $ NIX_GET_COMPLETIONS=2 nix build .#
attrs

It wouldn't be correct, but I'd expect at this point to get attrs as a completion candidate.

from nix-mode.

ParetoOptimalDev avatar ParetoOptimalDev commented on August 16, 2024

Oh, actually it's working! I just wasn't in a directory with a flake. So this works (if the code is correct):

(setq eshell-glob-chars-list '(93 91 42 63 126 40 41 124 94))

And then adding .# in:

 ("build"
         (nix--pcomplete-flags
          (append nix-toplevel-options '("--arg" "--argstr" "--dry-run"
                                         "-f" "--file" "-I" "--include"
                                         "--no-link" "-o" "--out-link" ".#"))))

Ideally though we could avoid removing .# as a glob and only treat it as a glob when it's not preceded by nix build. I don't have time to look into right now though.

from nix-mode.

Related Issues (20)

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.