summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-05-21 18:18:49 -0700
committerGlenn Morris <rgm@gnu.org>2011-05-21 18:18:49 -0700
commit162d78a17e0da16bdcb0c2d5633f8fdaf323f407 (patch)
tree8f07a433257f4f0a74ea87a14a32898d7f5404ef /lisp/files.el
parent80614e570147005ed87f1f676c7d4926930eba6e (diff)
downloademacs-162d78a17e0da16bdcb0c2d5633f8fdaf323f407.tar.gz
emacs-162d78a17e0da16bdcb0c2d5633f8fdaf323f407.tar.bz2
emacs-162d78a17e0da16bdcb0c2d5633f8fdaf323f407.zip
Further tweak previous files.el change.
* lisp/files.el (hack-local-variables): In the MODE-ONLY case, try to ignore minor modes.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 1d560ace065..24a0e0a5b62 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3147,7 +3147,9 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil."
(defun hack-local-variables (&optional mode-only)
"Parse and put into effect this buffer's local variables spec.
If MODE-ONLY is non-nil, all we do is check whether a \"mode:\"
-is specified, and return the corresponding mode symbol, or nil."
+is specified, and return the corresponding mode symbol, or nil.
+In this case, we try to ignore minor-modes, and only return a
+major-mode."
(let ((enable-local-variables
(and local-enable-local-variables enable-local-variables))
result)
@@ -3226,17 +3228,20 @@ is specified, and return the corresponding mode symbol, or nil."
(let* ((str (buffer-substring beg (point)))
(var (let ((read-circle nil))
(read str)))
- val)
+ val val2)
;; Read the variable value.
(skip-chars-forward "^:")
(forward-char 1)
(let ((read-circle nil))
(setq val (read (current-buffer))))
(if mode-only
- (if (eq var 'mode)
- (setq result
- (intern (concat (symbol-name val)
- "-mode"))))
+ (and (eq var 'mode)
+ ;; Specifying minor-modes via mode: is
+ ;; deprecated, but try to reject them anyway.
+ (not (string-match
+ "-minor\\'"
+ (setq val2 (symbol-name val))))
+ (setq result (intern (concat val2 "-mode"))))
(unless (eq var 'coding)
(condition-case nil
(push (cons (if (eq var 'eval)