From unknown Sat Aug 16 20:57:03 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#22933 <22933@debbugs.gnu.org> To: bug#22933 <22933@debbugs.gnu.org> Subject: Status: M-x guix-edit fails gracelessly when passed an nonexistent package name Reply-To: bug#22933 <22933@debbugs.gnu.org> Date: Sun, 17 Aug 2025 03:57:03 +0000 retitle 22933 M-x guix-edit fails gracelessly when passed an nonexistent pa= ckage name reassign 22933 guix submitter 22933 ludo@gnu.org (Ludovic Court=C3=A8s) severity 22933 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 11:29:19 2016 Received: (at submit) by debbugs.gnu.org; 7 Mar 2016 16:29:19 +0000 Received: from localhost ([127.0.0.1]:38259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acy22-0005bJ-Oz for submit@debbugs.gnu.org; Mon, 07 Mar 2016 11:29:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36530) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acy20-0005b2-PX for submit@debbugs.gnu.org; Mon, 07 Mar 2016 11:29:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acy1r-0001Va-Mr for submit@debbugs.gnu.org; Mon, 07 Mar 2016 11:29:11 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acy1r-0001VW-JO for submit@debbugs.gnu.org; Mon, 07 Mar 2016 11:29:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acy1n-0007ZG-07 for bug-guix@gnu.org; Mon, 07 Mar 2016 11:29:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acy1l-0001RT-Up for bug-guix@gnu.org; Mon, 07 Mar 2016 11:29:02 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acy1h-0001OS-Sj; Mon, 07 Mar 2016 11:28:57 -0500 Received: from pluto.bordeaux.inria.fr ([193.50.110.57]:56580 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1acy1d-0006bw-EE; Mon, 07 Mar 2016 11:28:53 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: bug-guix@gnu.org Subject: M-x guix-edit fails gracelessly when passed an nonexistent package name X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 18 =?utf-8?Q?Vent=C3=B4se?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 07 Mar 2016 17:28:48 +0100 Message-ID: <8737s2s14v.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Currently M-x guix-edit fails badly (actually =E2=80=98guix-package-locatio= n=E2=80=99) pwhen passed the name of a nonexistent package: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (error "Error in evaluating guile expression:= ERROR: In procedure car: ERROR: In procedure car: Wrong type (expecting pair): () Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [3]> ") signal(error ("Error in evaluating guile expression: ERROR: In procedure = car:\nERROR: In procedure car: Wrong type (expecting pair): ()\n\nEntering = a new prompt. Type `,bt' for a backtrace or `,q' to continue.\nscheme@(gui= le-user) [3]> ")) error("Error in evaluating guile expression: %s" "ERROR: In procedure car= :\nERROR: In procedure car: Wrong type (expecting pair): ()\n\nEntering a n= ew prompt. Type `,bt' for a backtrace or `,q' to continue.\nscheme@(guile-= user) [3]> ") (if (geiser-eval--retort-error res) (error "Error in evaluating guile exp= ression: %s" (geiser-eval--retort-output res)) (cdr (assq (quote result) re= s))) (let ((res (geiser-eval--send/wait (list (quote :eval) (list (quote :scm)= str))))) (if (geiser-eval--retort-error res) (error "Error in evaluating g= uile expression: %s" (geiser-eval--retort-output res)) (cdr (assq (quote re= sult) res)))) (save-current-buffer (set-buffer (or repl (guix-geiser-repl))) (let ((res= (geiser-eval--send/wait (list (quote :eval) (list (quote :scm) str))))) (i= f (geiser-eval--retort-error res) (error "Error in evaluating guile express= ion: %s" (geiser-eval--retort-output res)) (cdr (assq (quote result) res)))= )) guix-geiser-eval("(package-location-string \"foo\")" #) (car (guix-geiser-eval str repl)) (replace-regexp-in-string "#t" "t" (car (guix-geiser-eval str repl))) (replace-regexp-in-string "#f\\|#" "nil" (replace-regexp-in-= string "#t" "t" (car (guix-geiser-eval str repl)))) (read (replace-regexp-in-string "#f\\|#" "nil" (replace-rege= xp-in-string "#t" "t" (car (guix-geiser-eval str repl))))) guix-geiser-eval-read("(package-location-string \"foo\")" #) guix-eval-read("(package-location-string \"foo\")") guix-package-location("foo") eval((guix-package-location "foo") nil) eval-expression((guix-package-location "foo") nil) call-interactively(eval-expression nil nil) command-execute(eval-expression) --8<---------------cut here---------------end--------------->8--- I think this patch fixes it: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index 34da6ac..c5d5d75 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." (define (package-location-string id-or-name) "Return a location string of a package with ID-OR-NAME." - (and-let* ((package (or (package-by-id id-or-name) - (first (packages-by-name id-or-name)))) - (location (package-location package))) - (location->string location))) + (define package + (or (package-by-id id-or-name) + (match (packages-by-name id-or-name) + (() #f) + ((first . rest) first)))) + + (and package + (location->string (package-location package)))) (define (package-source-derivation->store-path derivation) "Return a store path of the package source DERIVATION." --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thoughts? Ludo=E2=80=99. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 14:58:33 2016 Received: (at 22933) by debbugs.gnu.org; 7 Mar 2016 19:58:33 +0000 Received: from localhost ([127.0.0.1]:38363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad1IX-0002M6-5S for submit@debbugs.gnu.org; Mon, 07 Mar 2016 14:58:33 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34980) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad1IV-0002Ls-SK for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 14:58:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ad1IP-00042M-Uu for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 14:58:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad1IJ-00041Y-Jg; Mon, 07 Mar 2016 14:58:19 -0500 Received: from mek33-4-82-236-46-88.fbx.proxad.net ([82.236.46.88]:41016 helo=godel) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ad1II-0001BQ-Q7; Mon, 07 Mar 2016 14:58:19 -0500 From: Mathieu Lirzin To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> Date: Mon, 07 Mar 2016 20:58:15 +0100 In-Reply-To: <8737s2s14v.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 07 Mar 2016 17:28:48 +0100") Message-ID: <87k2leawmg.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) ludo@gnu.org (Ludovic Court=C3=A8s) writes: > diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm > index 34da6ac..c5d5d75 100644 > --- a/emacs/guix-main.scm > +++ b/emacs/guix-main.scm > @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." >=20=20 > (define (package-location-string id-or-name) > "Return a location string of a package with ID-OR-NAME." > - (and-let* ((package (or (package-by-id id-or-name) > - (first (packages-by-name id-or-name)))) > - (location (package-location package))) > - (location->string location))) > + (define package > + (or (package-by-id id-or-name) > + (match (packages-by-name id-or-name) > + (() #f) > + ((first . rest) first)))) > + > + (and package > + (location->string (package-location package)))) Not related to the bug. but it feels weird to use internal defines for something else than a procedure. what about using (not tested): --8<---------------cut here---------------start------------->8--- (and=3D> (or (package-by-id id-or-name) (match (packages-by-name id-or-name) (() #f) ((pkg ..1) pkg))) (compose location->string package-location)) --8<---------------cut here---------------end--------------->8--- I know you love my 'pkg' identifier. ;) --=20 Mathieu Lirzin From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 16:04:05 2016 Received: (at 22933) by debbugs.gnu.org; 7 Mar 2016 21:04:06 +0000 Received: from localhost ([127.0.0.1]:38396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad2Jx-0003yq-Mu for submit@debbugs.gnu.org; Mon, 07 Mar 2016 16:04:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55658) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad2Jw-0003yM-12 for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 16:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ad2Jq-000571-8n for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 16:03:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad2Jk-000562-Ia; Mon, 07 Mar 2016 16:03:52 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:54816 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ad2Jj-0005zW-OH; Mon, 07 Mar 2016 16:03:52 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mathieu Lirzin Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 18 =?utf-8?Q?Vent=C3=B4se?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 07 Mar 2016 22:03:49 +0100 In-Reply-To: <87k2leawmg.fsf@gnu.org> (Mathieu Lirzin's message of "Mon, 07 Mar 2016 20:58:15 +0100") Message-ID: <874mci6lvu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mathieu Lirzin skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm >> index 34da6ac..c5d5d75 100644 >> --- a/emacs/guix-main.scm >> +++ b/emacs/guix-main.scm >> @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." >>=20=20 >> (define (package-location-string id-or-name) >> "Return a location string of a package with ID-OR-NAME." >> - (and-let* ((package (or (package-by-id id-or-name) >> - (first (packages-by-name id-or-name)))) >> - (location (package-location package))) >> - (location->string location))) >> + (define package >> + (or (package-by-id id-or-name) >> + (match (packages-by-name id-or-name) >> + (() #f) >> + ((first . rest) first)))) >> + >> + (and package >> + (location->string (package-location package)))) > > Not related to the bug. but it feels weird to use internal defines for > something else than a procedure. I don=E2=80=99t find it weird. :-) > what about using (not tested): > > (and=3D> (or (package-by-id id-or-name) > (match (packages-by-name id-or-name) > (() #f) > ((pkg ..1) pkg))) > (compose location->string package-location)) I like it too! > I know you love my 'pkg' identifier. ;) No I don=E2=80=99t! :-) I think we should stick to one identifier style, which is to always use full words (I=E2=80=99m often tempted to use abbreviations and I force myse= lf not to, as silly as I am!) Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 18:01:35 2016 Received: (at submit) by debbugs.gnu.org; 7 Mar 2016 23:01:35 +0000 Received: from localhost ([127.0.0.1]:38426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad49e-0006ir-V8 for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33927) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad49d-0006id-AS for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ad49X-0002DZ-4Z for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad49X-0002DP-2U for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad49W-00037u-6b for bug-guix@gnu.org; Mon, 07 Mar 2016 18:01:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ad49V-0002Ch-EG for bug-guix@gnu.org; Mon, 07 Mar 2016 18:01:26 -0500 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:35621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad49P-0002BV-K7; Mon, 07 Mar 2016 18:01:19 -0500 Received: by mail-lb0-x231.google.com with SMTP id bc4so148724374lbc.2; Mon, 07 Mar 2016 15:01:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=NL+4aNZ79s5+Q7rD2NkSfEDeLckMZgNyyemOecUrIs0=; b=H7wJW5ocBxtSG/3mV86UsFBz8CR3B2PDir/yPSeOE0Ald+OwEsRsbH4/HOTdeNUKUw KT57ZYhtCb2yk7dxyaGgAEK1AD1is0Ah+ajp5sSIRwv7Asc6ebcdeazi4VFCT5aHxmGm c4L2T9NI29FiB3zv4vRoyeBQgo/XVLXJAX8kzTGxQ9LC0+ZBk1X4MtkspmlxFgfLu+9c kBaiIfnpQQ0k+nwcsiOMZP1wIWEUQSkiOZMPpSXgmsVDt0v3eV/R7hzCQdDv03nKoJtK am0ZY+azQUlbj5wE5KMiYedfCmdpoUCW8qXey4XMdhLp9tRxKhQdb0Xh1+cw+4O4Huli s4nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=NL+4aNZ79s5+Q7rD2NkSfEDeLckMZgNyyemOecUrIs0=; b=meNaqjIQjSFyIFF5qkQcUWEtDJIqcq0q/6Q1YwYyMYc5SUVNtIxHScRdy5NXpASk0A RyalFyHM9wnM6MPHdrdAie6jNdpnTbR9aJf28AJlSy/eqQfxOJy4I1T4RQP/N02rocYa 4WWvg0TOqFF694+jayuVi6I2en4CnDO237Lu+1f8gdovXNh0FgGTgq2MCTt+nuQYyjpQ TqMRUcyec0IkD17GYP1yCwXPobw8JFb1Ijs55BKPcUy98vbBwB9tr2LCdcYSDcaAyrSE mew2587ip2vSHH2uyPmDr9Z6dieRdQ3QR/A4P3rZcfedyEuFvnhE53/0lc9G33fdc6AS WZ6A== X-Gm-Message-State: AD7BkJInUM9csjasyLEz6n+A7TT7+qOsqO1nE3wipamxlRlQYyxj/Z3zVGyW6NNVq28sIQ== X-Received: by 10.25.28.146 with SMTP id c140mr1731385lfc.89.1457391678516; Mon, 07 Mar 2016 15:01:18 -0800 (PST) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id e66sm3119271lfg.23.2016.03.07.15.01.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Mar 2016 15:01:17 -0800 (PST) From: Alex Kost To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> Date: Tue, 08 Mar 2016 02:01:29 +0300 In-Reply-To: <8737s2s14v.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 07 Mar 2016 17:28:48 +0100") Message-ID: <87d1r5lwom.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Mathieu Lirzin , bug-guix@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Ludovic Court=C3=A8s (2016-03-07 19:28 +0300) wrote: > Currently M-x guix-edit fails badly (actually =E2=80=98guix-package-locat= ion=E2=80=99) > pwhen passed the name of a nonexistent package: [...] > I think this patch fixes it: > > > diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm > index 34da6ac..c5d5d75 100644 > --- a/emacs/guix-main.scm > +++ b/emacs/guix-main.scm > @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." >=20=20 > (define (package-location-string id-or-name) > "Return a location string of a package with ID-OR-NAME." > - (and-let* ((package (or (package-by-id id-or-name) > - (first (packages-by-name id-or-name)))) > - (location (package-location package))) > - (location->string location))) > + (define package > + (or (package-by-id id-or-name) > + (match (packages-by-name id-or-name) > + (() #f) > + ((first . rest) first)))) > + > + (and package > + (location->string (package-location package)))) >=20=20 > (define (package-source-derivation->store-path derivation) > "Return a store path of the package source DERIVATION." > > Thoughts? Great! Thanks for fixing it! Feel free (you or Mathieu) to push any of your patches. --=20 Alex From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 18:01:53 2016 Received: (at 22933) by debbugs.gnu.org; 7 Mar 2016 23:01:53 +0000 Received: from localhost ([127.0.0.1]:38429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad49x-0006jL-6s for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:53 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36521) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad49w-0006j9-0r for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 18:01:52 -0500 Received: by mail-lb0-f182.google.com with SMTP id x1so148799657lbj.3 for <22933@debbugs.gnu.org>; Mon, 07 Mar 2016 15:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=C7si+GoIoavQzg5ALI5dVl9QbYf6dToU/VK8tv3F4Hs=; b=iP8UEEzUq1JhHqIxE9qLB9EMjj2T8rxLnrYuBCMFw1asVOZMcONp8vpoU4QKQ7rsDX p4EXJfXsvHSaJWwqaMQScKAhEC6K6gS6jC7TYycKRqlXrRcNu0BrNXWoLhPqwUsWQPCm SsMHD9T/0ScSP2JiORJKAHpJDUK5Ol/ZB6Mb7t+k0zvSTrSaNg3ZLeSh6pC4pvb6tx/i 55eAHv/SM6jmBShLxOvx5WzgZQYrpmRShjRipLPURjmdFsyt170ogIpHS4WWCVVrjreI pcylTTpHbE0jab8ERdrufMiggf91E9bIiIeSUrhFi6xfoDWtY65xDefKHlJLbc/g+A+s e1hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=C7si+GoIoavQzg5ALI5dVl9QbYf6dToU/VK8tv3F4Hs=; b=R2/qhI8CYOa1UGSa2goABF9OsJGnusuP7UH2g86lh2FQZLdcxvl1WI4yriNjGVyBwk Z79sPuWJMqc+TmUq/ZZFIUcX7e/9px8brFssYl3feWyM0u8lIaWELlWH7IU4Z46B+z2r i/7gcaisTWaaGsVcOfMQt5XPRg5NaNrUtAWOlBJGl7qEwklKvIc2mXLwTefZnWf2hYB+ 1WhRuq2iMMzwemkP5xfaGSpT71Lcsk/uIQ+R8mfN360aHXF85YBKjeehQGs39MrXf8T6 5ZcrD9QkvMz6k38SmUoiidJFIKjwB77o6c4te32+IpuDkPxRgD7bSMwQq0Fk2Jqs4ht9 mhxQ== X-Gm-Message-State: AD7BkJLI/WZEiESqNcrW2tcn1DmuSVQkoTe8w57K/ScrMxHBeuC1RcoylcXIfR52sQwg1g== X-Received: by 10.112.12.66 with SMTP id w2mr8767573lbb.97.1457391706273; Mon, 07 Mar 2016 15:01:46 -0800 (PST) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id xf10sm3128492lbb.23.2016.03.07.15.01.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Mar 2016 15:01:45 -0800 (PST) From: Alex Kost To: Mathieu Lirzin Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> Date: Tue, 08 Mar 2016 02:01:57 +0300 In-Reply-To: <87k2leawmg.fsf@gnu.org> (Mathieu Lirzin's message of "Mon, 07 Mar 2016 20:58:15 +0100") Message-ID: <87bn6plwnu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Mathieu Lirzin (2016-03-07 22:58 +0300) wrote: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm >> index 34da6ac..c5d5d75 100644 >> --- a/emacs/guix-main.scm >> +++ b/emacs/guix-main.scm >> @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." >>=20=20 >> (define (package-location-string id-or-name) >> "Return a location string of a package with ID-OR-NAME." >> - (and-let* ((package (or (package-by-id id-or-name) >> - (first (packages-by-name id-or-name)))) >> - (location (package-location package))) >> - (location->string location))) >> + (define package >> + (or (package-by-id id-or-name) >> + (match (packages-by-name id-or-name) >> + (() #f) >> + ((first . rest) first)))) >> + >> + (and package >> + (location->string (package-location package)))) > > Not related to the bug. but it feels weird to use internal defines for > something else than a procedure. I have the same feeling. > what about using (not tested): > > > (and=3D> (or (package-by-id id-or-name) > (match (packages-by-name id-or-name) > (() #f) > ((pkg ..1) pkg))) > (compose location->string package-location)) I like this variant! --=20 Alex From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 07 18:03:52 2016 Received: (at 22933) by debbugs.gnu.org; 7 Mar 2016 23:03:52 +0000 Received: from localhost ([127.0.0.1]:38434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad4Bs-0006mO-Jk for submit@debbugs.gnu.org; Mon, 07 Mar 2016 18:03:52 -0500 Received: from mail-lb0-f169.google.com ([209.85.217.169]:33185) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ad4Bq-0006mB-RM for 22933@debbugs.gnu.org; Mon, 07 Mar 2016 18:03:51 -0500 Received: by mail-lb0-f169.google.com with SMTP id k15so149064305lbg.0 for <22933@debbugs.gnu.org>; Mon, 07 Mar 2016 15:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=aHGmKZskiJhbGhn3n9rhiTbTBYpmOLolXYWIeIDU1xI=; b=zb3DxtFfZaPXCKj5ObTmY7+jXbSodf+FoVuFLPtguwF/yYuRx/WvxymDJ9TsQhJ1cx e1gebAKqOK+MpriJUAP20ezOdnoArecA/oKJXyDHUEBzN3NHrIo5yKLWSJ4luZmiFgM0 lNDd2pVHtd/dU6Ch7evSszj24bJg/ciIJi1FnQno4hPnIRt73m3vvOxS3RMEdjJaA4GK DGAeMwqAtjA5CH2P58nYfkyZn5u11oItLrdOSm+LGx3KpQeOHT+i4NmErLQP9tTY3lS2 sCI/FFHIDkAA6DnaT7j6ivVv/bLzJzlXBrkF9YV2EW4gBnuGJF//Gmgi2Va+Ovq0jb9m WCzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=aHGmKZskiJhbGhn3n9rhiTbTBYpmOLolXYWIeIDU1xI=; b=NLW9OdZseYp8/7MQRaOaMA80J3eb2m4CZEiEHgTjAuQEewLs6jC7dlLOCggAtggKh/ PismakOIGp5keidgyTAAXt+PRaJ7S5sOHd5h1vb6jvaF+TCmkfk0VmuVyymCdpUFxytu NIq1icKGPFib4neAM4HBXIp8cS9Mo7zYNDQ9T1N3I0Vx0d9HUgK7qjy8FJHLBjG4twUJ 8bdbXj0GMpgVe8XG8s4ufP4l4BSM2xOJfJbCsf5x1DTN20eU61OFbjvp8JoTCmT+kQbz sEroRlQ5Bob19sCcFNEFrI2TPjrfebXz8YgHSy2kPVnO03ykbrETt/0Sfm9CbsF4DKJv Vg3Q== X-Gm-Message-State: AD7BkJIuvJEnwI0zHVkqH23SEsUvF9q6iwr17bj/5tpVWRLy75FTezgVfqEEq51mpVuBqw== X-Received: by 10.112.173.71 with SMTP id bi7mr8485596lbc.93.1457391825265; Mon, 07 Mar 2016 15:03:45 -0800 (PST) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id n66sm471087lfb.33.2016.03.07.15.03.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Mar 2016 15:03:44 -0800 (PST) From: Alex Kost To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> <874mci6lvu.fsf@gnu.org> Date: Tue, 08 Mar 2016 02:03:56 +0300 In-Reply-To: <874mci6lvu.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 07 Mar 2016 22:03:49 +0100") Message-ID: <877fhdlwkj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Mathieu Lirzin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Ludovic Court=C3=A8s (2016-03-08 00:03 +0300) wrote: [...] >> what about using (not tested): >> >> (and=3D> (or (package-by-id id-or-name) >> (match (packages-by-name id-or-name) >> (() #f) >> ((pkg ..1) pkg))) >> (compose location->string package-location)) > > I like it too! > >> I know you love my 'pkg' identifier. ;) > > No I don=E2=80=99t! :-) > > I think we should stick to one identifier style, which is to always use > full words (I=E2=80=99m often tempted to use abbreviations and I force my= self > not to, as silly as I am!) Good to know, I always thought that things like "pkg" or "drv" are OK in a local scope. --=20 Alex From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 08 05:13:49 2016 Received: (at 22933) by debbugs.gnu.org; 8 Mar 2016 10:13:49 +0000 Received: from localhost ([127.0.0.1]:38640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adEeD-0007JZ-06 for submit@debbugs.gnu.org; Tue, 08 Mar 2016 05:13:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47499) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adEeB-0007JM-IH for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 05:13:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adEe3-0002pE-9a for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 05:13:42 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adEe3-0002p4-6I; Tue, 08 Mar 2016 05:13:39 -0500 Received: from pluto.bordeaux.inria.fr ([193.50.110.57]:36792 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1adEe2-0006vi-Hb; Tue, 08 Mar 2016 05:13:38 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Alex Kost Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> <874mci6lvu.fsf@gnu.org> <877fhdlwkj.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Vent=C3=B4se?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Tue, 08 Mar 2016 11:13:36 +0100 In-Reply-To: <877fhdlwkj.fsf@gmail.com> (Alex Kost's message of "Tue, 08 Mar 2016 02:03:56 +0300") Message-ID: <87vb4xmg4v.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Mathieu Lirzin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Alex Kost skribis: > Ludovic Court=C3=A8s (2016-03-08 00:03 +0300) wrote: > > [...] >>> what about using (not tested): >>> >>> (and=3D> (or (package-by-id id-or-name) >>> (match (packages-by-name id-or-name) >>> (() #f) >>> ((pkg ..1) pkg))) >>> (compose location->string package-location)) >> >> I like it too! >> >>> I know you love my 'pkg' identifier. ;) >> >> No I don=E2=80=99t! :-) >> >> I think we should stick to one identifier style, which is to always use >> full words (I=E2=80=99m often tempted to use abbreviations and I force m= yself >> not to, as silly as I am!) > > Good to know, I always thought that things like "pkg" or "drv" are OK in > a local scope. Well, ahem, =E2=80=98drv=E2=80=99 is an exception=E2=80=A6 Otherwise I think the rationale of the =E2=80=9CNaming=E2=80=9D section at is a good one. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 08 05:14:47 2016 Received: (at 22933-done) by debbugs.gnu.org; 8 Mar 2016 10:14:47 +0000 Received: from localhost ([127.0.0.1]:38644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adEf9-0007L9-C7 for submit@debbugs.gnu.org; Tue, 08 Mar 2016 05:14:47 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47697) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adEf7-0007Kx-Rf for 22933-done@debbugs.gnu.org; Tue, 08 Mar 2016 05:14:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adEf1-0002xN-US for 22933-done@debbugs.gnu.org; Tue, 08 Mar 2016 05:14:40 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adEey-0002wV-5t; Tue, 08 Mar 2016 05:14:36 -0500 Received: from pluto.bordeaux.inria.fr ([193.50.110.57]:36842 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1adEex-00070q-AX; Tue, 08 Mar 2016 05:14:35 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mathieu Lirzin Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Vent=C3=B4se?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Tue, 08 Mar 2016 11:14:33 +0100 In-Reply-To: <87k2leawmg.fsf@gnu.org> (Mathieu Lirzin's message of "Mon, 07 Mar 2016 20:58:15 +0100") Message-ID: <87r3flmg3a.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933-done Cc: 22933-done@debbugs.gnu.org, Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mathieu Lirzin skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm >> index 34da6ac..c5d5d75 100644 >> --- a/emacs/guix-main.scm >> +++ b/emacs/guix-main.scm >> @@ -954,10 +954,14 @@ GENERATIONS is a list of generation numbers." >>=20=20 >> (define (package-location-string id-or-name) >> "Return a location string of a package with ID-OR-NAME." >> - (and-let* ((package (or (package-by-id id-or-name) >> - (first (packages-by-name id-or-name)))) >> - (location (package-location package))) >> - (location->string location))) >> + (define package >> + (or (package-by-id id-or-name) >> + (match (packages-by-name id-or-name) >> + (() #f) >> + ((first . rest) first)))) >> + >> + (and package >> + (location->string (package-location package)))) > > Not related to the bug. but it feels weird to use internal defines for > something else than a procedure. > > what about using (not tested): > > (and=3D> (or (package-by-id id-or-name) > (match (packages-by-name id-or-name) > (() #f) > ((pkg ..1) pkg))) > (compose location->string package-location)) > > I know you love my 'pkg' identifier. ;) Fixed along these lines in commit 16f4acbddbb38275a52554caf693017465586ac6. (Note that ..1 matches a list of one or more element, not the first element of a list.) Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 08 09:38:18 2016 Received: (at 22933) by debbugs.gnu.org; 8 Mar 2016 14:38:18 +0000 Received: from localhost ([127.0.0.1]:38755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adIm9-0006bD-Ui for submit@debbugs.gnu.org; Tue, 08 Mar 2016 09:38:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50143) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adIm8-0006b2-RU for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 09:38:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adIlz-0000yf-Od for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 09:38:11 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adIls-0000rS-9e; Tue, 08 Mar 2016 09:38:00 -0500 Received: from mek33-4-82-236-46-88.fbx.proxad.net ([82.236.46.88]:51062 helo=godel) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1adIlr-0001OK-Lc; Tue, 08 Mar 2016 09:37:59 -0500 From: Mathieu Lirzin To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> <874mci6lvu.fsf@gnu.org> <877fhdlwkj.fsf@gmail.com> <87vb4xmg4v.fsf@gnu.org> Date: Tue, 08 Mar 2016 15:37:56 +0100 In-Reply-To: <87vb4xmg4v.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 08 Mar 2016 11:13:36 +0100") Message-ID: <87twkhdohn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Alex Kost skribis: > >> Ludovic Court=C3=A8s (2016-03-08 00:03 +0300) wrote: >>> >>> I think we should stick to one identifier style, which is to always use >>> full words (I=E2=80=99m often tempted to use abbreviations and I force = myself >>> not to, as silly as I am!) >> >> Good to know, I always thought that things like "pkg" or "drv" are OK in >> a local scope. > > Well, ahem, =E2=80=98drv=E2=80=99 is an exception=E2=80=A6 > > Otherwise I think the rationale of the =E2=80=9CNaming=E2=80=9D section at > is a good one. I totally agree with the suggestions made in this section. However these conventions don't talk about "bound variables" which is IMO a different context than the global name space. I used to think that full words everywhere were a good thing, by opposition of the unhelpful variables 'i' and 'x'. Nonetheless, with the experience (short I admit) I tend to think that an abbreviation is still helpful for bound variables because it helps distinguishing them from free variables. It is even more true when the meaning of this abbrevation is made explicit by the doc-string. --=20 Mathieu Lirzin From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 08 09:53:34 2016 Received: (at 22933) by debbugs.gnu.org; 8 Mar 2016 14:53:35 +0000 Received: from localhost ([127.0.0.1]:38779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adJ0w-0006ww-O9 for submit@debbugs.gnu.org; Tue, 08 Mar 2016 09:53:34 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54367) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adJ0u-0006wj-Rt for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 09:53:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adJ0l-0005um-PV for 22933@debbugs.gnu.org; Tue, 08 Mar 2016 09:53:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adJ0l-0005ui-Lm; Tue, 08 Mar 2016 09:53:23 -0500 Received: from pluto.bordeaux.inria.fr ([193.50.110.57]:51828 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1adJ0k-00039L-Uw; Tue, 08 Mar 2016 09:53:23 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mathieu Lirzin Subject: Re: bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name References: <8737s2s14v.fsf@gnu.org> <87k2leawmg.fsf@gnu.org> <874mci6lvu.fsf@gnu.org> <877fhdlwkj.fsf@gmail.com> <87vb4xmg4v.fsf@gnu.org> <87twkhdohn.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Vent=C3=B4se?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Tue, 08 Mar 2016 15:53:21 +0100 In-Reply-To: <87twkhdohn.fsf@gnu.org> (Mathieu Lirzin's message of "Tue, 08 Mar 2016 15:37:56 +0100") Message-ID: <87bn6pkom6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22933 Cc: 22933@debbugs.gnu.org, Alex Kost X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mathieu Lirzin skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Alex Kost skribis: >> >>> Ludovic Court=C3=A8s (2016-03-08 00:03 +0300) wrote: >>>> >>>> I think we should stick to one identifier style, which is to always use >>>> full words (I=E2=80=99m often tempted to use abbreviations and I force= myself >>>> not to, as silly as I am!) >>> >>> Good to know, I always thought that things like "pkg" or "drv" are OK in >>> a local scope. >> >> Well, ahem, =E2=80=98drv=E2=80=99 is an exception=E2=80=A6 >> >> Otherwise I think the rationale of the =E2=80=9CNaming=E2=80=9D section = at >> is a good one. > > I totally agree with the suggestions made in this section. However > these conventions don't talk about "bound variables" which is IMO a > different context than the global name space. > > I used to think that full words everywhere were a good thing, by > opposition of the unhelpful variables 'i' and 'x'. Nonetheless, with > the experience (short I admit) I tend to think that an abbreviation is > still helpful for bound variables because it helps distinguishing them > from free variables. It is even more true when the meaning of this > abbrevation is made explicit by the doc-string. Yeah I was thinking along these lines at some point (as is apparent in older parts of Guix ;-)), but my preference du jour is different. Anyway, we=E2=80=99ll see next time such an issue comes up! Ludo=E2=80=99. From unknown Sat Aug 16 20:57:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 06 Apr 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator