unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Wenjamin Petrenko <wenjamin.petrenko@yandex.ru>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 23294@debbugs.gnu.org, "Mohammed Sadik P. K." <sadiq@sadiqpk.org>
Subject: bug#23294: 25.0.92; modify-file-local-variable-prop-line adds extra "; "
Date: Thu, 16 Aug 2018 13:54:31 +0300	[thread overview]
Message-ID: <1012371534416871@iva3-a2a8aac410a1.qloud-c.yandex.net> (raw)
In-Reply-To: <877ekrxjpi.fsf_-_@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Noam Postavsky <npostavs <at> gmail.com> writes:

> This looks reasonable. Could you give a more informative summary line
> please? I.e., one where I can see what the bug is about without having
> memorized all bug numbers. And same for your email subject headers, if
> you don't mind.

Done.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Prevent-modify-file-local-variable-prop-line-from-ad.patch --]
[-- Type: text/x-diff; name="0001-Prevent-modify-file-local-variable-prop-line-from-ad.patch", Size: 1132 bytes --]

From 2ff2b81acc55e0286f7cf4b26ac5b8d5ff5e37e7 Mon Sep 17 00:00:00 2001
From: Wenjamin Petrenko <wenjamin.petrenko@yandex.ru>
Date: Tue, 14 Aug 2018 11:44:18 +0300
Subject: [PATCH] Prevent `modify-file-local-variable-prop-line' from adding extra ';'
(bug#23294)

* lisp/files-x.el (modify-file-local-variable-prop-line): Handle
whitespace when checking if there's already a ';' before the variable.
---
 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


  reply	other threads:[~2018-08-16 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  1:52 bug#23294: 25.0.92; modify-file-local-variable-prop-line adds extra "; " Mohammed Sadik P. K.
2016-04-15  7:55 ` Alexis
2018-06-05 23:51   ` Noam Postavsky
2018-08-14 10:05 ` bug#23294: Wenjamin Petrenko
2018-08-16  0:02   ` bug#23294: 25.0.92; modify-file-local-variable-prop-line adds extra "; " Noam Postavsky
2018-08-16 10:54     ` Wenjamin Petrenko [this message]
2018-08-25  1:59       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1012371534416871@iva3-a2a8aac410a1.qloud-c.yandex.net \
    --to=wenjamin.petrenko@yandex.ru \
    --cc=23294@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    --cc=sadiq@sadiqpk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).