[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112280: * lisp/files.el: Allow : in
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112280: * lisp/files.el: Allow : in local variables. |
Date: |
Sat, 13 Apr 2013 20:59:48 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 112280
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14089
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2013-04-13 20:59:48 -0400
message:
* lisp/files.el: Allow : in local variables.
(hack-local-variable-regexp): New var.
(hack-local-variables-prop-line, hack-local-variables): Use it.
modified:
lisp/ChangeLog
lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-04-13 20:45:03 +0000
+++ b/lisp/ChangeLog 2013-04-14 00:59:48 +0000
@@ -1,3 +1,9 @@
+2013-04-14 Stefan Monnier <address@hidden>
+
+ * files.el: Allow : in local variables (bug#14089).
+ (hack-local-variable-regexp): New var.
+ (hack-local-variables-prop-line, hack-local-variables): Use it.
+
2013-04-13 Roland Winkler <address@hidden>
* textmodes/bibtex.el (bibtex-search-entries): Bug fix. Use match
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2013-04-06 07:41:09 +0000
+++ b/lisp/files.el 2013-04-14 00:59:48 +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))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112280: * lisp/files.el: Allow : in local variables.,
Stefan Monnier <=