From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#24452: 25.1.50; add/delete-file-local-variable does not work as expected Date: Sat, 17 Sep 2016 12:48:53 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1474131023 24208 195.159.176.226 (17 Sep 2016 16:50:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Sep 2016 16:50:23 +0000 (UTC) User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: 24452@debbugs.gnu.org To: John Kitchin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 17 18:50:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blIoc-0004g9-Ok for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Sep 2016 18:50:10 +0200 Original-Received: from localhost ([::1]:46843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blIoa-0005QV-Vi for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Sep 2016 12:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blIoV-0005PZ-8c for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2016 12:50:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blIoU-0001XU-DW for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2016 12:50:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blIoU-0001XQ-9h for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2016 12:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1blIoU-00076k-5Z for bug-gnu-emacs@gnu.org; Sat, 17 Sep 2016 12:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Sep 2016 16:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24452 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24452-submit@debbugs.gnu.org id=B24452.147413094727255 (code B ref 24452); Sat, 17 Sep 2016 16:50:02 +0000 Original-Received: (at 24452) by debbugs.gnu.org; 17 Sep 2016 16:49:07 +0000 Original-Received: from localhost ([127.0.0.1]:34053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blInb-00075X-BI for submit@debbugs.gnu.org; Sat, 17 Sep 2016 12:49:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blInZ-000753-Vt for 24452@debbugs.gnu.org; Sat, 17 Sep 2016 12:49:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blInT-00017s-T9 for 24452@debbugs.gnu.org; Sat, 17 Sep 2016 12:49:00 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blInQ-00015K-9g; Sat, 17 Sep 2016 12:48:56 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1blInN-0000Cw-EG; Sat, 17 Sep 2016 12:48:53 -0400 X-Spook: Legion of Doom Domestic security freedom National Guard X-Ran: X[+|^s%{}p)[}?c1~{I&5r[SWD*Ypz8=#!&FLty|",,H/IrL,CX~:FM~zWgH@S[yTAHUq> X-Hue: black X-Attribution: GM In-Reply-To: (John Kitchin's message of "Fri, 16 Sep 2016 17:16:21 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123404 Archived-At: John Kitchin wrote: > In the add-file-local-variable and related functions, the local > variables are found with code like: > > (search-forward "Local Variables:" nil t) It uses the same logic as the function that actually applies file local variables (hack-local-variables). > This is too open I think, and leads to errors in files that contain that > phrase in places near the end of the file that aren't related to Local > Variables. For example, in code that is searching for that string, or in > text files that talk about Local Variables. Then you would already have had a more obvious issue when visiting the file in the first place. The format of Local Variables is too long-established to be changed now, and there's no point add-file-local-variable being stricter than hack-local-variables. The standard solution is eg to add a ^L, or obfuscate the "Local Variables", so it's not picked up. > I think the search should be done with a regexp that considers the start > of a line and comment-start: > > (format "^%s+ Local Variables:" comment-start) Some files have no comment syntax. In some that do, there's no need for the LV section to use it (eg it could be after the "end{document}" in a latex file, or inside #if 0 in C). And then there's the case where comment-start is itself specified in the LV section.