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

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

[nongnu] elpa/hyperdrive d66fd46f18: Merge branch 'stable'


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive d66fd46f18: Merge branch 'stable'
Date: Wed, 25 Sep 2024 04:00:26 -0400 (EDT)

branch: elpa/hyperdrive
commit d66fd46f189536d6959019addf2627e5539cb894
Merge: f24c67cd3d 6b70954da9
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Merge branch 'stable'
---
 CHANGELOG.org     |  7 +++++++
 hyperdrive-lib.el | 21 ++++++++++++++-------
 hyperdrive.el     |  7 +------
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 1ff8788cca..b18c1d1afa 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -8,6 +8,13 @@
 
 Nothing yet...
 
+* 0.4.2 [2024-09-24 Tue]
+
+** Fixes
+
+- Set major mode in hyperdrive files even before it is saved.
+- Compiler warnings.  (Thanks to Jonas Bernoulli!)
+
 * 0.4.1 [2024-09-13 Fri]
 
 ** Fixes
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index e8426d1240..bb6017f692 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -731,7 +731,8 @@ echo area when the request for the file is made."
                            (h/message "Entry does not exist!  %s"
                                       (h//format-entry entry)))
                        ;; Make and switch to new buffer.
-                       (switch-to-buffer (h//get-buffer-create entry))))
+                       (switch-to-buffer (h//get-buffer-create entry))
+                       (h//set-auto-mode)))
                     (t
                      ;; Hyperdrive entry is not writable: prompt for action.
                      (not-found-action))))
@@ -1430,12 +1431,7 @@ If then, then call THEN with no arguments.  Default 
handler."
                 (or (not (h/writablep hyperdrive)) version))
           (set-buffer-modified-p nil)
           (set-visited-file-modtime (current-time))))
-      (when (eq 'unknown (h/safe-p hyperdrive))
-        (call-interactively #'h/mark-as-safe))
-      ;; Check safe-p again after potential call to `h/mark-as-safe'.
-      (when (eq t (h/safe-p hyperdrive))
-        (let ((buffer-file-name (he/name entry)))
-          (set-auto-mode t)))
+      (h//set-auto-mode)
       (when target
         (with-demoted-errors "Hyperdrive: %S"
           (pcase major-mode
@@ -1769,6 +1765,17 @@ When BUFFER is nil, act on current buffer."
       (delete-all-overlays)
       (set-text-properties (point-min) (point-max) nil))))
 
+(defun h//set-auto-mode ()
+  "Set major mode according to file extension, prompting for safety."
+  (let ((entry (h//context-entry))
+        (hyperdrive (h//context-hyperdrive)))
+    (when (eq 'unknown (h/safe-p hyperdrive))
+      (call-interactively #'h/mark-as-safe))
+    ;; Check safe-p again after potential call to `h/mark-as-safe'.
+    (when (eq t (h/safe-p hyperdrive))
+      (let ((buffer-file-name (he/name entry)))
+        (set-auto-mode t)))))
+
 (defun he/equal-p (a b &optional any-version-p)
   "Return non-nil if hyperdrive entries A and B are equal.
 Compares only public key, version, and path.  If ANY-VERSION-P,
diff --git a/hyperdrive.el b/hyperdrive.el
index 793d028ecf..9f133c9c51 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -568,12 +568,7 @@ For non-interactive use, see `hyperdrive-write'."
                 (with-current-buffer orig-buffer
                   (unless h/mode
                     (h//clean-buffer)
-                    (when (eq 'unknown (h/safe-p hyperdrive))
-                      (call-interactively #'h/mark-as-safe))
-                    ;; Check safe-p again after potential call to 
`h/mark-as-safe'.
-                    (when (eq t (h/safe-p hyperdrive))
-                      (let ((buffer-file-name (he/name entry)))
-                        (set-auto-mode t)))
+                    (h//set-auto-mode)
                     (h/mode))
                   (he//fill entry (plz-response-headers response))
                   ;; PUT responses only include ETag and Last-Modified



reply via email to

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