From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Davison Newsgroups: gmane.emacs.devel Subject: File local variable name containing ':' Date: Thu, 02 Sep 2010 19:56:04 -0400 Message-ID: <87r5hbzomj.fsf@stats.ox.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283499925 25042 80.91.229.12 (3 Sep 2010 07:45:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Sep 2010 07:45:25 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 03 09:45:24 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OrQxd-0003c8-74 for ged-emacs-devel@m.gmane.org; Fri, 03 Sep 2010 09:45:21 +0200 Original-Received: from localhost ([127.0.0.1]:41215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrQxc-0000CF-69 for ged-emacs-devel@m.gmane.org; Fri, 03 Sep 2010 03:45:20 -0400 Original-Received: from [140.186.70.92] (port=43265 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrJdb-0005A8-MC for emacs-devel@gnu.org; Thu, 02 Sep 2010 19:56:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrJdY-0005c6-Ej for emacs-devel@gnu.org; Thu, 02 Sep 2010 19:56:09 -0400 Original-Received: from markov.stats.ox.ac.uk ([163.1.210.1]:55942) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrJdY-0005c2-1J for emacs-devel@gnu.org; Thu, 02 Sep 2010 19:56:08 -0400 Original-Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o82Nu6Mu003309 for ; Fri, 3 Sep 2010 00:56:06 +0100 (BST) Original-Received: by blackcap.stats.ox.ac.uk (Postfix, from userid 5158) id 8F9CD2035A; Fri, 3 Sep 2010 00:56:06 +0100 (BST) User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 8 (1) X-Mailman-Approved-At: Fri, 03 Sep 2010 03:45:13 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129627 Archived-At: I think it isn't possible to use a Local Variables line to set the value of a variable whose name contains a colon . E.g. something like # Local Variables: # var:name: value # End: doesn't work because of the colon in var:name. Assuming I'm not overlooking an easy workaround, it seems that one possible fix would be to recognise the separator character on-the-fly as the character following the word "Variables". For what it's worth, I did have a go at making that change (below). Could this behaviour be changed or is this a limitation that's here to stay? Dan --8<---------------cut here---------------start------------->8--- diff --git a/lisp/files.el b/lisp/files.el index 3d9dd90..68ba1f0 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3053,7 +3053,7 @@ If MODE-ONLY is non-nil, all we do is check whether the major mode is specified, returning t if it is specified." (let ((enable-local-variables (and local-enable-local-variables enable-local-variables)) - result) + result separator) (unless mode-only (setq file-local-variables-alist nil) (report-errors "Directory-local variables error: %s" @@ -3066,10 +3066,11 @@ is specified, returning t if it is specified." (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) (when (let ((case-fold-search t)) - (search-forward "Local Variables:" nil t)) + (re-search-forward "Local Variables\\([^ \t\n]\\)" nil t)) + (setq separator (match-string 1)) (skip-chars-forward " \t") - ;; suffix is what comes after "local variables:" in its line. - ;; prefix is what comes before "local variables:" in its line. + ;; suffix is what comes after "local variables" in its line. + ;; prefix is what comes before "local variables" in its line. (let ((suffix (concat (regexp-quote (buffer-substring (point) @@ -3088,7 +3089,7 @@ is specified, returning t if it is specified." (save-excursion (unless (let ((case-fold-search t)) (re-search-forward - (concat prefix "[ \t]*End:[ \t]*" suffix) + (concat prefix "[ \t]*End" separator "[ \t]*" suffix) nil t)) ;; This used to be an error, but really all it means is ;; that this may simply not be a local-variables section, @@ -3118,15 +3119,15 @@ is specified, returning t if it is specified." ;; 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-forward (concat "^\n" separator)) + (if (eolp) (error "Missing separator character in local variables entry")) (skip-chars-backward " \t") (let* ((str (buffer-substring beg (point))) (var (let ((read-circle nil)) (read str))) val) ;; Read the variable value. - (skip-chars-forward "^:") + (skip-chars-forward (concat "^" separator)) (forward-char 1) (let ((read-circle nil)) (setq val (read (current-buffer)))) --8<---------------cut here---------------end--------------->8---