unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sarah Morgensen <iskarian@mgsn.dev>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 49181@debbugs.gnu.org, carlo@zancanaro.id.au
Subject: [bug#49181] Fix missing phases in Emacs builds
Date: Fri, 23 Jul 2021 14:32:08 -0700	[thread overview]
Message-ID: <867dhgra1z.fsf_-_@mgsn.dev> (raw)
In-Reply-To: <20210623072509.7165-2-leo.prikler@student.tugraz.at> (Leo Prikler's message of "Wed, 23 Jun 2021 09:25:10 +0200")

Hi!

I'm glad to see this.  This behavior has caught me up a number of times
recently.

Leo Prikler <leo.prikler@student.tugraz.at> writes:

[...]

 @@ -571,18 +572,22 @@ effects, such as displaying warnings or error messages."
>  (define* (alist-cons-before reference key value alist
>                              #:optional (key=? equal?))
>    "Insert the KEY/VALUE pair before the first occurrence of a pair whose key
> -is REFERENCE in ALIST.  Use KEY=? to compare keys."
> +is REFERENCE in ALIST.  Use KEY=? to compare keys.  An error is raised when no
> +such pair exists."
>    (let-values (((before after)
>                  (break (match-lambda
>                          ((k . _)
>                           (key=? k reference)))
>                         alist)))
> -    (append before (alist-cons key value after))))
> +    (match after
> +      ((reference after ...)
> +       (append before (alist-cons key value (cons reference after)))))))

This can probably just be (untested):

      ((reference after* ...)
       (append before (alist-cons key value after))))))

Or if we want to avoid extraneous bindings completely (also untested):

      ((_ _ ...)
       (append before (alist-cons key value after))))))

>  
>  (define* (alist-cons-after reference key value alist
>                             #:optional (key=? equal?))
>    "Insert the KEY/VALUE pair after the first occurrence of a pair whose key
> -is REFERENCE in ALIST.  Use KEY=? to compare keys."
> +is REFERENCE in ALIST.  Use KEY=? to compare keys.  An error is raised when
> +no such pair exists."
>    (let-values (((before after)
>                  (break (match-lambda
>                          ((k . _)
> @@ -590,9 +595,7 @@ is REFERENCE in ALIST.  Use KEY=? to compare keys."
>                         alist)))
>      (match after
>        ((reference after ...)
> -       (append before (cons* reference `(,key . ,value) after)))
> -      (()
> -       (append before `((,key . ,value)))))))
> +       (append before (cons* reference `(,key . ,value) after))))))
>  
>  (define* (alist-replace key value alist #:optional (key=? equal?))
>    "Replace the first pair in ALIST whose car is KEY with the KEY/VALUE pair.

Other than that it looks good to me. Pushing this should also close #32661.

This should be a patch for core-updates, though, since it changes
derivations for any package that (directly or indirectly) uses
ALIST-CONS-BEFORE or ALIST-CONS-AFTER.

--
Sarah




  reply	other threads:[~2021-07-23 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  6:45 [bug#49181] Fix missing phases in Emacs builds Carlo Zancanaro
2021-06-23  7:25 ` [bug#49181] [PATCH 0/1] modify-phases: error when encountering missing phase (was: Fix missing phases in Emacs builds) Leo Prikler
2021-06-23  7:25   ` [bug#49181] [PATCH 1/1] guix: Make modify-phases error when adding before/after a missing phase Leo Prikler
2021-07-23 21:32     ` Sarah Morgensen [this message]
2021-11-02 22:58     ` Carlo Zancanaro
2023-03-29  2:18       ` [bug#49181] Fix missing phases in Emacs builds Maxim Cournoyer
2023-05-20 13:13         ` Carlo Zancanaro
2023-05-20 13:05 ` [bug#49181] [PATCH core-updates v2] guix: Make modify-phases error when adding before/after a missing phase Carlo Zancanaro
2023-10-10  0:50   ` Carlo Zancanaro
2023-10-10  3:37   ` bug#49181: " Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867dhgra1z.fsf_-_@mgsn.dev \
    --to=iskarian@mgsn.dev \
    --cc=49181@debbugs.gnu.org \
    --cc=carlo@zancanaro.id.au \
    --cc=leo.prikler@student.tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).