diff options
| author | Juanma Barranquero | 2019-06-27 13:26:45 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-06-27 13:26:45 +0200 |
| commit | e3b70e6b2dc5805fa92c9ddbf42fed81ed835f1b (patch) | |
| tree | 8c7284ea70fb42c0eb0b9ef2c38faedc668e0f71 | |
| parent | 1d9bb2ff70ca65dbfdd2ec904b8f6d9e07a6e9c5 (diff) | |
| download | emacs-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/NEWS | 5 | ||||
| -rw-r--r-- | lisp/custom.el | 8 |
2 files changed, 13 insertions, 0 deletions
| @@ -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 | ||
| 1795 | buffer-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 |
| 1795 | specific byte-compile warnings. | 1800 | specific 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 | ||
| 255 | The following common keywords are also meaningful. | 263 | The following common keywords are also meaningful. |
| 256 | 264 | ||