summaryrefslogtreecommitdiff
path: root/lisp/files-x.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-07-07 09:31:02 +0300
committerJuri Linkov <juri@linkov.net>2022-07-07 09:31:02 +0300
commit6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63 (patch)
treea639705400c40aefc2eedc321a345ce98db201de /lisp/files-x.el
parentba63d8783bfd9a484106718346c7dbf6729c4c0f (diff)
downloademacs-6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63.tar.gz
emacs-6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63.tar.bz2
emacs-6f872ea8e70e777f07e19f3eb1ff0c77dcdcba63.zip
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.
Diffstat (limited to 'lisp/files-x.el')
-rw-r--r--lisp/files-x.el3
1 files changed, 2 insertions, 1 deletions
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)"