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

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

[elpa] externals/consult 902b5dfd7c 1/3: consult--find-file-temporarily:


From: ELPA Syncer
Subject: [elpa] externals/consult 902b5dfd7c 1/3: consult--find-file-temporarily: Fix error message for large files
Date: Sun, 10 Apr 2022 10:57:23 -0400 (EDT)

branch: externals/consult
commit 902b5dfd7c5b20cab036de3282b5b31bdcc4c28a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult--find-file-temporarily: Fix error message for large files
---
 consult.el | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/consult.el b/consult.el
index 7b84ae98ba..a8144929a6 100644
--- a/consult.el
+++ b/consult.el
@@ -1136,24 +1136,24 @@ ORIG is the original function, HOOKS the arguments."
                                 (message "consult-preview-variables: The 
variable `%s' is not bound" k)
                                 nil))
                             consult-preview-variables))))
-    (unwind-protect
-        (progn
-          (advice-add #'run-hooks :around #'consult--filter-find-file-hook)
-          (pcase-dolist (`(,k ,v . ,_) vars)
-            (set-default k v)
-            (set k v))
-          ;; file-attributes may throw permission denied error
-          (when-let* ((attrs (ignore-errors (file-attributes name)))
-                      (size (file-attribute-size attrs)))
-            (if (<= size consult-preview-max-size)
-                (find-file-noselect name 'nowarn (> size 
consult-preview-raw-size))
-              (message "File `%s' (%s) is too large for preview"
-                       name (file-size-human-readable size))
-              nil)))
-      (advice-remove #'run-hooks #'consult--filter-find-file-hook)
-      (pcase-dolist (`(,k ,_ ,d ,v) vars)
-        (set-default k d)
-        (set k v)))))
+    ;; file-attributes may throw permission denied error
+    (when-let* ((attrs (ignore-errors (file-attributes name)))
+                (size (file-attribute-size attrs)))
+      (if (<= size consult-preview-max-size)
+          (unwind-protect
+              (progn
+                (advice-add #'run-hooks :around 
#'consult--filter-find-file-hook)
+                (pcase-dolist (`(,k ,v . ,_) vars)
+                  (set-default k v)
+                  (set k v))
+                (find-file-noselect name 'nowarn (> size 
consult-preview-raw-size)))
+            (advice-remove #'run-hooks #'consult--filter-find-file-hook)
+            (pcase-dolist (`(,k ,_ ,d ,v) vars)
+              (set-default k d)
+              (set k v)))
+        (message "File `%s' (%s) is too large for preview"
+                 name (file-size-human-readable size))
+        nil))))
 
 (defun consult--temporary-files ()
   "Return a function to open files temporarily for preview."



reply via email to

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