unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 09556bebd12f836fd090c69b03fb37fd9e9a8927 7107 bytes (raw)
name: emacs/guix-messages.el 	 # note: path name is non-authoritative(*)

  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
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 
;;; guix-messages.el --- Minibuffer messages

;; Copyright © 2014 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 `guix-result-message' function used to show a
;; minibuffer message after displaying packages/generations in a
;; list/info buffer.

;;; Code:

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

(defvar guix-messages
  `((package
     (id
      (0 "Packages not found.")
      (1 "")
      (many "%d packages." count))
     (name
      (0 "The package '%s' not found." val)
      (1 "A single package with name '%s'." val)
      (many "%d packages with '%s' name." count val))
     (regexp
      (0 "No packages matching '%s'." val)
      (1 "A single package matching '%s'." val)
      (many "%d packages matching '%s'." count val))
     (all-available
      (0 "No packages are available for some reason.")
      (1 "A single available package (that's strange).")
      (many "%d available packages." count))
     (newest-available
      (0 "No packages are available for some reason.")
      (1 "A single newest available package (that's strange).")
      (many "%d newest available packages." count))
     (installed
      (0 "No packages installed in profile '%s'." profile)
      (1 "A single package installed in profile '%s'." profile)
      (many "%d packages installed in profile '%s'." count profile))
     (obsolete
      (0 "No obsolete packages in profile '%s'." profile)
      (1 "A single obsolete package in profile '%s'." profile)
      (many "%d obsolete packages in profile '%s'." count profile))
     (generation
      (0 "No packages installed in generation %d of profile '%s'."
         val profile)
      (1 "A single package installed in generation %d of profile '%s'."
         val profile)
      (many "%d packages installed in generation %d of profile '%s'."
            count val profile)))

    (output
     (id
      (0 "Package outputs not found.")
      (1 "")
      (many "%d package outputs." count))
     (name
      (0 "The package output '%s' not found." val)
      (1 "A single package output with name '%s'." val)
      (many "%d package outputs with '%s' name." count val))
     (regexp
      (0 "No package outputs matching '%s'." val)
      (1 "A single package output matching '%s'." val)
      (many "%d package outputs matching '%s'." count val))
     (all-available
      (0 "No package outputs are available for some reason.")
      (1 "A single available package output (that's strange).")
      (many "%d available package outputs." count))
     (newest-available
      (0 "No package outputs are available for some reason.")
      (1 "A single newest available package output (that's strange).")
      (many "%d newest available package outputs." count))
     (installed
      (0 "No package outputs installed in profile '%s'." profile)
      (1 "A single package output installed in profile '%s'." profile)
      (many "%d package outputs installed in profile '%s'." count profile))
     (obsolete
      (0 "No obsolete package outputs in profile '%s'." profile)
      (1 "A single obsolete package output in profile '%s'." profile)
      (many "%d obsolete package outputs in profile '%s'." count profile))
     (generation
      (0 "No package outputs installed in generation %d of profile '%s'."
         val profile)
      (1 "A single package output installed in generation %d of profile '%s'."
         val profile)
      (many "%d package outputs installed in generation %d of profile '%s'."
            count val profile))
     (generation-diff
      (0 ,(lambda (profile entries vals)
            (message
             (concat "No additional packages in generation %d "
                     "comparing with generation %d of profile '%s'.")
             (car vals) (cadr vals) profile)))
      (1 ,(lambda (profile entries vals)
            (message
             (concat "A single additional package output in generation %d "
                     "comparing with generation %d of profile '%s'.")
             (car vals) (cadr vals) profile)))
      (many ,(lambda (profile entries vals)
               (message
                (concat "%d additional package outputs in generation %d "
                        "comparing with generation %d of profile '%s'.")
                (length entries) (car vals) (cadr vals) profile)))))

    (generation
     (id
      (0 "Generations not found.")
      (1 "")
      (many "%d generations." count))
     (last
      (0 "No generations in profile '%s'." profile)
      (1 "The last generation of profile '%s'." profile)
      (many "%d last generations of profile '%s'." count profile))
     (all
      (0 "No generations in profile '%s'." profile)
      (1 "A single generation available in profile '%s'." profile)
      (many "%d generations available in profile '%s'." count profile))
     (time
      (0 "Generations not found.")
      (1 ,(lambda (profile entries vals)
            (let ((beg (guix-get-time-string (car vals)))
                  (end (guix-get-time-string (cadr vals))))
              (message (concat "A single generation of profile '%s' "
                               "matching time period '%s'/'%s'.")
                       profile beg end))))
      (many ,(lambda (profile entries vals)
               (let ((beg (guix-get-time-string (car vals)))
                     (end (guix-get-time-string (cadr vals))))
                 (message (concat "%d generations of profile '%s' "
                                  "matching time period '%s'/'%s'.")
                          (length entries) profile beg end))))))))

(defun guix-result-message (profile entries entry-type
                            search-type search-vals)
  "Display an appropriate message after displaying ENTRIES."
  (let* ((count (length entries))
         (count-key (if (> count 1) 'many count))
         (msg-spec (guix-get-key-val guix-messages
                                     entry-type search-type count-key))
         (fun-or-msg (car msg-spec)))
    (if (functionp fun-or-msg)
        (funcall fun-or-msg profile entries search-vals)
      (let ((args (cdr msg-spec)))
        (mapc (lambda (subst)
                (setq args (cl-substitute (cdr subst) (car subst) args)))
              `((count   . ,count)
                (val     . ,(car search-vals))
                (profile . ,profile)))
        (apply #'message fun-or-msg args)))))

(provide 'guix-messages)

;;; guix-messages.el ends here

debug log:

solving 09556be ...
found 09556be in https://yhetil.org/guix-devel/87bnopu9te.fsf@gmail.com/ ||
	https://yhetil.org/guix-devel/8761exteu3.fsf@gmail.com/
found c77b5c0 in https://yhetil.org/guix-devel/87d295u9tn.fsf@gmail.com/

applying [1/2] https://yhetil.org/guix-devel/87d295u9tn.fsf@gmail.com/
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
new file mode 100644
index 0000000..c77b5c0


applying [2/2] https://yhetil.org/guix-devel/87bnopu9te.fsf@gmail.com/
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index c77b5c0..09556be 100644

Checking patch emacs/guix-messages.el...
Applied patch emacs/guix-messages.el cleanly.
Checking patch emacs/guix-messages.el...
Applied patch emacs/guix-messages.el cleanly.

skipping https://yhetil.org/guix-devel/8761exteu3.fsf@gmail.com/ for 09556be
index at:
100644 09556bebd12f836fd090c69b03fb37fd9e9a8927	emacs/guix-messages.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).