aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-entry.el
blob: 5eed2ed0155a09bcc1d02e5edc466d7920a73fd7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;; guix-entry.el --- 'Entry' type  -*- lexical-binding: t -*-

;; Copyright © 2015 Alex Kost <alezost@gmail.com>

;; This file is part of GNU Guix.

;; GNU Guix is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Guix is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This file provides an API for 'entry' type which is just an alist of
;; KEY/VALUE pairs (KEY should be a symbol) with the required 'id' KEY.

;;; Code:

(require 'cl-lib)
(require 'guix-utils)

(defalias 'guix-entry-value #'guix-assq-value)

(defun guix-entry-id (entry)
  "Return ENTRY ID."
  (guix-entry-value entry 'id))

(defun guix-entry-by-id (id entries)
  "Return an entry from ENTRIES by its ID."
  (cl-find-if (lambda (entry)
                (equal (guix-entry-id entry) id))
              entries))

(defun guix-entries-by-ids (ids entries)
  "Return entries with IDS (a list of identifiers) from ENTRIES."
  (cl-remove-if-not (lambda (entry)
                      (member (guix-entry-id entry) ids))
                    entries))

(defun guix-replace-entry (id new-entry entries)
  "Replace an entry with ID from ENTRIES by NEW-ENTRY.
Return a list of entries with the replaced entry."
  (cl-substitute-if new-entry
                    (lambda (entry)
                      (equal id (guix-entry-id entry)))
                    entries
                    :count 1))

(provide 'guix-entry)

;;; guix-entry.el ends here
/tr> 2022-08-05.git-authorizations: Authorize Andrew Tropin....Efraim Flashner 2022-01-25.guix-authorizations: Authorize Vinicius Monego....Maxim Cournoyer 2022-01-03.guix-authorizations: Remove Giovanni Biscuolo due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Caleb Ristvedt due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Manolis Fragkiskos Ragkousis due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Miguel Ángel Arruga Vivas due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Brian Leung due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Ivan Petkov due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove David Wilson due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Brett Gilio due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Amin Bandali due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Alex Sassmannshausen due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Alex Griffin due to inactivity....Leo Famulari 2022-01-03.guix-authorizations: Remove Gábor Boskovits due to inactivity....Leo Famulari 2021-09-06.guix-authorizations: Rename leoprikler to lilyp....Liliana Marie Prikler 2021-06-30.guix-authorizations: Remove kkebreau....Kei Kebreau 2021-06-23.guix-authorizations: Update bavier's key....Ludovic Courtès 2021-04-28.guix-authorizations: Remove lle_bout....Marius Bakke 2021-04-11.guix-authorizations: Add raghavgururajan....Tobias Geerinckx-Rice 2021-04-09Revert ".guix-authorizations: Remove biscuolo due to inactivity."...Leo Famulari 2021-04-07.guix-authorizations: Remove biscuolo due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove wingo due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove sleep_walker due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove rhelling due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove lsl88 due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove benwoodcroft due to inactivity....Leo Famulari 2021-04-07.guix-authorizations: Remove alexvong1995 due to inactivity....Leo Famulari 2021-04-06.guix-authorizations: Remove taylanub....Leo Famulari 2021-04-06.guix-authorizations: Remove thomasd....Leo Famulari 2021-03-08.guix-authorizations: Add lbraun....Leo Famulari 2021-02-18.guix-authorizations: Add lle_bout....Tobias Geerinckx-Rice 2020-12-28.guix-authorizations: Add leoprikler....Ludovic Courtès 2020-11-15.guix-authorizations: Add jonsger....Marius Bakke 2020-10-16.guix-authorizations: Add m1gu3l....Ludovic Courtès 2020-09-04.guix-authorizations: Add planglois to the committers....Ludovic Courtès