emacs-diffs
[Top][All Lists]
Advanced

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

master 9f82b49398 5/9: ; image-dired: Indentation fixes


From: Stefan Kangas
Subject: master 9f82b49398 5/9: ; image-dired: Indentation fixes
Date: Sat, 3 Sep 2022 04:56:02 -0400 (EDT)

branch: master
commit 9f82b49398178e480a4d2cc4f846340572f92886
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    ; image-dired: Indentation fixes
    
    * lisp/image/image-dired-dired.el:
    * lisp/image/image-dired-external.el:
    * lisp/image/image-dired-tags.el:
    * lisp/image/image-dired-util.el:
    * lisp/image/image-dired.el: Fix indentation.
---
 lisp/image/image-dired-dired.el    |  34 ++---
 lisp/image/image-dired-external.el |  14 +-
 lisp/image/image-dired-tags.el     | 258 ++++++++++++++++++-------------------
 lisp/image/image-dired-util.el     |   2 +-
 lisp/image/image-dired.el          |  24 ++--
 5 files changed, 166 insertions(+), 166 deletions(-)

diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el
index 2f3a66f9cd..d5d7e0c38f 100644
--- a/lisp/image/image-dired-dired.el
+++ b/lisp/image/image-dired-dired.el
@@ -67,12 +67,12 @@ previous -ARG, if ARG<0) files."
                                 if (overlay-get ov 'thumb-file) return ov)))
          (if thumb-ov
              (delete-overlay thumb-ov)
-          (put-image thumb-file image-pos)
-          (setq overlay
+           (put-image thumb-file image-pos)
+           (setq overlay
                  (cl-loop for ov in (overlays-in (point) (1+ (point)))
                           if (overlay-get ov 'put-image) return ov))
-          (overlay-put overlay 'image-file image-file)
-          (overlay-put overlay 'thumb-file thumb-file)))))
+           (overlay-put overlay 'image-file image-file)
+           (overlay-put overlay 'thumb-file thumb-file)))))
    arg             ; Show or hide image on ARG next files.
    'show-progress) ; Update dired display after each image is updated.
   (add-hook 'dired-after-readin-hook
@@ -353,14 +353,14 @@ matching tag will be marked in the Dired buffer."
       ;; slow.  Don't bother about hits found in other directories
       ;; than the current one.
       (when (string= (file-name-as-directory
-                     (expand-file-name default-directory))
-                    (file-name-as-directory
-                     (file-name-directory curr-file)))
-       (setq curr-file (file-name-nondirectory curr-file))
-       (goto-char (point-min))
-       (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
-         (setq hits (+ hits 1))
-         (dired-mark 1))))
+                      (expand-file-name default-directory))
+                     (file-name-as-directory
+                      (file-name-directory curr-file)))
+        (setq curr-file (file-name-nondirectory curr-file))
+        (goto-char (point-min))
+        (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
+          (setq hits (+ hits 1))
+          (dired-mark 1))))
     (message "%d files with matching tag marked" hits)))
 
 (defun image-dired-dired-display-properties ()
@@ -374,11 +374,11 @@ matching tag will be marked in the Dired buffer."
          (message-log-max nil))
     (if file-name
         (message "%s"
-         (image-dired-format-properties-string
-          dired-buf
-          file-name
-          props
-          comment)))))
+                 (image-dired-format-properties-string
+                  dired-buf
+                  file-name
+                  props
+                  comment)))))
 
 (provide 'image-dired-dired)
 
diff --git a/lisp/image/image-dired-external.el 
b/lisp/image/image-dired-external.el
index c45287bd18..ef39e2f938 100644
--- a/lisp/image/image-dired-external.el
+++ b/lisp/image/image-dired-external.el
@@ -297,9 +297,9 @@ and remove the cached thumbnail files between each trial 
run.")
    'image-dired-cmd-create-thumbnail-program)
   (let* ((width (int-to-string (image-dired-thumb-size 'width)))
          (height (int-to-string (image-dired-thumb-size 'height)))
-        (modif-time (format-time-string
-                     "%s" (file-attribute-modification-time
-                           (file-attributes original-file))))
+         (modif-time (format-time-string
+                      "%s" (file-attribute-modification-time
+                            (file-attributes original-file))))
          (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
                                                        thumbnail-file))
          (spec
@@ -338,7 +338,7 @@ and remove the cached thumbnail files between each trial 
run.")
               (image-dired-debug-message
                (format-time-string
                 "Generated thumbnails in %s.%3N seconds"
-               (time-subtract nil
+                (time-subtract nil
                                image-dired--generate-thumbs-start))))
             (if (not (and (eq (process-status process) 'exit)
                           (zerop (process-exit-status process))))
@@ -410,7 +410,7 @@ The new file will be named THUMBNAIL-FILE."
         (image-dired-display-image image-dired-temp-rotate-image-file)
         (if (or (and image-dired-rotate-original-ask-before-overwrite
                      (y-or-n-p
-                     "Rotate to temp file OK.  Overwrite original image? "))
+                      "Rotate to temp file OK.  Overwrite original image? "))
                 (not image-dired-rotate-original-ask-before-overwrite))
             (progn
               (copy-file image-dired-temp-rotate-image-file file t)
@@ -455,8 +455,8 @@ default value at the prompt."
            (old-value (or (exif-field 'description (exif-parse-file file)) 
"")))
       (if (eq 0
               (image-dired-set-exif-data file "ImageDescription"
-                                   (read-string "Value of ImageDescription: "
-                                               old-value)))
+                                         (read-string "Value of 
ImageDescription: "
+                                                      old-value)))
           (message "Successfully wrote ImageDescription tag")
         (error "Could not write ImageDescription tag")))))
 
diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.el
index 2ea9d9f5eb..ee3c63b009 100644
--- a/lisp/image/image-dired-tags.el
+++ b/lisp/image/image-dired-tags.el
@@ -40,7 +40,7 @@ Return the last form in BODY."
   (declare (indent 0) (debug t))
   `(with-temp-buffer
      (if (file-exists-p image-dired-db-file)
-        (insert-file-contents image-dired-db-file))
+         (insert-file-contents image-dired-db-file))
      ,@body))
 
 (defun image-dired-sane-db-file ()
@@ -71,65 +71,65 @@ FILE-TAGS is an alist in the following form:
   (image-dired-sane-db-file)
   (let (end file tag)
     (image-dired--with-db-file
-     (setq buffer-file-name image-dired-db-file)
-     (dolist (elt file-tags)
-       (setq file (car elt)
-            tag (cdr elt))
-       (goto-char (point-min))
-       (if (search-forward-regexp (format "^%s.*$" file) nil t)
-          (progn
-            (setq end (point))
-            (beginning-of-line)
-            (when (not (search-forward (format ";%s" tag) end t))
-              (end-of-line)
-              (insert (format ";%s" tag))))
-        (goto-char (point-max))
-        (insert (format "%s;%s\n" file tag))))
-     (save-buffer))))
+      (setq buffer-file-name image-dired-db-file)
+      (dolist (elt file-tags)
+        (setq file (car elt)
+              tag (cdr elt))
+        (goto-char (point-min))
+        (if (search-forward-regexp (format "^%s.*$" file) nil t)
+            (progn
+              (setq end (point))
+              (beginning-of-line)
+              (when (not (search-forward (format ";%s" tag) end t))
+                (end-of-line)
+                (insert (format ";%s" tag))))
+          (goto-char (point-max))
+          (insert (format "%s;%s\n" file tag))))
+      (save-buffer))))
 
 (defun image-dired-remove-tag (files tag)
   "For all FILES, remove TAG from the image database."
   (image-dired-sane-db-file)
   (image-dired--with-db-file
-   (setq buffer-file-name image-dired-db-file)
-   (let (end)
-     (unless (listp files)
-       (if (stringp files)
-          (setq files (list files))
-        (error "Files must be a string or a list of strings!")))
-     (dolist (file files)
-       (goto-char (point-min))
-       (when (search-forward-regexp (format "^%s;" file) nil t)
-        (end-of-line)
-        (setq end (point))
-        (beginning-of-line)
-        (when (search-forward-regexp
-                (format "\\(;%s\\)\\($\\|;\\)" tag) end t)
-          (delete-region (match-beginning 1) (match-end 1))
-          ;; Check if file should still be in the database. If
-          ;; it has no tags or comments, it will be removed.
-          (end-of-line)
-          (setq end (point))
-          (beginning-of-line)
-          (when (not (search-forward ";" end t))
-            (kill-line 1))))))
-   (save-buffer)))
+    (setq buffer-file-name image-dired-db-file)
+    (let (end)
+      (unless (listp files)
+        (if (stringp files)
+            (setq files (list files))
+          (error "Files must be a string or a list of strings!")))
+      (dolist (file files)
+        (goto-char (point-min))
+        (when (search-forward-regexp (format "^%s;" file) nil t)
+          (end-of-line)
+          (setq end (point))
+          (beginning-of-line)
+          (when (search-forward-regexp
+                 (format "\\(;%s\\)\\($\\|;\\)" tag) end t)
+            (delete-region (match-beginning 1) (match-end 1))
+            ;; Check if file should still be in the database. If
+            ;; it has no tags or comments, it will be removed.
+            (end-of-line)
+            (setq end (point))
+            (beginning-of-line)
+            (when (not (search-forward ";" end t))
+              (kill-line 1))))))
+    (save-buffer)))
 
 (defun image-dired-list-tags (file)
   "Read all tags for image FILE from the image database."
   (image-dired-sane-db-file)
   (image-dired--with-db-file
-   (let (end (tags ""))
-     (when (search-forward-regexp (format "^%s" file) nil t)
-       (end-of-line)
-       (setq end (point))
-       (beginning-of-line)
-       (if (search-forward ";" end t)
-          (if (search-forward "comment:" end t)
-              (if (search-forward ";" end t)
-                  (setq tags (buffer-substring (point) end)))
-            (setq tags (buffer-substring (point) end)))))
-     (split-string tags ";"))))
+    (let (end (tags ""))
+      (when (search-forward-regexp (format "^%s" file) nil t)
+        (end-of-line)
+        (setq end (point))
+        (beginning-of-line)
+        (if (search-forward ";" end t)
+            (if (search-forward "comment:" end t)
+                (if (search-forward ";" end t)
+                    (setq tags (buffer-substring (point) end)))
+              (setq tags (buffer-substring (point) end)))))
+      (split-string tags ";"))))
 
 ;;;###autoload
 (defun image-dired-tag-files (arg)
@@ -191,34 +191,34 @@ FILE-COMMENTS is an alist on the following form:
   (image-dired-sane-db-file)
   (let (end comment-beg-pos comment-end-pos file comment)
     (image-dired--with-db-file
-     (setq buffer-file-name image-dired-db-file)
-     (dolist (elt file-comments)
-       (setq file (car elt)
-            comment (cdr elt))
-       (goto-char (point-min))
-       (if (search-forward-regexp (format "^%s.*$" file) nil t)
-          (progn
-            (setq end (point))
-            (beginning-of-line)
-            ;; Delete old comment, if any
-            (when (search-forward ";comment:" end t)
-              (setq comment-beg-pos (match-beginning 0))
-              ;; Any tags after the comment?
-              (if (search-forward ";" end t)
-                  (setq comment-end-pos (- (point) 1))
-                (setq comment-end-pos end))
-              ;; Delete comment tag and comment
-              (delete-region comment-beg-pos comment-end-pos))
-            ;; Insert new comment
-            (beginning-of-line)
-            (unless (search-forward ";" end t)
-              (end-of-line)
-              (insert ";"))
-            (insert (format "comment:%s;" comment)))
-        ;; File does not exist in database - add it.
-        (goto-char (point-max))
-        (insert (format "%s;comment:%s\n" file comment))))
-     (save-buffer))))
+      (setq buffer-file-name image-dired-db-file)
+      (dolist (elt file-comments)
+        (setq file (car elt)
+              comment (cdr elt))
+        (goto-char (point-min))
+        (if (search-forward-regexp (format "^%s.*$" file) nil t)
+            (progn
+              (setq end (point))
+              (beginning-of-line)
+              ;; Delete old comment, if any
+              (when (search-forward ";comment:" end t)
+                (setq comment-beg-pos (match-beginning 0))
+                ;; Any tags after the comment?
+                (if (search-forward ";" end t)
+                    (setq comment-end-pos (- (point) 1))
+                  (setq comment-end-pos end))
+                ;; Delete comment tag and comment
+                (delete-region comment-beg-pos comment-end-pos))
+              ;; Insert new comment
+              (beginning-of-line)
+              (unless (search-forward ";" end t)
+                (end-of-line)
+                (insert ";"))
+              (insert (format "comment:%s;" comment)))
+          ;; File does not exist in database - add it.
+          (goto-char (point-max))
+          (insert (format "%s;comment:%s\n" file comment))))
+      (save-buffer))))
 
 (defun image-dired-update-property (prop value)
   "Update text property PROP with value VALUE at point."
@@ -252,19 +252,19 @@ Optionally use old comment from FILE as initial value."
   "Get comment for file FILE."
   (image-dired-sane-db-file)
   (image-dired--with-db-file
-   (let (end comment-beg-pos comment-end-pos comment)
-     (when (search-forward-regexp (format "^%s" file) nil t)
-       (end-of-line)
-       (setq end (point))
-       (beginning-of-line)
-       (when (search-forward ";comment:" end t)
-        (setq comment-beg-pos (point))
-        (if (search-forward ";" end t)
-            (setq comment-end-pos (- (point) 1))
-          (setq comment-end-pos end))
-        (setq comment (buffer-substring
-                       comment-beg-pos comment-end-pos))))
-     comment)))
+    (let (end comment-beg-pos comment-end-pos comment)
+      (when (search-forward-regexp (format "^%s" file) nil t)
+        (end-of-line)
+        (setq end (point))
+        (beginning-of-line)
+        (when (search-forward ";comment:" end t)
+          (setq comment-beg-pos (point))
+          (if (search-forward ";" end t)
+              (setq comment-end-pos (- (point) 1))
+            (setq comment-end-pos end))
+          (setq comment (buffer-substring
+                         comment-beg-pos comment-end-pos))))
+      comment)))
 
 
 ;;; Tag support
@@ -290,7 +290,7 @@ easy-to-use form."
     (remove-overlays)
     ;; Some help for the user.
     (widget-insert
-"\nEdit comments and tags for each image.  Separate multiple tags
+     "\nEdit comments and tags for each image.  Separate multiple tags
 with a comma.  Move forward between fields using TAB or RET.
 Move to the previous field using backtab (S-TAB).  Save by
 activating the Save button at the bottom of the form or cancel
@@ -301,41 +301,41 @@ the operation by activating the Cancel button.\n\n")
 
       (dolist (file files)
 
-       (setq thumb-file (image-dired-thumb-name file)
-             img (create-image thumb-file))
-
-       (insert-image img)
-       (widget-insert "\n\nComment: ")
-       (setq comment-widget
-             (widget-create 'editable-field
-                            :size 60
-                            :format "%v "
-                            :value (or (image-dired-get-comment file) "")))
-       (widget-insert "\nTags:    ")
-       (setq tag-widget
-             (widget-create 'editable-field
-                            :size 60
-                            :format "%v "
-                            :value (or (mapconcat
-                                        #'identity
-                                        (image-dired-list-tags file)
-                                        ",") "")))
-       ;; Save information in all widgets so that we can use it when
-       ;; the user saves the form.
-       (setq image-dired-widget-list
-             (append image-dired-widget-list
-                     (list (list file comment-widget tag-widget))))
-       (widget-insert "\n\n")))
+        (setq thumb-file (image-dired-thumb-name file)
+              img (create-image thumb-file))
+
+        (insert-image img)
+        (widget-insert "\n\nComment: ")
+        (setq comment-widget
+              (widget-create 'editable-field
+                             :size 60
+                             :format "%v "
+                             :value (or (image-dired-get-comment file) "")))
+        (widget-insert "\nTags:    ")
+        (setq tag-widget
+              (widget-create 'editable-field
+                             :size 60
+                             :format "%v "
+                             :value (or (mapconcat
+                                         #'identity
+                                         (image-dired-list-tags file)
+                                         ",") "")))
+        ;; Save information in all widgets so that we can use it when
+        ;; the user saves the form.
+        (setq image-dired-widget-list
+              (append image-dired-widget-list
+                      (list (list file comment-widget tag-widget))))
+        (widget-insert "\n\n")))
 
     ;; Footer with Save and Cancel button.
     (widget-insert "\n")
     (widget-create 'push-button
-                 :notify
-                 (lambda (&rest _ignore)
-                   (image-dired-save-information-from-widgets)
-                   (bury-buffer)
-                   (message "Done"))
-                 "Save")
+                   :notify
+                   (lambda (&rest _ignore)
+                     (image-dired-save-information-from-widgets)
+                     (bury-buffer)
+                     (message "Done"))
+                   "Save")
     (widget-insert " ")
     (widget-create 'push-button
                    :notify
@@ -356,12 +356,12 @@ tags to their respective image file.  Internal function 
used by
 `image-dired-dired-edit-comment-and-tags'."
   (let (file comment tag-string tag-list lst)
     (image-dired-write-comments
-          (mapcar
-           (lambda (widget)
-             (setq file (car widget)
-                   comment (widget-value (cadr widget)))
-             (cons file comment))
-           image-dired-widget-list))
+     (mapcar
+      (lambda (widget)
+        (setq file (car widget)
+              comment (widget-value (cadr widget)))
+        (cons file comment))
+      image-dired-widget-list))
     (image-dired-write-tags
      (dolist (widget image-dired-widget-list lst)
        (setq file (car widget)
diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el
index 6380dbb40a..1318b25a12 100644
--- a/lisp/image/image-dired-util.el
+++ b/lisp/image/image-dired-util.el
@@ -45,7 +45,7 @@
   "Return the current thumbnail directory (from variable `image-dired-dir').
 Create the thumbnail directory if it does not exist."
   (let ((image-dired-dir (file-name-as-directory
-               (expand-file-name image-dired-dir))))
+                          (expand-file-name image-dired-dir))))
     (unless (file-directory-p image-dired-dir)
       (with-file-modes #o700
         (make-directory image-dired-dir t))
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index c4b2756ebf..7c4de16172 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -281,8 +281,8 @@ the window containing the thumbnail buffer, Fixed means to 
use
 and No line-up means that no automatic line-up will be done."
   :type '(choice :tag "Default line-up method"
                  (const :tag "Dynamic" dynamic)
-                (const :tag "Fixed" fixed)
-                (const :tag "Interactive" interactive)
+                 (const :tag "Fixed" fixed)
+                 (const :tag "Interactive" interactive)
                  (const :tag "No line-up" none)))
 
 (defcustom image-dired-thumbs-per-row 3
@@ -361,16 +361,16 @@ This affects the following commands:
   (unless (string-match-p (image-file-name-regexp) file)
     (error "%s is not a valid image file" file))
   (let* ((thumb-file (image-dired-thumb-name file))
-        (thumb-attr (file-attributes thumb-file)))
+         (thumb-attr (file-attributes thumb-file)))
     (when (or (not thumb-attr)
-             (time-less-p (file-attribute-modification-time thumb-attr)
-                          (file-attribute-modification-time
-                           (file-attributes file))))
+              (time-less-p (file-attribute-modification-time thumb-attr)
+                           (file-attribute-modification-time
+                            (file-attributes file))))
       (image-dired-create-thumb file thumb-file))
     (create-image thumb-file)))
 
-(defun image-dired-insert-thumbnail (file original-file-name
-                                     associated-dired-buffer)
+(defun image-dired-insert-thumbnail ( file original-file-name
+                                      associated-dired-buffer)
   "Insert thumbnail image FILE.
 Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
   (let (beg end)
@@ -1066,7 +1066,7 @@ See also `image-dired-line-up-dynamic'."
           (insert (propertize " " 'display `(space :align-to ,thumb-prev-pos)))
           (cl-incf seen)
           (when (and (= seen (- image-dired-thumbs-per-row 1))
-                    (not (eobp)))
+                     (not (eobp)))
             (forward-char)
             (insert "\n")
             (setq seen 0)
@@ -1200,7 +1200,7 @@ non-nil."
   (let ((file (image-dired-original-file-name)))
     (when file
       (if image-dired-track-movement
-         (image-dired-track-original-file))
+          (image-dired-track-original-file))
       (image-dired-display-image file))))
 
 (defun image-dired-mouse-select-thumbnail (event)
@@ -1403,7 +1403,7 @@ completely fit)."
   "Calculate WINDOW height in pixels."
   (declare (obsolete nil "29.1"))
   ;; Note: The mode-line consumes one line
-    (* (- (window-height window) 1) (frame-char-height)))
+  (* (- (window-height window) 1) (frame-char-height)))
 
 (defcustom image-dired-cmd-read-exif-data-program "exiftool"
   "Program used to read EXIF data to image.
@@ -1507,7 +1507,7 @@ Dired."
         (dired-buf (image-dired-associated-dired-buffer)))
     (if (not (and dired-buf file-name))
         (message "No image, or image with correct properties, at point")
-    (with-current-buffer dired-buf
+      (with-current-buffer dired-buf
         (message "%s" file-name)
         (when (dired-goto-file file-name)
           (cond ((eq command 'mark) (dired-mark 1))



reply via email to

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