]> git.eshelyaron.com Git - emacs.git/commitdiff
End new .dir-locals.el files with a newline
authorStefan Kangas <stefan@marxist.se>
Thu, 7 Jul 2022 00:09:30 +0000 (02:09 +0200)
committerStefan Kangas <stefan@marxist.se>
Thu, 7 Jul 2022 00:23:30 +0000 (02:23 +0200)
* 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

index 4db6fbd22cc1793e82903c4c0b89b212839fdf1d..a89fc26d60b3341f9aa76a6c766c0be8dd614141 100644 (file)
@@ -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)