branch: elpa/hyperdrive
commit f22465e9f7cf02f41db3f4dff1aa9a7947323de8
Author: Joseph Turner <[email protected]>
Commit: Joseph Turner <[email protected]>
Tidy: Replace obsolete when-let with when-let* and and-let
---
hyperdrive-dir.el | 6 +++---
hyperdrive-history.el | 6 +++---
hyperdrive-lib.el | 14 +++++++-------
hyperdrive-mirror.el | 4 ++--
hyperdrive-org.el | 4 ++--
hyperdrive-peer-graph.el | 6 +++---
hyperdrive-sbb.el | 18 +++++++++---------
hyperdrive.el | 2 +-
8 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 0a57dce696..229c8c1d49 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -53,9 +53,9 @@ If THEN, call it in the directory buffer with no arguments."
(ewoc-filter h/ewoc #'ignore)
(ewoc-set-hf h/ewoc header "Loading...")))
(cl-labels ((goto-entry (entry ewoc)
- (when-let ((node (h/ewoc-find-node ewoc entry
- :predicate #'he/equal-p)))
- (goto-char (ewoc-location node)))))
+ (and-let ((node (h/ewoc-find-node ewoc entry
+ :predicate #'he/equal-p)))
+ (goto-char (ewoc-location node)))))
(he/api 'get directory-entry :noquery t
;; Get "full" listing with metadata
:headers `(("Accept" . "application/json; metadata=full"))
diff --git a/hyperdrive-history.el b/hyperdrive-history.el
index becc7bbe87..8d03ff86ca 100644
--- a/hyperdrive-history.el
+++ b/hyperdrive-history.el
@@ -73,8 +73,8 @@ Updates `hyperdrive-existent-versions' as a side effect."
(map-elt (map-elt value 'blob) 'blockLength))
(setf (map-elt (he/etc history-entry) 'block-length-downloaded)
blockLengthDownloaded)
- (when-let ((mtime
- (map-elt (map-elt value 'metadata) 'mtime)))
+ (when-let* ((mtime
+ (map-elt (map-elt value 'metadata) 'mtime)))
(setf (he/mtime history-entry)
(seconds-to-time (/ mtime 1000.0))))
(setf (map-elt (he/etc history-entry) 'next-version-number)
@@ -178,7 +178,7 @@ error. With non-nil NO-ERROR, return nil in that case."
(let ((copy-entry (compat-call copy-tree h/history-current-entry
t)))
(setf (map-elt (he/etc copy-entry) 'next-version-number) nil)
(setf (he/version copy-entry) nil)
- (when-let ((first-node (ewoc-nth h/ewoc 0)))
+ (when-let* ((first-node (ewoc-nth h/ewoc 0)))
(setf (map-elt (he/etc copy-entry) 'existsp)
(map-elt (he/etc (ewoc-data first-node)) 'existsp)))
copy-entry))
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index cb0f326d5b..e0ae8ee594 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -362,14 +362,14 @@ it exists. Persists ENTRY's hyperdrive. Invalidates
ENTRY display."
(when etag
(h/update-existent-versions
(he/hyperdrive entry) (he/path entry) (json-parse-string etag)))
- (when-let (((string-equal "true" x-next-version-exists))
- (next-version-number
- (json-parse-string x-next-version-number :null-object nil)))
+ (when-let* (((string-equal "true" x-next-version-exists))
+ (next-version-number
+ (json-parse-string x-next-version-number :null-object nil)))
(h/update-existent-versions
(he/hyperdrive entry) (he/path entry) next-version-number))
- (when-let (((string-equal "true" x-previous-version-exists))
- (previous-version-number
- (json-parse-string x-previous-version-number)))
+ (when-let* (((string-equal "true" x-previous-version-exists))
+ (previous-version-number
+ (json-parse-string x-previous-version-number)))
(h/update-existent-versions
(he/hyperdrive entry) (he/path entry) previous-version-number)))
@@ -1488,7 +1488,7 @@ version."
"Return `hyperdrive' at point, optionally given EVENT."
(unless (listp event) ;; Avoid errors.
(cl-return-from h/at-point))
- (when-let (hyperdrive (get-text-property (point) 'hyperdrive))
+ (when-let* (hyperdrive (get-text-property (point) 'hyperdrive))
(cl-return-from h/at-point hyperdrive))
(pcase (cadadr event) ;; Image id from peer graph image map
((and (rx (group (= 52 alphanumeric))) public-key)
diff --git a/hyperdrive-mirror.el b/hyperdrive-mirror.el
index a7eea85bac..b74ebbadc6 100644
--- a/hyperdrive-mirror.el
+++ b/hyperdrive-mirror.el
@@ -297,7 +297,7 @@ Callback for queue finalizer in `hyperdrive-mirror'."
files-and-urls
:key #'h/mirror-item-status)))
(setq-local h/mirror-files-and-urls files-and-urls)
- (when-let ((window (get-buffer-window (current-buffer))))
+ (when-let* ((window (get-buffer-window (current-buffer))))
(setf window-point (window-point window))
(setf window-start (window-start window)))
(when h/mirror-visibility-cache
@@ -313,7 +313,7 @@ Callback for queue finalizer in `hyperdrive-mirror'."
(section (magit-get-section section-ident)))
(goto-char (oref section start))
(goto-char pos))
- (when-let ((window (get-buffer-window (current-buffer))))
+ (when-let* ((window (get-buffer-window (current-buffer))))
(set-window-start window window-start)
(set-window-point window window-point))))
(set-buffer-modified-p nil)))
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index c50fe99acb..a5106920a4 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -121,8 +121,8 @@ TARGET may be a CUSTOM_ID or a headline."
Added to `org-open-at-point-functions' in order to short-circuit
the logic for handling links of \"file\" type."
- (when-let ((h/mode)
- (link (h/org--link-entry-at-point)))
+ (when-let* ((h/mode)
+ (link (h/org--link-entry-at-point)))
(h/open link)))
(defun h/org--link-entry-at-point ()
diff --git a/hyperdrive-peer-graph.el b/hyperdrive-peer-graph.el
index 3463179ceb..c2392dbd08 100644
--- a/hyperdrive-peer-graph.el
+++ b/hyperdrive-peer-graph.el
@@ -119,7 +119,7 @@ If data for HYPERDRIVE is already in
`hyperdrive-peer-graph-data-cache', use it and send no request."
(declare (indent defun))
;; TODO: Add a queue limit.
- (when-let ((data (gethash (h/public-key hyperdrive) hpg/data-cache)))
+ (when-let* ((data (gethash (h/public-key hyperdrive) hpg/data-cache)))
;; TODO: The first time a drive is requested, only request and parse once.
(cl-return-from hpg/data
(pcase then
@@ -617,7 +617,7 @@ Non-nil value may be the number of seconds to wait before
resizing."
(defun hpg/view-follow-link (event)
"Follow link at EVENT's position."
(interactive "e")
- (when-let ((hyperdrive (h/at-point event)))
+ (when-let* ((hyperdrive (h/at-point event)))
(setf hpg/root-hyperdrive hyperdrive)
(hpg/revert-buffers)))
@@ -1059,7 +1059,7 @@ With numeric ARG, or interactively with universal prefix
argument
:type display-buffer--action-custom-type
:set (lambda (option value)
(set-default option value)
- (when-let ((prefix (get 'hpg/menu 'transient--prefix)))
+ (when-let* ((prefix (get 'hpg/menu 'transient--prefix)))
(eieio-oset prefix 'display-action hpg/menu-display-action))))
(transient-define-prefix hyperdrive-peer-graph-menu
diff --git a/hyperdrive-sbb.el b/hyperdrive-sbb.el
index eb16263ad6..5ffd9ae697 100644
--- a/hyperdrive-sbb.el
+++ b/hyperdrive-sbb.el
@@ -88,12 +88,12 @@ relations hash table as its sole argument."
hops-fn from
(lambda (tos)
(dolist (to tos)
- (when-let ((hop (h/sbb-hop-create :from from :to to))
- ((not (equal root to)))
- (to-relation
- (and (not (equal root to))
- (ensure-relation to)))
- (paths-to-to (extended-paths paths-to-from hop)))
+ (when-let* ((hop (h/sbb-hop-create :from from :to to))
+ ((not (equal root to)))
+ (to-relation
+ (and (not (equal root to))
+ (ensure-relation to)))
+ (paths-to-to (extended-paths paths-to-from hop)))
(cl-callf append
(h/sbb-relation-paths-of-type type to-relation)
paths-to-to)
@@ -247,9 +247,9 @@ longer path to one of the IDS."
;; For each ID which is blocked, add the blocked relation. Also track
the
;; `blocker-id's of the blockers which block ID.
(dolist (id relation-ids)
- (when-let ((relation (gethash id relations))
- (blocked-paths (h/sbb-relation-blocked-paths relation))
- (copy-relation (safe-copy-relation id relation)))
+ (when-let* ((relation (gethash id relations))
+ (blocked-paths (h/sbb-relation-blocked-paths relation))
+ (copy-relation (safe-copy-relation id relation)))
(setf (h/sbb-relation-blocked-paths copy-relation) blocked-paths)
(setf (gethash id copy-relations) copy-relation)
(dolist (path blocked-paths)
diff --git a/hyperdrive.el b/hyperdrive.el
index b8138da0f7..a00f837680 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1731,7 +1731,7 @@ If FORCEP, don't prompt for confirmation before
downloading."
;; "Return non-nil if a local installation of the gateway appears valid.
;; That is, if an executable file exists at the expected location
;; with an expected hash."
-;; (when-let ((file-name (h//gateway-path)))
+;; (when-let* ((file-name (h//gateway-path)))
;; (let* ((file-hash (with-temp-buffer
;; (insert-file-contents-literally file-name)
;; (secure-hash 'sha256 (current-buffer))))