Ludovic Courtès (2014-11-09 20:45 +0300) wrote: > Alex Kost <alez...@gmail.com> skribis: > >> This patch adds URL of a package source and 2 buttons ("Show" and >> "Download") to an ‘info’ buffer (see the attached screenshot). >> >> Pushing the "Show" button displays a store path of the package source. >> Pushing the "Download" button has the same meaning as “guix build -S …”. > > This is very cool! > > I had in mind a slightly simpler user interface: just a “View source” > button. The thing would build (package-source-derivation p), > effectively downloading it if it’s not already present, and opening it > in dired.
I don't think opening in dired should be a default (although I made ‘guix-package-info-find-source-p’ variable +for you+ for this case) because there may be a big compressed tarball that a user wouldn't like to uncompress with emacs tar-mode. I think displaying a link is the preferable variant as a user can open the file or copy its path if he wants. Also you suggest to make “View source” synchronous: build a source derivation, download it and open in dired. Did I understand it right? As this process may take a long time (for big sources or for git checkouts if a user doesn't have a necessary git infrastructure), I think it should be evaluated asynchronously in a REPL and it's not possible (at least not easy) to define what value was returned by a REPL command, so no way to define what file to open in dired. Also what if I want to define whether there is a source in the store or not? (And I don't want to download it if it's not there.) With your variant of a single “View source” button it would not be possible, as the source that doesn't exist in the store will be downloaded unconditionally. > With the interface you propose, things might be slightly confusing: > sometimes clicking on “Download” will do nothing (because the source is > already there), sometime “Show” will work without “Download”, sometimes > not, etc. Also it takes up quite a bit of space. Sorry, I didn't get it. What space do you mean? > WDYT? Pushing a “Download” button will always do something: it will run some command in a REPL and will always display a store path in the end. And «Hey, USER, what did you expect from a “Download” button if the source is already downloaded?» But if you find it confusing what about the following variant: initially there will be only “Show” button and when you press it, “Download” button appears only if the source does not exist in the store. After a successful downloading, it disappears again. -- Alex