branch: elpa/helm
commit bf7f5d3fd1552449f9936eefc8067cfc2ea395e9
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    DRY, new function helm-ff--image-change-size
---
 helm-files.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 62d7e75b81f..2ab6847725d 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -4966,16 +4966,15 @@ This affects directly file CANDIDATE."
                   (helm-ff-display-image-native-p))
              nil "Resizing image not available")
   (if (> arg 0)
-      (run-with-idle-timer
-       0.3 nil
-       (lambda ()
-         (with-selected-window (helm-persistent-action-display-window)
-           (image--change-size 1.2))))
-    (run-with-idle-timer
-     0.3 nil
-     (lambda ()
-       (with-selected-window (helm-persistent-action-display-window)
-         (image--change-size 0.8))))))
+      (helm-ff--image-change-size 1.2)
+    (helm-ff--image-change-size 0.8)))
+
+(defun helm-ff--image-change-size (factor)
+  (run-with-idle-timer
+   0.3 nil
+   (lambda ()
+     (with-selected-window (helm-persistent-action-display-window)
+       (image--change-size factor)))))
 
 (defun helm-ff-increase-image-size (_candidate)
   (helm-ff-resize-image-1 1))

Reply via email to