From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#14089: 24.3; file local variables can't have a colon in their name Date: Sat, 13 Apr 2013 21:01:21 -0400 Message-ID: References: <877gkqqbc6.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365901324 24665 80.91.229.3 (14 Apr 2013 01:02:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Apr 2013 01:02:04 +0000 (UTC) To: 14089-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 14 03:02:08 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1URBKX-0008WI-6N for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Apr 2013 03:02:05 +0200 Original-Received: from localhost ([::1]:36538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URBKW-0003VT-CG for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2013 21:02:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URBKT-0003UV-T4 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2013 21:02:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URBKR-0006IH-Re for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2013 21:02:01 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URBKR-0006IB-Op for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2013 21:01:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1URBOM-00047K-F5 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2013 21:06:02 -0400 In-Reply-To: <877gkqqbc6.fsf@gmail.com> Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Apr 2013 01:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 14089 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 14089@debbugs.gnu.org, monnier@iro.umontreal.ca, schulte.eric@gmail.com Original-Received: via spool by 14089-done@debbugs.gnu.org id=D14089.136590152715744 (code D ref 14089); Sun, 14 Apr 2013 01:06:02 +0000 Original-Received: (at 14089-done) by debbugs.gnu.org; 14 Apr 2013 01:05:27 +0000 Original-Received: from localhost ([127.0.0.1]:49394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URBNn-00045t-DW for submit@debbugs.gnu.org; Sat, 13 Apr 2013 21:05:27 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:54230) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URBNl-00045k-9X for 14089-done@debbugs.gnu.org; Sat, 13 Apr 2013 21:05:25 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApcMABK/CFFFxIEd/2dsb2JhbABEg0O3coNZF3OCez40JhgNiEigC6EijWGDKQOkeoFegxM X-IPAS-Result: ApcMABK/CFFFxIEd/2dsb2JhbABEg0O3coNZF3OCez40JhgNiEigC6EijWGDKQOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="7356204" Original-Received: from 69-196-129-29.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.129.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Apr 2013 21:01:17 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 4006CAE0BC; Sat, 13 Apr 2013 21:01:21 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:73387 Archived-At: I installed the patch below which should make it possible to have colons in local variables. Stefan === modified file 'lisp/files.el' --- lisp/files.el 2013-04-06 07:41:09 +0000 +++ lisp/files.el 2013-04-14 00:56:39 +0000 @@ -3029,6 +3029,9 @@ (prog1 (memq char '(?! ?\s ?y)) (quit-window t))))))) +(defconst hack-local-variable-regexp + "[ \t]*\\([^][;\"'?()\\ \t\n]+\\)[ \t]*:[ \t]*") + (defun hack-local-variables-prop-line (&optional mode-only) "Return local variables specified in the -*- line. Returns an alist of elements (VAR . VAL), where VAR is a variable @@ -3055,11 +3058,11 @@ ;; (last ";" is optional). ;; If MODE-ONLY, just check for `mode'. ;; Otherwise, parse the -*- line into the RESULT alist. - (while (and (or (not mode-only) - (not result)) - (< (point) end)) - (unless (looking-at "[ \t]*\\([^ \t\n:]+\\)[ \t]*:[ \t]*") - (message "Malformed mode-line") + (while (not (or (and mode-only result) + (>= (point) end))) + (unless (looking-at hack-local-variable-regexp) + (message "Malformed mode-line: %S" + (buffer-substring-no-properties (point) end)) (throw 'malformed-line nil)) (goto-char (match-end 0)) ;; There used to be a downcase here, @@ -3211,8 +3214,7 @@ (prefix (concat "^" (regexp-quote (buffer-substring (line-beginning-position) - (match-beginning 0))))) - beg) + (match-beginning 0)))))) (forward-line 1) (let ((startpos (point)) @@ -3247,18 +3249,16 @@ (forward-line 1)) (goto-char (point-min)) - (while (and (not (eobp)) - (or (not mode-only) - (not result))) - ;; Find the variable name; strip whitespace. - (skip-chars-forward " \t") - (setq beg (point)) - (skip-chars-forward "^:\n") - (if (eolp) (error "Missing colon in local variables entry")) - (skip-chars-backward " \t") - (let* ((str (buffer-substring beg (point))) - (var (let ((read-circle nil)) - (read str))) + (while (not (or (eobp) + (and mode-only result))) + ;; Find the variable name; + (unless (looking-at hack-local-variable-regexp) + (error "Malformed local variable line: %S" + (buffer-substring-no-properties + (point) (line-end-position)))) + (goto-char (match-end 1)) + (let* ((str (match-string 1)) + (var (intern str)) val val2) (and (equal (downcase (symbol-name var)) "mode") (setq var 'mode))