]> git.eshelyaron.com Git - emacs.git/commitdiff
Deprecate using "mode:" to enable minor modes (bug#8613)
authorGlenn Morris <rgm@gnu.org>
Tue, 10 May 2011 02:31:42 +0000 (19:31 -0700)
committerGlenn Morris <rgm@gnu.org>
Tue, 10 May 2011 02:31:42 +0000 (19:31 -0700)
* lisp/files.el (hack-one-local-variable-eval-safep):
Consider "eval: (foo-mode)" to be safe.

* doc/emacs/custom.texi (Specifying File Variables):
Deprecate using mode: for minor modes.

* etc/NEWS: Mention this.

* lisp/doc-view.el, lisp/net/soap-client.el:
Change "mode:" minor-mode file local variables to use "eval:".

doc/emacs/ChangeLog
doc/emacs/custom.texi
etc/NEWS
lisp/ChangeLog
lisp/doc-view.el
lisp/files.el
lisp/net/soap-client.el

index b417e806245c35a16bb63198cbed81c303bc2f6e..d3521dcd5242c8aafb58873719e32b9b9d0c9b69 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * custom.texi (Specifying File Variables):
+       Deprecate using mode: for minor modes.
+
 2011-05-07  Glenn Morris  <rgm@gnu.org>
 
        * cal-xtra.texi (Sexp Diary Entries): Mention diary-hebrew-birthday.
index 7a696df319b4ee8473d4660e396c41cf301ea92b..d7a99d49d60781deb4c5813a2b8bd274cfe6aefe 100644 (file)
@@ -1085,9 +1085,8 @@ first line:
 You can specify any number of variable/value pairs in this way, each
 pair with a colon and semicolon as shown above.  The special
 variable/value pair @code{mode: @var{modename};}, if present,
-specifies a major or minor mode; if you use this to specify a major
-mode, it should come first in the line.  The @var{value}s are used
-literally, and not evaluated.
+specifies a major mode, and should come first in the line.  The
+@var{value}s are used literally, and not evaluated.
 
 @findex add-file-local-variable-prop-line
 @findex delete-file-local-variable-prop-line
@@ -1186,7 +1185,7 @@ list:
 
 @itemize
 @item
-@code{mode} enables the specified major or minor mode.
+@code{mode} enables the specified major mode.
 
 @item
 @code{eval} evaluates the specified Lisp expression (the value
@@ -1213,10 +1212,11 @@ variables as part of their initialization.
   You can use the @code{mode} ``variable'' to enable minor modes as
 well as the major modes; in fact, you can use it more than once, first
 to set the major mode and then to enable minor modes which are
-specific to particular buffers.
+specific to particular buffers.  Using @code{mode} for minor modes
+is deprecated, though---instead, use @code{eval: (minor-mode)}. 
 
-  Often, however, it is a mistake to enable minor modes this way.
-Most minor modes, like Auto Fill mode, represent individual user
+  Often, however, it is a mistake to enable minor modes in file local
+variables.  Most minor modes, like Auto Fill mode, represent individual user
 preferences.  If you want to use a minor mode, it is better to set up
 major mode hooks with your init file to turn that minor mode on for
 yourself alone (@pxref{Init File}), instead of using a local variable
index 9e9778c6ac15b91c58e3ceb508c512d2d1570106..7da456dfc3ded998aceff76a0706aac9c8918fd5 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -267,6 +267,10 @@ default, all themes included in Emacs are treated as safe.
 ** The user option `remote-file-name-inhibit-cache' controls whether
 the remote file-name cache is used for read access.
 
++++
+** The use of a "mode: minor" specification in a file local variables section
+to enable a minor-mode is deprecated.  Instead, use "eval: (minor-mode)".
+
 ** The standalone programs lib-src/digest-doc and sorted-doc have been
 replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'.
 
index cbb03baa3bf6616614ccb6dafdd36e0f46ee3b73..50c3022ba0a3fc68098c1e24cd63c9afc4b9da90 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-10  Glenn Morris  <rgm@gnu.org>
+          Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * files.el (hack-one-local-variable-eval-safep):
+       Consider "eval: (foo-mode)" to be safe.  (Bug#8613)
+
 2011-05-10  Glenn Morris  <rgm@gnu.org>
 
        * calendar/diary-lib.el (diary-list-entries-hook)
index ab0d6bf837b170283ee1fd7da88235f8023a4556..7bd1a55011e37e36fa96fc89aa857b98bfd2b548 100644 (file)
@@ -1549,7 +1549,7 @@ See the command `doc-view-mode' for more information on this mode."
 (provide 'doc-view)
 
 ;; Local Variables:
-;; mode: outline-minor
+;; eval: (outline-minor-mode)
 ;; End:
 
 ;;; doc-view.el ends here
index 72cfc89ef8c1109dff69536f8f6aad23ca61d20e..336a0a436f9e72c12db615391723e232c949ebd4 100644 (file)
@@ -3327,21 +3327,25 @@ It is dangerous if either of these conditions are met:
       ;; Certain functions can be allowed with safe arguments
       ;; or can specify verification functions to try.
       (and (symbolp (car exp))
-          (let ((prop (get (car exp) 'safe-local-eval-function)))
-            (cond ((eq prop t)
-                   (let ((ok t))
-                     (dolist (arg (cdr exp))
-                       (unless (hack-one-local-variable-constantp arg)
-                         (setq ok nil)))
-                     ok))
-                  ((functionp prop)
-                   (funcall prop exp))
-                  ((listp prop)
-                   (let ((ok nil))
-                     (dolist (function prop)
-                       (if (funcall function exp)
-                           (setq ok t)))
-                     ok)))))))
+          ;; Allow (minor)-modes calls with no arguments.
+          ;; This obsoletes the use of "mode:" for such things.  (Bug#8613)
+          (or (and (null (cdr exp))
+                   (string-match "-mode\\'" (symbol-name (car exp))))
+              (let ((prop (get (car exp) 'safe-local-eval-function)))
+                (cond ((eq prop t)
+                       (let ((ok t))
+                         (dolist (arg (cdr exp))
+                           (unless (hack-one-local-variable-constantp arg)
+                             (setq ok nil)))
+                         ok))
+                      ((functionp prop)
+                       (funcall prop exp))
+                      ((listp prop)
+                       (let ((ok nil))
+                         (dolist (function prop)
+                           (if (funcall function exp)
+                               (setq ok t)))
+                         ok))))))))
 
 (defun hack-one-local-variable (var val)
   "Set local variable VAR with value VAL.
index b5453733d1db48b7f457d5cb9c91c0cfe1b276eb..9862332bf3f3c032df56f68ae8631f53ae7321c7 100644 (file)
@@ -1745,7 +1745,7 @@ operations in a WSDL document."
 
 \f
 ;;; Local Variables:
-;;; mode: outline-minor
+;;; eval: (outline-minor-mode)
 ;;; outline-regexp: ";;;;+"
 ;;; End: