Subject: bug#23294:

From: Wenjamin Petrenko <[email-masked]>
Date: Tue, 14 Aug 2018 13:05:25 +0300

A patch with a fix is attached.

From c520ac992e683abb8625bb92bfa3ac75209bc0fb Mon Sep 17 00:00:00 2001
From: Wenjamin Petrenko <[email-masked]>
Date: Tue, 14 Aug 2018 11:44:18 +0300
Subject: [PATCH] Fix bug#23294

* lisp/files-x.el (modify-file-local-variable-prop-line): Handle
whitespace when checking if there's a ';' before the variable name.
---
 lisp/files-x.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 2a52792222..f0dfa97d40 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))))
-- 
2.14.1