aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2019-06-27 13:26:45 +0200
committerLars Ingebrigtsen2019-06-27 13:26:45 +0200
commite3b70e6b2dc5805fa92c9ddbf42fed81ed835f1b (patch)
tree8c7284ea70fb42c0eb0b9ef2c38faedc668e0f71
parent1d9bb2ff70ca65dbfdd2ec904b8f6d9e07a6e9c5 (diff)
downloademacs-e3b70e6b2dc5805fa92c9ddbf42fed81ed835f1b.tar.gz
emacs-e3b70e6b2dc5805fa92c9ddbf42fed81ed835f1b.zip
Add :local specifier to defcustom
* lisp/custom.el (custom-declare-variable): Allow the new :local parameter (bug#14591). (defcustom): Document it.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/custom.el8
2 files changed, 13 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 29b74ee682b..10882e4ec45 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1790,6 +1790,11 @@ valid event type.
1790 1790
1791* Lisp Changes in Emacs 27.1 1791* Lisp Changes in Emacs 27.1
1792 1792
1793** defcustom now takes a :local keyword that can be either t or
1794`permanent', which mean that the variable should be automatically
1795buffer-local. `permanent' also sets the variable's
1796`permanent-local' property.
1797
1793+++ 1798+++
1794** The new macro `with-suppressed-warnings' can be used to suppress 1799** The new macro `with-suppressed-warnings' can be used to suppress
1795specific byte-compile warnings. 1800specific byte-compile warnings.
diff --git a/lisp/custom.el b/lisp/custom.el
index 29bf9e570a8..736460fec7b 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -181,6 +181,11 @@ set to nil, as the value is no longer rogue."
181 (put symbol 'risky-local-variable value)) 181 (put symbol 'risky-local-variable value))
182 ((eq keyword :safe) 182 ((eq keyword :safe)
183 (put symbol 'safe-local-variable value)) 183 (put symbol 'safe-local-variable value))
184 ((eq keyword :local)
185 (when (memq value '(t permanent))
186 (make-variable-buffer-local symbol))
187 (when (eq value 'permanent)
188 (put symbol 'permanent-local t)))
184 ((eq keyword :type) 189 ((eq keyword :type)
185 (put symbol 'custom-type (purecopy value))) 190 (put symbol 'custom-type (purecopy value)))
186 ((eq keyword :options) 191 ((eq keyword :options)
@@ -251,6 +256,9 @@ The following keywords are meaningful:
251:risky Set SYMBOL's `risky-local-variable' property to VALUE. 256:risky Set SYMBOL's `risky-local-variable' property to VALUE.
252:safe Set SYMBOL's `safe-local-variable' property to VALUE. 257:safe Set SYMBOL's `safe-local-variable' property to VALUE.
253 See Info node `(elisp) File Local Variables'. 258 See Info node `(elisp) File Local Variables'.
259:local If VALUE is t, mark SYMBOL as automatically buffer-local.
260 If VALUE is `permanent', also set SYMBOL's `permanent-local'
261 property to t.
254 262
255The following common keywords are also meaningful. 263The following common keywords are also meaningful.
256 264