[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 30498ef453 01/15: Tidy: Simplify pcase map dest
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 30498ef453 01/15: Tidy: Simplify pcase map destructuring |
Date: |
Fri, 1 Dec 2023 04:00:23 -0500 (EST) |
branch: elpa/hyperdrive
commit 30498ef45361eb1daa15add18bc1fd3f81b20932
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Tidy: Simplify pcase map destructuring
This works with Emacs 28.1+.
---
hyperdrive-dir.el | 2 +-
hyperdrive-history.el | 6 +++---
hyperdrive-lib.el | 17 ++++++++---------
tests/test-hyperdrive-org.el | 2 +-
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 049f579b9b..63aadf7a56 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -128,7 +128,7 @@ Columns are suffixed with up/down arrows according to
(arrow (propertize (if (eq direction :ascending) "^" "v")
'face 'h/header-arrow))
(headers))
- (pcase-dolist (`(,column . ,(map (:desc desc))) h/dir-sort-fields)
+ (pcase-dolist (`(,column . ,(map :desc)) h/dir-sort-fields)
(let* ((selected (eq column sort-column))
;; Put the arrow after desc, since the column is left-aligned.
(left-aligned (eq column 'name))
diff --git a/hyperdrive-history.el b/hyperdrive-history.el
index 396dfe8c42..461e098135 100644
--- a/hyperdrive-history.el
+++ b/hyperdrive-history.el
@@ -52,7 +52,7 @@ RANGE-ENTRY is a cons cell whose car is a range according to
value \\+`unknown', and whose cdr is a hyperdrive entry."
(pcase-let*
((`(,range . ,entry) range-entry)
- (`(,range-start . ,(map (:range-end range-end) (:existsp existsp)))
range)
+ (`(,range-start . ,(map :range-end :existsp)) range)
((cl-struct hyperdrive-entry size mtime) entry)
(formatted-range (if (eq range-start range-end)
(format "%d" range-start)
@@ -116,7 +116,7 @@ and ENTRY's version are nil."
- nil :: ENTRY is known to not exist.
- unknown :: ENTRY is not known to exist."
(pcase-let* ((range (car range-entry))
- ((map (:existsp existsp)) (cdr range)))
+ ((map :existsp) (cdr range)))
existsp))
(defun h/history-revert-buffer (&optional _ignore-auto _noconfirm)
@@ -238,7 +238,7 @@ prefix argument \\[universal-argument], prompt for ENTRY."
"Fill version ranges starting from RANGE-ENTRY at point."
(interactive (list (h/history-range-entry-at-point)))
(pcase-let* ((`(,range . ,entry) range-entry)
- (`(,_range-start . ,(map (:range-end range-end))) range)
+ (`(,_range-start . ,(map :range-end)) range)
(range-end-entry (h/copy-tree entry))
(ov (make-overlay (pos-bol) (+ (pos-bol) (length "Loading")))))
(setf (he/version range-end-entry) range-end)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 36a30f0067..580bd12824 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -135,7 +135,7 @@ generated from PATH."
"Return ENTRIES sorted by DIRECTION.
See `hyperdrive-directory-sort' for the type of DIRECTION."
(pcase-let* ((`(,column . ,direction) direction)
- ((map (:accessor accessor) (direction sort-function))
+ ((map :accessor (direction sort-function))
(alist-get column h/dir-sort-fields)))
(cl-sort entries (lambda (a b)
(cond ((and a b) (funcall sort-function a b))
@@ -339,7 +339,7 @@ With non-nil VERSION, use it instead of ENTRY's version."
(version (or version entry-version (h/latest-version hyperdrive)))
(ranges (he/version-ranges entry)))
(and ranges
- (cl-find-if (pcase-lambda (`(,range-start . ,(map (:range-end
range-end))))
+ (cl-find-if (pcase-lambda (`(,range-start . ,(map :range-end)))
(<= range-start version range-end))
ranges))))
@@ -354,7 +354,7 @@ Does not make a request to the gateway; checks the cached
value
in `hyperdrive-version-ranges'.
With non-nil VERSION, use it instead of ENTRY's version."
(if-let ((range (he/version-range entry :version version)))
- (pcase-let ((`(,_range-start . ,(map (:existsp existsp))) range))
+ (pcase-let ((`(,_range-start . ,(map :existsp)) range))
existsp)
'unknown))
@@ -371,8 +371,7 @@ When the final range's range-end is less than ENTRY's
hyperdrive's latest-version slot, the final gap is filled."
(let ((ranges '())
(previous-range-end 0))
- (pcase-dolist (`(,range-start . ,(map (:range-end range-end)
- (:existsp existsp)))
+ (pcase-dolist (`(,range-start . ,(map :range-end :existsp))
(he/version-ranges entry))
;; If he/version-ranges returns nil, this whole loop will be skipped.
(let ((next-range-start (1+ previous-range-end)))
@@ -412,7 +411,7 @@ be \\+`unknown'."
:version (1- version))))
(let ((previous-version (1- (car (he/version-range entry)))))
(pcase-exhaustive (he/version-range entry :version previous-version)
- (`(,range-start . ,(map (:existsp existsp)))
+ (`(,range-start . ,(map :existsp))
(if existsp
;; Return entry if it's known existent.
(he/at range-start entry)
@@ -477,7 +476,7 @@ Sends a request to the gateway for hyperdrive's latest
version."
(cl-return-from he/next next-entry))
;; ENTRY is a file...
- (pcase-let* ((`(,_range-start . ,(map (:range-end range-end)))
+ (pcase-let* ((`(,_range-start . ,(map :range-end))
(he/version-range entry))
(next-range-start (1+ range-end))
((map (:existsp next-range-existsp)
@@ -847,7 +846,7 @@ Once all requests return, call FINALLY with no arguments."
:as 'response
:then (pcase-lambda ((cl-struct plz-response (headers (map
etag))))
(pcase-let* ((range-start (string-to-number etag))
- ((map (:existsp existsp)) (map-elt
copy-entry-version-ranges range-start)))
+ ((map :existsp) (map-elt
copy-entry-version-ranges range-start)))
(when (eq 'unknown existsp)
;; Stop if the requested entry has a
;; range-start that was already known
@@ -871,7 +870,7 @@ Once all requests return, call FINALLY with no arguments."
:as 'response
:then (pcase-lambda ((cl-struct plz-response (headers (map
etag))))
(pcase-let* ((range-start (string-to-number etag))
- ((map (:existsp existsp))
+ ((map :existsp)
(map-elt (he/version-ranges copy-entry)
range-start)))
(h/update-existent-version-range copy-entry
range-start)
(if (eq 't existsp)
diff --git a/tests/test-hyperdrive-org.el b/tests/test-hyperdrive-org.el
index 60326df6a3..426168d4ba 100644
--- a/tests/test-hyperdrive-org.el
+++ b/tests/test-hyperdrive-org.el
@@ -147,7 +147,7 @@ variables and the expected link."
(let ((scenario (intern (string-trim-right (symbol-name name)
(rx "/" (1+ anything) eos))))
body-forms)
- (pcase-dolist ((map (:let vars) (:result result)) results)
+ (pcase-dolist ((map (:let vars) :result) results)
(let* ((olfpt (cadadr (assoc 'org-link-file-path-type vars)))
(test-name (intern (format "hyperdrive-test-org-insert-link/%s/%s"
name olfpt))))
- [nongnu] elpa/hyperdrive updated (cc4f2caddc -> ef809136c4), ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 30498ef453 01/15: Tidy: Simplify pcase map destructuring,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 3e7f4793b2 02/15: LIMERICK: Use verse, not example, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive fd97b5f9c4 04/15: Docs: Formatting, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive eabf315f15 05/15: Docs: Use "Command:" syntax for hyperdrive-menu, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 72d30b23dc 09/15: Docs: Add more internal links, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 6bc6101136 06/15: Docs: Use "Command:" syntax for h/{open-url, find-file, view-file}, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 2eb70dec5e 11/15: Docs: Improve documentation for creating drive and saving files, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 3e5bc83220 13/15: Docs: Improve documentation for deleting files, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive ef809136c4 15/15: Docs: Improve documentation for history view, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 626b8bd3a5 12/15: Docs: Improve documentation for links, ELPA Syncer, 2023/12/01
- [nongnu] elpa/hyperdrive 9c29d67158 10/15: Docs: Document hyperdrive-info-manual, ELPA Syncer, 2023/12/01