]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer plusp to open-coding it in image-dired
authorStefan Kangas <stefankangas@gmail.com>
Tue, 18 Feb 2025 04:56:02 +0000 (05:56 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 18 Feb 2025 21:33:32 +0000 (22:33 +0100)
* lisp/image/image-dired.el (image-dired-display-thumbs)
(image-dired-forward-image, image-dired-slideshow-start)
(image-dired-line-up-interactive): Prefer plusp to open-coding it.

(cherry picked from commit 93206cd138ff01d9c2a56e52dd0e5edd8e386ec0)

lisp/image/image-dired.el

index bc4c41abace774bd73a85fc8f50c9d8c576b2b83..08d35a627e46334e7f86a3f7ddf3d4679c3ebee5 100644 (file)
@@ -609,7 +609,7 @@ thumbnail buffer to be selected."
             (image-dired-insert-thumbnail
              (image-dired--get-create-thumbnail-file file) file dired-buf)
             (cl-incf image-dired--number-of-thumbnails))))
-      (if (> image-dired--number-of-thumbnails 0)
+      (if (plusp image-dired--number-of-thumbnails)
           (if do-not-pop
               (display-buffer buf)
             (pop-to-buffer buf))
@@ -697,21 +697,21 @@ point is on the last image, move to the last one and vice versa."
   (setq arg (or arg 1))
   (let (pos)
     (dotimes (_ (abs arg))
-      (if (and (not (if (> arg 0) (eobp) (bobp)))
+      (if (and (not (if (plusp arg) (eobp) (bobp)))
                (save-excursion
-                 (forward-char (if (> arg 0) 1 -1))
-                 (while (and (not (if (> arg 0) (eobp) (bobp)))
+                 (forward-char (if (plusp arg) 1 -1))
+                 (while (and (not (if (plusp arg) (eobp) (bobp)))
                              (not (image-dired-image-at-point-p)))
-                   (forward-char (if (> arg 0) 1 -1)))
+                   (forward-char (if (plusp arg) 1 -1)))
                  (setq pos (point))
                  (image-dired-image-at-point-p)))
           (goto-char pos)
         (if wrap-around
-            (goto-char (if (> arg 0)
+            (goto-char (if (plusp arg)
                            (point-min)
                          ;; There are two spaces after the last image.
                          (- (point-max) 2)))
-          (message "At %s image" (if (> arg 0) "last" "first"))))))
+          (message "At %s image" (if (plusp arg) "last" "first"))))))
   (image-dired--update-header-line)
   (when image-dired-track-movement
     (image-dired-track-original-file)))
@@ -1133,7 +1133,7 @@ With a negative prefix argument, prompt user for the delay."
   (let ((delay
          (cond ((not arg)
                 image-dired-slideshow-delay)
-               ((> arg 0)
+               ((plusp arg)
                 arg)
                ((<= arg 0)
                 (string-to-number
@@ -1247,7 +1247,7 @@ Ask user how many thumbnails should be displayed per row."
   (interactive nil image-dired-thumbnail-mode)
   (let ((image-dired-thumbs-per-row
          (string-to-number (read-string "How many thumbs per row: "))))
-    (if (not (> image-dired-thumbs-per-row 0))
+    (if (not (plusp image-dired-thumbs-per-row))
         (message "Number must be greater than 0")
       (image-dired-line-up))))