emacs-diffs
[Top][All Lists]
Advanced

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

master 6f872ea8e7: Don't accumulate trailing newlines on every save of .


From: Juri Linkov
Subject: master 6f872ea8e7: Don't accumulate trailing newlines on every save of .dir-locals.el
Date: Thu, 7 Jul 2022 02:31:23 -0400 (EDT)

branch: master
commit 6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Don't accumulate trailing newlines on every save of .dir-locals.el
    
    * lisp/files-x.el (modify-dir-local-variable): Insert a newline
    only after creating a new file.
    (dir-locals-to-string): Remove newline to not add more newlines
    on every save.
---
 lisp/files-x.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index a89fc26d60..8224a57450 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -502,12 +502,13 @@ from the MODE alist ignoring the input argument VALUE."
                       ((and (symbolp (car b)) (stringp (car a))) nil)
                       (t (string< (car a) (car b)))))))
              (current-buffer))
+      (when (eobp) (insert "\n"))
       (goto-char (point-min))
       (indent-sexp))))
 
 (defun dir-locals-to-string (variables)
   "Output alists of VARIABLES to string in dotted pair notation syntax."
-  (format "(%s)\n"
+  (format "(%s)"
           (mapconcat
            (lambda (mode-variables)
              (format "(%S . %s)"



reply via email to

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