diff options
| author | Glenn Morris | 2008-01-04 03:14:56 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-01-04 03:14:56 +0000 |
| commit | 6e4fcd29a714c2bda77ad4b213bd5a7075948986 (patch) | |
| tree | f215bfe046b0fbd522630daddacd0104f23b41f7 /lisp | |
| parent | 26dac56cb6f2adb36113b05af3d389320bbc645f (diff) | |
| download | emacs-6e4fcd29a714c2bda77ad4b213bd5a7075948986.tar.gz emacs-6e4fcd29a714c2bda77ad4b213bd5a7075948986.zip | |
(defcustom-c-stylevar): Revert previous change (merge mistake).
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/cc-vars.el | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index b1fcdc22241..6110ab2250f 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -156,34 +156,44 @@ Useful as last item in a `choice' widget." | |||
| 156 | (setq c-fallback-style (cons (cons name val) c-fallback-style))) | 156 | (setq c-fallback-style (cons (cons name val) c-fallback-style))) |
| 157 | 157 | ||
| 158 | (defmacro defcustom-c-stylevar (name val doc &rest args) | 158 | (defmacro defcustom-c-stylevar (name val doc &rest args) |
| 159 | "Defines a style variable." | 159 | "Define a style variable NAME with VAL and DOC. |
| 160 | `(let ((-value- ,val)) | 160 | More precisely, convert the given `:type FOO', mined out of ARGS, |
| 161 | (c-set-stylevar-fallback ',name -value-) | 161 | to an aggregate `:type (radio STYLE (PREAMBLE FOO))', append some |
| 162 | (custom-declare-variable | 162 | some boilerplate documentation to DOC, arrange for the fallback |
| 163 | ',name ''set-from-style | 163 | value of NAME to be VAL, and call `custom-declare-variable' to |
| 164 | ,(concat doc " | 164 | do the rest of the work. |
| 165 | |||
| 166 | STYLE stands for the choice where the value is taken from some | ||
| 167 | style setting. PREAMBLE is optionally prepended to FOO; that is, | ||
| 168 | if FOO contains :tag or :value, the respective two-element list | ||
| 169 | component is ignored." | ||
| 170 | (declare (debug (symbolp form stringp &rest))) | ||
| 171 | (let* ((expanded-doc (concat doc " | ||
| 165 | 172 | ||
| 166 | This is a style variable. Apart from the valid values described | 173 | This is a style variable. Apart from the valid values described |
| 167 | above, it can be set to the symbol `set-from-style'. In that case, it | 174 | above, it can be set to the symbol `set-from-style'. In that case, |
| 168 | takes its value from the style system (see `c-default-style' and | 175 | it takes its value from the style system (see `c-default-style' and |
| 169 | `c-style-alist') when a CC Mode buffer is initialized. Otherwise, | 176 | `c-style-alist') when a CC Mode buffer is initialized. Otherwise, |
| 170 | the value set here overrides the style system (there is a variable | 177 | the value set here overrides the style system (there is a variable |
| 171 | `c-old-style-variable-behavior' that changes this, though).") | 178 | `c-old-style-variable-behavior' that changes this, though).")) |
| 172 | ,@(plist-put | 179 | (typ (eval (plist-get args :type))) |
| 173 | args ':type | 180 | (type (if (consp typ) typ (list typ))) |
| 174 | `(` (radio | 181 | (head (car type)) |
| 175 | (const :tag "Use style settings" | 182 | (tail (cdr type)) |
| 176 | set-from-style) | 183 | (newt (append (unless (plist-get tail :tag) |
| 177 | ,(, (let ((type (eval (plist-get args ':type)))) | 184 | '(:tag "Override style settings")) |
| 178 | (unless (consp type) | 185 | (unless (plist-get tail :value) |
| 179 | (setq type (list type))) | 186 | `(:value ,(eval val))) |
| 180 | (unless (c-safe (plist-get (cdr type) ':value)) | 187 | tail)) |
| 181 | (setcdr type (append '(:value (, -value-)) | 188 | (aggregate `'(radio |
| 182 | (cdr type)))) | 189 | (const :tag "Use style settings" set-from-style) |
| 183 | (unless (c-safe (plist-get (cdr type) ':tag)) | 190 | ,(cons head newt)))) |
| 184 | (setcdr type (append '(:tag "Override style settings") | 191 | `(progn |
| 185 | (cdr type)))) | 192 | (c-set-stylevar-fallback ',name ,val) |
| 186 | (bq-process type))))))))) | 193 | (custom-declare-variable |
| 194 | ',name ''set-from-style | ||
| 195 | ,expanded-doc | ||
| 196 | ,@(plist-put args :type aggregate))))) | ||
| 187 | 197 | ||
| 188 | (defun c-valid-offset (offset) | 198 | (defun c-valid-offset (offset) |
| 189 | "Return non-nil if OFFSET is a valid offset for a syntactic symbol. | 199 | "Return non-nil if OFFSET is a valid offset for a syntactic symbol. |