emacs-diffs
[Top][All Lists]
Advanced

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

master 7ac9c22636: End new .dir-locals.el files with a newline


From: Stefan Kangas
Subject: master 7ac9c22636: End new .dir-locals.el files with a newline
Date: Wed, 6 Jul 2022 20:27:42 -0400 (EDT)

branch: master
commit 7ac9c22636cc2d6c56bf238ca4311924a6ee0cd0
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    End new .dir-locals.el files with a newline
    
    * lisp/files-x.el (dir-locals-to-string): Add newline at the end of
    newly created .dir-locals.el files.  This avoids git complaining about
    "No newline at end of file".
---
 lisp/files-x.el | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 4db6fbd22c..a89fc26d60 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -507,19 +507,20 @@ from the MODE alist ignoring the input argument VALUE."
 
 (defun dir-locals-to-string (variables)
   "Output alists of VARIABLES to string in dotted pair notation syntax."
-  (format "(%s)" (mapconcat
-                  (lambda (mode-variables)
-                    (format "(%S . %s)"
-                            (car mode-variables)
-                            (format "(%s)" (mapconcat
-                                            (lambda (variable-value)
-                                              (format "(%S . %s)"
-                                                      (car variable-value)
-                                                      (string-trim-right
-                                                       (pp-to-string
-                                                        (cdr 
variable-value)))))
-                                            (cdr mode-variables) "\n"))))
-                  variables "\n")))
+  (format "(%s)\n"
+          (mapconcat
+           (lambda (mode-variables)
+             (format "(%S . %s)"
+                     (car mode-variables)
+                     (format "(%s)" (mapconcat
+                                     (lambda (variable-value)
+                                       (format "(%S . %s)"
+                                               (car variable-value)
+                                               (string-trim-right
+                                                (pp-to-string
+                                                 (cdr variable-value)))))
+                                     (cdr mode-variables) "\n"))))
+           variables "\n")))
 
 ;;;###autoload
 (defun add-dir-local-variable (mode variable value)



reply via email to

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