emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/zuul d58e139493 08/17: Update zuul-open-build-log imple


From: ELPA Syncer
Subject: [elpa] externals/zuul d58e139493 08/17: Update zuul-open-build-log implementation
Date: Tue, 30 Aug 2022 11:58:25 -0400 (EDT)

branch: externals/zuul
commit d58e13949308b0e96a7490963d3df7df2d1866d0
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Update zuul-open-build-log implementation
---
 README.md | 15 ++++++++-------
 notes.org |  4 ++--
 zuul.el   | 24 +++++++++++++++++++-----
 3 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md
index f4ec0f9baa..cc818129ef 100644
--- a/README.md
+++ b/README.md
@@ -38,18 +38,19 @@ The functions `zuul-get-builds` and `zuul-get-buildsets` 
needs to be called to r
 (zuul-get-builds :change "300203")
 ```
 
-A list of builds, or buildsets, can be passed as input to the 
`zuul-open-build-log` in order to view a specific build log.
+A query to retrieve builds or buildsets can be provided as input to the 
`zuul-open-build-log` in order to view a specific build log.
 
 ``` emacs-lisp
-;; For buildsets
+;; Query provided as a list
 (zuul-open-build-log
-   (zuul-get-buildsets
-    :change "300203"))
+ '(zuul-get-buildsets
+   :change "300203"))
 
-;; For builds
+;; Query provided as a function
 (zuul-open-build-log
-   (zuul-get-builds
-    :change "300203"))
+ (lambda ()
+   '(zuul-get-builds
+     :change "300203")))
 ```
 
 # Zuul log mode
diff --git a/notes.org b/notes.org
index 050c8e4478..9a96e4146c 100644
--- a/notes.org
+++ b/notes.org
@@ -92,7 +92,7 @@ Select and open a build retrieved with =zuul-get-builds=.
 
 #+begin_src elisp :results none
   (let ((zuul-build-display-buffer-action 'display-buffer-pop-up-window))
-    (zuul-open-build-log
+    (zuul--open-build-log
      (zuul-get-builds
       :change "300203")))
 #+end_src
@@ -101,7 +101,7 @@ Select and open a build retrieved with =zuul-get-buildsets=.
 
 #+begin_src elisp :results none
   (let ((zuul-build-display-buffer-action 'display-buffer-pop-up-window))
-    (zuul-open-build-log
+    (zuul--open-build-log
      (zuul-get-buildsets
       :change "300203")))
 #+end_src
diff --git a/zuul.el b/zuul.el
index c7d5a25ca2..2ff40ec697 100644
--- a/zuul.el
+++ b/zuul.el
@@ -274,7 +274,21 @@ Each entry in the list is a property list with the 
following properties:
   "Return BUILD's data."
   (zuul--build-data build))
 
-(defun zuul-open-build-log (builds-or-buildsets)
+(defun zuul-open-build-log (query)
+  "Open a build log based on QUERY.
+
+Query which can either be a list or a function returning a list.
+The content of the list should be the query function to use as well as
+the parameter to pass to it.  Examples of query functions are:
+- `zuul-get-buildsets'
+- `zuul-get-builds'"
+  (when-let ((builds-or-buildsets
+              (apply (if (functionp query)
+                         (funcall query)
+                       query))))
+    (zuul--open-build-log builds-or-buildsets)))
+
+(defun zuul--open-build-log (builds-or-buildsets)
   "Open a build log from an item in list BUILDS-OR-BUILDSETS."
   (when (or (and (listp builds-or-buildsets)
                  (or (zuul-buildset-p (seq-first builds-or-buildsets))
@@ -354,7 +368,7 @@ Optionally provide parameters CHANGE, PROJECT, PATCHSET and 
LIMIT."
   "Switch to another build."
   (interactive)
   (let ((zuul--builds zuul--current-builds))
-    (zuul-open-build-log
+    (zuul--open-build-log
      (zuul--builds zuul--current-build))))
 
 ;;;###autoload
@@ -362,7 +376,7 @@ Optionally provide parameters CHANGE, PROJECT, PATCHSET and 
LIMIT."
   "Switch to a build from a specific buildset."
   (interactive)
   (let ((zuul--builds zuul--current-builds))
-    (zuul-open-build-log
+    (zuul--open-build-log
      (zuul--buildsets zuul--current-build))))
 
 ;;;###autoload
@@ -398,7 +412,7 @@ Optionally provide parameters CHANGE, PROJECT, PATCHSET and 
LIMIT."
            (length builds-with-index)))
          (next-build
           (cdr (assoc next-index builds-with-index))))
-    (zuul-open-build-log next-build)))
+    (zuul--open-build-log next-build)))
 
 ;;;###autoload
 (defun zuul-previous-build ()
@@ -414,7 +428,7 @@ Optionally provide parameters CHANGE, PROJECT, PATCHSET and 
LIMIT."
            (length builds-with-index)))
          (previous-build
           (cdr (assoc previous-index builds-with-index))))
-    (zuul-open-build-log previous-build)))
+    (zuul--open-build-log previous-build)))
 
 ;;;###autoload
 (defun zuul-quit-build ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]