From 9a613d3ed0331f9fd2528520a96d977ebba57d7d Mon Sep 17 00:00:00 2001
From: Wenjamin Petrenko <wenjamin.petrenko@yandex.ru>
Date: Tue, 14 Aug 2018 11:44:18 +0300
Subject: Prevent `modify-file-local-variable-prop-line' from adding extra ';'

* lisp/files-x.el (modify-file-local-variable-prop-line): Handle
whitespace when checking if there's already a ';' before the
variable (Bug#23294).

Copyright-paperwork-exempt: yes
---
 lisp/files-x.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'lisp/files-x.el')

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 2a52792222d..92532e85f4f 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -377,7 +377,9 @@ from the -*- line ignoring the input argument VALUE."
 	   ((eq variable 'mode) (goto-char beg))
 	   ((null replaced-pos) (goto-char end))
 	   (replaced-pos (goto-char replaced-pos)))
-	  (if (and (not (eq (char-before) ?\;))
+          (if (and (save-excursion
+                     (skip-chars-backward " \t")
+                     (not (eq (char-before) ?\;)))
 		   (not (equal (point) (marker-position beg)))
 		   ;; When existing `-*- -*-' is empty, beg > end.
 		   (not (> (marker-position beg) (marker-position end))))
-- 
cgit v1.2.3