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

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

[nongnu] elpa/hyperdrive a14d14d61a 5/9: Fix: Set buffer-modified-p in b


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive a14d14d61a 5/9: Fix: Set buffer-modified-p in buffers for deleted hyperdrive files
Date: Thu, 12 Oct 2023 16:00:56 -0400 (EDT)

branch: elpa/hyperdrive
commit a14d14d61a3a85869fbf529c942c35e2e757c75e
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Fix: Set buffer-modified-p in buffers for deleted hyperdrive files
    
    This is an attempt to fix <https://todo.sr.ht/~ushin/ushin/138>.
---
 hyperdrive.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index fa076ab0d4..c3b54c6aa6 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -390,6 +390,15 @@ directory.  Otherwise, or with universal prefix argument
                 (setf (hyperdrive-entry-version nonexistent-entry) 
(string-to-number etag))
                 (hyperdrive--fill-latest-version (hyperdrive-entry-hyperdrive 
entry) headers)
                 (hyperdrive-update-nonexistent-version-range 
nonexistent-entry))
+              ;; Since there's no way for `hyperdrive--write-contents' to run 
when
+              ;; `buffer-modified-p' returns nil, this is a workaround to 
ensure that
+              ;; `save-buffer' re-saves files after they've been deleted.
+              (dolist (buf (match-buffers (lambda (buf deleted-entry)
+                                            (when-let ((current-entry 
(buffer-local-value hyperdrive-current-entry buf)))
+                                              (hyperdrive-entry-equal-p 
current-entry deleted-entry)))
+                                          nil entry))
+                (with-current-buffer buf
+                  (set-buffer-modified-p t)))
               (funcall then response)))
     :else else))
 



reply via email to

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