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

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

[nongnu] elpa/hyperdrive d7ad2d87e2 02/13: Change: (hyperdrive-mirror) A


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive d7ad2d87e2 02/13: Change: (hyperdrive-mirror) Add faces for each status
Date: Fri, 8 Sep 2023 19:00:08 -0400 (EDT)

branch: elpa/hyperdrive
commit d7ad2d87e240d29ec1c205899798dd31da2b870e
Author: Joseph Turner <joseph@ushin.org>
Commit: Adam Porter <adam@alphapapa.net>

    Change: (hyperdrive-mirror) Add faces for each status
    
    This requires using string-match-p to match status since the string is
    padded with whitespace.
---
 hyperdrive-mirror.el | 38 ++++++++++++++++++++++----------------
 hyperdrive-vars.el   | 12 ++++++++++++
 2 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/hyperdrive-mirror.el b/hyperdrive-mirror.el
index dcc54da5fa..a4f63355bf 100644
--- a/hyperdrive-mirror.el
+++ b/hyperdrive-mirror.el
@@ -49,7 +49,7 @@ uploading files, open PARENT-ENTRY."
   (let* ((count 0)
          (upload-files-and-urls (cl-remove-if (pcase-lambda (`(,_id [,status 
,_file ,_url]))
                                                 ;; Exclude files which have 
not been changed.
-                                                (equal status "same"))
+                                                (string-match-p "same" status))
                                               files-and-urls))
          (progress-reporter
           (make-progress-reporter (format "Uploading %s files: " (length 
upload-files-and-urls)) 0 (length upload-files-and-urls)))
@@ -140,21 +140,27 @@ predicate and set NO-CONFIRM to t."
                                    :hyperdrive hyperdrive
                                    :path (expand-file-name (file-relative-name 
file source) target-dir)
                                    :encode t))
-                           (status (condition-case err
-                                       (if (time-less-p 
(hyperdrive-entry-modified (hyperdrive-fill entry :then 'sync))
-                                                        
(file-attribute-modification-time (file-attributes file)))
-                                           ;; TODO: Propertize status strings.
-                                           "changed"
-                                         "same")
-                                     (plz-error
-                                      (pcase (caddr err)
-                                        ((app plz-error-response (cl-struct 
plz-response (status 404) body))
-                                         ;; Entry doesn't exist: Set `status' 
to `new'.
-                                         
(hyperdrive-update-nonexistent-version-range entry)
-                                         "new")
-                                        (_
-                                         ;; Re-signal error.
-                                         (signal (car err) (cdr err)))))))
+                           (status-no-properties
+                            (condition-case err
+                                (if (time-less-p (hyperdrive-entry-modified 
(hyperdrive-fill entry :then 'sync))
+                                                 
(file-attribute-modification-time (file-attributes file)))
+                                    "changed"
+                                  "same")
+                              (plz-error
+                               (pcase (caddr err)
+                                 ((app plz-error-response (cl-struct 
plz-response (status 404) body))
+                                  ;; Entry doesn't exist: Set `status' to 
`new'.
+                                  (hyperdrive-update-nonexistent-version-range 
entry)
+                                  "new")
+                                 (_
+                                  ;; Re-signal error.
+                                  (signal (car err) (cdr err)))))))
+                           (status
+                            (propertize (format "%-7s" status-no-properties)
+                                        'face (pcase-exhaustive 
status-no-properties
+                                                ("new" 'hyperdrive-mirror-new)
+                                                ("changed" 
'hyperdrive-mirror-changed)
+                                                ("same" 
'hyperdrive-mirror-same))))
                            (url (hyperdrive-entry-url entry)))
                       (list url (vector status file url))))
                   files)))
diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index 4cf376c1ef..9c12b85be8 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -218,6 +218,18 @@ an existing buffer at the same version, or make a new 
buffer."
 (defface hyperdrive-history-unknown '((t (:foreground "black" :background 
"yellow")))
   "Marker for entries with unknown existence in `hyperdrive-history' buffers.")
 
+(defface hyperdrive-mirror-new '((t (:foreground "black" :background "green")))
+  "Face for files with \"new\" status in `hyperdrive-mirror' buffers."
+  :group 'hyperdrive-faces)
+
+(defface hyperdrive-mirror-same '((t (:foreground "black" :background "red")))
+  "Face for files with \"same\" status in `hyperdrive-mirror' buffers."
+  :group 'hyperdrive-faces)
+
+(defface hyperdrive-mirror-changed '((t (:foreground "black" :background 
"yellow")))
+  "Face for files with \"changed\" status in `hyperdrive-mirror' buffers."
+  :group 'hyperdrive-faces)
+
 (defface hyperdrive-button
   ;; Inspired by cus-edit.el's `custom-button' face.
   ;; NOTE: This face is not currently used, but



reply via email to

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