[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 36fe73727c 03/31: Fix: (h/handler-default) Fill
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 36fe73727c 03/31: Fix: (h/handler-default) Fill disk-usage from GET request |
Date: |
Wed, 12 Jun 2024 19:00:39 -0400 (EDT) |
branch: elpa/hyperdrive
commit 36fe73727cc2d1a08982eac6435de9419628bc9c
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Fix: (h/handler-default) Fill disk-usage from GET request
It's necessary to fill hyperdrive disk-usage after files have been
loaded from the network so that the disk usage reflects the newly
loaded data.
---
hyperdrive-lib.el | 72 ++++++++++++++++++++++++++++---------------------------
1 file changed, 37 insertions(+), 35 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index c325219fcf..56d78543a9 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1349,41 +1349,43 @@ Otherwise, return nil. SLOT may be one of
(cl-defun h/handler-default (entry &key then)
"Load ENTRY's file into an Emacs buffer.
If then, then call THEN with no arguments. Default handler."
- (h/api 'get (he/url entry)
- :noquery t
- :as (lambda ()
- (pcase-let*
- (((cl-struct hyperdrive-entry hyperdrive version etc) entry)
- ((map target) etc)
- (response-buffer (current-buffer)))
- (with-current-buffer (h//get-buffer-create entry)
- ;; TODO: Don't reload if we're jumping to a link on the
- ;; same page (but ensure that reverting still works).
- (if (buffer-modified-p)
- (h/message "Buffer modified: %S" (current-buffer))
- (save-excursion
- (with-silent-modifications
- (erase-buffer)
- (insert-buffer-substring response-buffer))
- (setf buffer-undo-list nil)
- (setf buffer-read-only
- (or (not (h/writablep hyperdrive)) version))
- (set-buffer-modified-p nil)
- (set-visited-file-modtime (current-time))))
- (when (map-elt (hyperdrive-etc hyperdrive) 'safep)
- (let ((buffer-file-name (he/name entry)))
- (set-auto-mode)))
- (when target
- (pcase major-mode
- ('org-mode
- (require 'hyperdrive-org)
- (h/org--link-goto target))
- ('markdown-mode
- ;; TODO: Handle markdown link
- )))
- (h/blob-mode (if version +1 -1))
- (when then
- (funcall then)))))))
+ (pcase-let*
+ (((cl-struct plz-response headers body)
+ ;; TODO: Handle errors
+ ;; TODO: When plz adds :as 'response-with-buffer, use that.
+ (h/api 'get (he/url entry) :noquery t :as 'response))
+ ;; Filling entry is necessary in order to update hyperdrive disk-usage.
+ (_ (h//fill entry headers))
+ ((cl-struct hyperdrive-entry hyperdrive version etc) entry)
+ ((map target) etc))
+ (with-current-buffer (h//get-buffer-create entry)
+ ;; TODO: Don't reload if we're jumping to a link on the
+ ;; same page (but ensure that reverting still works).
+ (if (buffer-modified-p)
+ (h/message "Buffer modified: %S" (current-buffer))
+ (save-excursion
+ (with-silent-modifications
+ (erase-buffer)
+ (insert body))
+ (setf buffer-undo-list nil)
+ (setf buffer-read-only
+ (or (not (h/writablep hyperdrive)) version))
+ (set-buffer-modified-p nil)
+ (set-visited-file-modtime (current-time))))
+ (when (map-elt (hyperdrive-etc hyperdrive) 'safep)
+ (let ((buffer-file-name (he/name entry)))
+ (set-auto-mode)))
+ (when target
+ (pcase major-mode
+ ('org-mode
+ (require 'hyperdrive-org)
+ (h/org--link-goto target))
+ ('markdown-mode
+ ;; TODO: Handle markdown link
+ )))
+ (h/blob-mode (if version +1 -1))
+ (when then
+ (funcall then)))))
(cl-defun h/handler-streamable (entry &key _then)
;; TODO: Is there any reason to not pass THEN through?
- [nongnu] elpa/hyperdrive updated (0d04b9b2ea -> ad6c7b90ab), ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive b6896e0ab7 01/31: Fix: (h//fill) Only update version ranges if Etag header is present, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive ab71379d58 06/31: Fix: (h/diff-file-entries) Fill disk-usage from GET request, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive f71f3bd904 11/31: Tidy: (h/seed-url) Use pcase-let instead of pcase, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 7862965b83 02/31: Meta: Update hyper-gateway-ushin to 3.9.0: Clear cache, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 36fe73727c 03/31: Fix: (h/handler-default) Fill disk-usage from GET request,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive df4da23927 14/31: Change: (hyperdrive-new) Remove old workaround for fixed plz issue, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 24f4c589cc 15/31: Comment: Add TODOs, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 750ea89b57 20/31: Comment: Add TODO, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 857edd0a9b 04/31: Comment: (h/handler-streamable) Note limitation regarding disk-usage, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive ad488cd057 05/31: Fix: (h/url-loader) Fill disk-usage from GET request, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive a857869c48 23/31: Change: (h/menu) Add binding for h/clear-cache, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 2446113d98 25/31: Meta: Update changelog, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 316e5579fb 27/31: Change: (h/clear-cache) Prompt for confirmation and report success, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive 035b3bc5ac 29/31: Change: (h/forget-file) Rename from h/clear-cache, ELPA Syncer, 2024/06/12
- [nongnu] elpa/hyperdrive ad6c7b90ab 31/31: Add hyperdrive-forget-file command, ELPA Syncer, 2024/06/12