From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 3/3] emacs: Add "Source" field to 'guix-info' buffers. Date: Tue, 11 Nov 2014 00:29:48 +0100 Message-ID: <87y4riiqhf.fsf@gnu.org> References: <87egtcbwd0.fsf@gmail.com> <87lhnktgh7.fsf@gnu.org> <878ujkb475.fsf@gmail.com> <87d28wq9kj.fsf@gnu.org> <878ujj2nyo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnyPJ-0001JB-TF for guix-devel@gnu.org; Mon, 10 Nov 2014 18:30:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnyPA-00053x-Fm for guix-devel@gnu.org; Mon, 10 Nov 2014 18:30:01 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:52369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnyP9-00053r-Gf for guix-devel@gnu.org; Mon, 10 Nov 2014 18:29:52 -0500 In-Reply-To: <878ujj2nyo.fsf@gmail.com> (Alex Kost's message of "Mon, 10 Nov 2014 16:18:39 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Kost Cc: guix-devel@gnu.org Alex Kost skribis: > Ludovic Court=C3=A8s (2014-11-10 01:43 +0300) wrote: > >> Alex Kost skribis: [...] >> I don=E2=80=99t think it=E2=80=99s natural for a user to think in terms = of downloads. >> Personally, when I want to see the source of a package, I do: >> >> tar xf $(guix build -S foo) > > I think later we can provide some variable to choose if pushing a > "source file" button will open a tarball in a =E2=80=98tar-mode=E2=80=99 = (a usual > 'find-file' way) or will untar it in =E2=80=9C/tmp=E2=80=9D or something. OK. >> and that=E2=80=99s it. If it=E2=80=99s taking too long or something, I = can still hit >> C-c. But typically, I don=E2=80=99t ask myself =E2=80=9Cis this already= in the store?=E2=80=9D. > > I typically ask myself this question :-) OK, fair enough! >>>> With the interface you propose, things might be slightly confusing: >>>> sometimes clicking on =E2=80=9CDownload=E2=80=9D will do nothing (beca= use the source is >>>> already there), sometime =E2=80=9CShow=E2=80=9D will work without =E2= =80=9CDownload=E2=80=9D, sometimes >>>> not, etc. Also it takes up quite a bit of space. >>> >>> Sorry, I didn't get it. What space do you mean? >> >> I meant visual space in the user interface; visual clutter. > > Is that "too much information is bad"? Do you suggest to remove > something? I think a single button is clearer than two buttons plus a label, but that=E2=80=99s OK here since we can=E2=80=99t really do just one button. >> But note that derivation outputs not obtained by a =E2=80=98build-deriva= tions=E2=80=99 >> call with the current store connection may be garbage-collected anytime. >> That makes it more difficult to reliably determine whether the >> =E2=80=9CDownload=E2=80=9D button should be displayed; to be safe, it wo= uld have to be >> displayed by default. Then we=E2=80=99re very close to the current patc= h, I >> think, no? > > I just check whether a final source file exists in the store and that's > all. I think it's reliable, isn't it? There=E2=80=99s still the possibility that (1) the source is there, so no =E2=80=9CDownload=E2=80=9D button, (2) the source is GC=E2=80=99d, and (3) = there=E2=80=99s still no =E2=80=9CDownload=E2=80=9D button and trying to access the source fails gra= celessly. That=E2=80=99s probably not very common in practice, and easily fixed by hi= tting =E2=80=98g=E2=80=99, so maybe it=E2=80=99s not worth worrying. WDYT? >> If that=E2=80=99s fine with you, perhaps let=E2=80=99s just commit the p= atch as is, and >> see in another patch whether =E2=80=9CDownload=E2=80=9D can be made to d= isappear in safe >> cases? > > I modified the patch (attached) to display =E2=80=9CShow=E2=80=9D and =E2= =80=9CDownload=E2=80=9D buttons > only when needed. WDYT? Sounds good! > +(define (package-source-names package) > + "Return a list of source names (URLs) of the PACKAGE." > + (let ((source (package-source package))) > + (and (origin? source) > + (filter-map (lambda (uri) > + (cond ((string? uri) > + uri) > + ((git-reference? uri) > + (git-reference-url uri)) > + (else #f))) > + (list-maybe (origin-uri source)))))) The #f case above just leads to degraded display, not breakage, right? (I=E2=80=99m asking because of the other things beyond string? and git-reference?.) Thanks, Ludo=E2=80=99.