From 6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 7 Jul 2022 09:31:02 +0300 Subject: 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(-) (limited to 'lisp/files-x.el') diff --git a/lisp/files-x.el b/lisp/files-x.el index a89fc26d60b..8224a574507 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)" -- cgit v1.2.3