emacs-diffs
[Top][All Lists]
Advanced

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

master 101b3c8 2/4: New placement of newline characters in image-dired-d


From: Lars Ingebrigtsen
Subject: master 101b3c8 2/4: New placement of newline characters in image-dired-db-file
Date: Thu, 19 Aug 2021 09:03:30 -0400 (EDT)

branch: master
commit 101b3c81b657198ebaf9abdaa0875d1b09d66192
Author: Peter Münster <pm@a16n.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    New placement of newline characters in image-dired-db-file
    
    It's more usual to have the newline at the end of the line, instead of the
    beginning. This change avoids missing newline at the end of the file, an
    empty line at the start and eventually a lot of empty lines when
    `require-final-newline' is not nil.
    
    * lisp/image-dired.el (image-dired-write-tags): Insert newline at the end
    of the line, instead of the beginning.
    (image-dired-remove-tag): Do not delete empty line at end of buffer.
---
 lisp/image-dired.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 9455ab1..5427014 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1096,7 +1096,7 @@ FILE-TAGS is an alist in the following form:
               (end-of-line)
               (insert (format ";%s" tag))))
         (goto-char (point-max))
-        (insert (format "\n%s;%s" file tag))))
+        (insert (format "%s;%s\n" file tag))))
      (save-buffer))))
 
 (defun image-dired-remove-tag (files tag)
@@ -1123,11 +1123,7 @@ FILE-TAGS is an alist in the following form:
           (setq end (point))
           (beginning-of-line)
           (when (not (search-forward ";" end t))
-            (kill-line 1)
-            ;; If on empty line at end of buffer
-            (and (eobp)
-                 (looking-at "^$")
-                 (delete-char -1)))))))
+            (kill-line 1))))))
    (save-buffer)))
 
 (defun image-dired-list-tags (file)
@@ -2185,7 +2181,7 @@ FILE-COMMENTS is an alist on the following form:
             (insert (format "comment:%s;" comment)))
         ;; File does not exist in database - add it.
         (goto-char (point-max))
-        (insert (format "\n%s;comment:%s" file comment))))
+        (insert (format "%s;comment:%s\n" file comment))))
      (save-buffer))))
 
 (defun image-dired-update-property (prop value)



reply via email to

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