diff options
| author | Glenn Morris | 2011-05-09 19:31:42 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-05-09 19:31:42 -0700 |
| commit | b8f82dc15fc7370329930323082d9faf2a5fc7ad (patch) | |
| tree | 6d8c9e61daee68c5d443165b2d18ec7af864df84 | |
| parent | 4f99f44b34c11935e00eb7acd3d464abd903ab53 (diff) | |
| download | emacs-b8f82dc15fc7370329930323082d9faf2a5fc7ad.tar.gz emacs-b8f82dc15fc7370329930323082d9faf2a5fc7ad.zip | |
Deprecate using "mode:" to enable minor modes (bug#8613)
* 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:".
| -rw-r--r-- | doc/emacs/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/emacs/custom.texi | 14 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/doc-view.el | 2 | ||||
| -rw-r--r-- | lisp/files.el | 34 | ||||
| -rw-r--r-- | lisp/net/soap-client.el | 2 |
7 files changed, 43 insertions, 24 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index b417e806245..d3521dcd524 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-05-10 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * custom.texi (Specifying File Variables): | ||
| 4 | Deprecate using mode: for minor modes. | ||
| 5 | |||
| 1 | 2011-05-07 Glenn Morris <rgm@gnu.org> | 6 | 2011-05-07 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * cal-xtra.texi (Sexp Diary Entries): Mention diary-hebrew-birthday. | 8 | * cal-xtra.texi (Sexp Diary Entries): Mention diary-hebrew-birthday. |
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 7a696df319b..d7a99d49d60 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -1085,9 +1085,8 @@ first line: | |||
| 1085 | You can specify any number of variable/value pairs in this way, each | 1085 | You can specify any number of variable/value pairs in this way, each |
| 1086 | pair with a colon and semicolon as shown above. The special | 1086 | pair with a colon and semicolon as shown above. The special |
| 1087 | variable/value pair @code{mode: @var{modename};}, if present, | 1087 | variable/value pair @code{mode: @var{modename};}, if present, |
| 1088 | specifies a major or minor mode; if you use this to specify a major | 1088 | specifies a major mode, and should come first in the line. The |
| 1089 | mode, it should come first in the line. The @var{value}s are used | 1089 | @var{value}s are used literally, and not evaluated. |
| 1090 | literally, and not evaluated. | ||
| 1091 | 1090 | ||
| 1092 | @findex add-file-local-variable-prop-line | 1091 | @findex add-file-local-variable-prop-line |
| 1093 | @findex delete-file-local-variable-prop-line | 1092 | @findex delete-file-local-variable-prop-line |
| @@ -1186,7 +1185,7 @@ list: | |||
| 1186 | 1185 | ||
| 1187 | @itemize | 1186 | @itemize |
| 1188 | @item | 1187 | @item |
| 1189 | @code{mode} enables the specified major or minor mode. | 1188 | @code{mode} enables the specified major mode. |
| 1190 | 1189 | ||
| 1191 | @item | 1190 | @item |
| 1192 | @code{eval} evaluates the specified Lisp expression (the value | 1191 | @code{eval} evaluates the specified Lisp expression (the value |
| @@ -1213,10 +1212,11 @@ variables as part of their initialization. | |||
| 1213 | You can use the @code{mode} ``variable'' to enable minor modes as | 1212 | You can use the @code{mode} ``variable'' to enable minor modes as |
| 1214 | well as the major modes; in fact, you can use it more than once, first | 1213 | well as the major modes; in fact, you can use it more than once, first |
| 1215 | to set the major mode and then to enable minor modes which are | 1214 | to set the major mode and then to enable minor modes which are |
| 1216 | specific to particular buffers. | 1215 | specific to particular buffers. Using @code{mode} for minor modes |
| 1216 | is deprecated, though---instead, use @code{eval: (minor-mode)}. | ||
| 1217 | 1217 | ||
| 1218 | Often, however, it is a mistake to enable minor modes this way. | 1218 | Often, however, it is a mistake to enable minor modes in file local |
| 1219 | Most minor modes, like Auto Fill mode, represent individual user | 1219 | variables. Most minor modes, like Auto Fill mode, represent individual user |
| 1220 | preferences. If you want to use a minor mode, it is better to set up | 1220 | preferences. If you want to use a minor mode, it is better to set up |
| 1221 | major mode hooks with your init file to turn that minor mode on for | 1221 | major mode hooks with your init file to turn that minor mode on for |
| 1222 | yourself alone (@pxref{Init File}), instead of using a local variable | 1222 | yourself alone (@pxref{Init File}), instead of using a local variable |
| @@ -267,6 +267,10 @@ default, all themes included in Emacs are treated as safe. | |||
| 267 | ** The user option `remote-file-name-inhibit-cache' controls whether | 267 | ** The user option `remote-file-name-inhibit-cache' controls whether |
| 268 | the remote file-name cache is used for read access. | 268 | the remote file-name cache is used for read access. |
| 269 | 269 | ||
| 270 | +++ | ||
| 271 | ** The use of a "mode: minor" specification in a file local variables section | ||
| 272 | to enable a minor-mode is deprecated. Instead, use "eval: (minor-mode)". | ||
| 273 | |||
| 270 | ** The standalone programs lib-src/digest-doc and sorted-doc have been | 274 | ** The standalone programs lib-src/digest-doc and sorted-doc have been |
| 271 | replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'. | 275 | replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'. |
| 272 | 276 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cbb03baa3bf..50c3022ba0a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,4 +1,10 @@ | |||
| 1 | 2011-05-10 Glenn Morris <rgm@gnu.org> | 1 | 2011-05-10 Glenn Morris <rgm@gnu.org> |
| 2 | Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 3 | |||
| 4 | * files.el (hack-one-local-variable-eval-safep): | ||
| 5 | Consider "eval: (foo-mode)" to be safe. (Bug#8613) | ||
| 6 | |||
| 7 | 2011-05-10 Glenn Morris <rgm@gnu.org> | ||
| 2 | 8 | ||
| 3 | * calendar/diary-lib.el (diary-list-entries-hook) | 9 | * calendar/diary-lib.el (diary-list-entries-hook) |
| 4 | (diary-mark-entries-hook, diary-nongregorian-listing-hook) | 10 | (diary-mark-entries-hook, diary-nongregorian-listing-hook) |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index ab0d6bf837b..7bd1a55011e 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -1549,7 +1549,7 @@ See the command `doc-view-mode' for more information on this mode." | |||
| 1549 | (provide 'doc-view) | 1549 | (provide 'doc-view) |
| 1550 | 1550 | ||
| 1551 | ;; Local Variables: | 1551 | ;; Local Variables: |
| 1552 | ;; mode: outline-minor | 1552 | ;; eval: (outline-minor-mode) |
| 1553 | ;; End: | 1553 | ;; End: |
| 1554 | 1554 | ||
| 1555 | ;;; doc-view.el ends here | 1555 | ;;; doc-view.el ends here |
diff --git a/lisp/files.el b/lisp/files.el index 72cfc89ef8c..336a0a436f9 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3327,21 +3327,25 @@ It is dangerous if either of these conditions are met: | |||
| 3327 | ;; Certain functions can be allowed with safe arguments | 3327 | ;; Certain functions can be allowed with safe arguments |
| 3328 | ;; or can specify verification functions to try. | 3328 | ;; or can specify verification functions to try. |
| 3329 | (and (symbolp (car exp)) | 3329 | (and (symbolp (car exp)) |
| 3330 | (let ((prop (get (car exp) 'safe-local-eval-function))) | 3330 | ;; Allow (minor)-modes calls with no arguments. |
| 3331 | (cond ((eq prop t) | 3331 | ;; This obsoletes the use of "mode:" for such things. (Bug#8613) |
| 3332 | (let ((ok t)) | 3332 | (or (and (null (cdr exp)) |
| 3333 | (dolist (arg (cdr exp)) | 3333 | (string-match "-mode\\'" (symbol-name (car exp)))) |
| 3334 | (unless (hack-one-local-variable-constantp arg) | 3334 | (let ((prop (get (car exp) 'safe-local-eval-function))) |
| 3335 | (setq ok nil))) | 3335 | (cond ((eq prop t) |
| 3336 | ok)) | 3336 | (let ((ok t)) |
| 3337 | ((functionp prop) | 3337 | (dolist (arg (cdr exp)) |
| 3338 | (funcall prop exp)) | 3338 | (unless (hack-one-local-variable-constantp arg) |
| 3339 | ((listp prop) | 3339 | (setq ok nil))) |
| 3340 | (let ((ok nil)) | 3340 | ok)) |
| 3341 | (dolist (function prop) | 3341 | ((functionp prop) |
| 3342 | (if (funcall function exp) | 3342 | (funcall prop exp)) |
| 3343 | (setq ok t))) | 3343 | ((listp prop) |
| 3344 | ok))))))) | 3344 | (let ((ok nil)) |
| 3345 | (dolist (function prop) | ||
| 3346 | (if (funcall function exp) | ||
| 3347 | (setq ok t))) | ||
| 3348 | ok)))))))) | ||
| 3345 | 3349 | ||
| 3346 | (defun hack-one-local-variable (var val) | 3350 | (defun hack-one-local-variable (var val) |
| 3347 | "Set local variable VAR with value VAL. | 3351 | "Set local variable VAR with value VAL. |
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index b5453733d1d..9862332bf3f 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -1745,7 +1745,7 @@ operations in a WSDL document." | |||
| 1745 | 1745 | ||
| 1746 | 1746 | ||
| 1747 | ;;; Local Variables: | 1747 | ;;; Local Variables: |
| 1748 | ;;; mode: outline-minor | 1748 | ;;; eval: (outline-minor-mode) |
| 1749 | ;;; outline-regexp: ";;;;+" | 1749 | ;;; outline-regexp: ";;;;+" |
| 1750 | ;;; End: | 1750 | ;;; End: |
| 1751 | 1751 | ||