aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2008-01-04 03:14:56 +0000
committerGlenn Morris2008-01-04 03:14:56 +0000
commit6e4fcd29a714c2bda77ad4b213bd5a7075948986 (patch)
treef215bfe046b0fbd522630daddacd0104f23b41f7 /lisp
parent26dac56cb6f2adb36113b05af3d389320bbc645f (diff)
downloademacs-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.el58
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)) 160More precisely, convert the given `:type FOO', mined out of ARGS,
161 (c-set-stylevar-fallback ',name -value-) 161to an aggregate `:type (radio STYLE (PREAMBLE FOO))', append some
162 (custom-declare-variable 162some boilerplate documentation to DOC, arrange for the fallback
163 ',name ''set-from-style 163value of NAME to be VAL, and call `custom-declare-variable' to
164 ,(concat doc " 164do the rest of the work.
165
166STYLE stands for the choice where the value is taken from some
167style setting. PREAMBLE is optionally prepended to FOO; that is,
168if FOO contains :tag or :value, the respective two-element list
169component is ignored."
170 (declare (debug (symbolp form stringp &rest)))
171 (let* ((expanded-doc (concat doc "
165 172
166This is a style variable. Apart from the valid values described 173This is a style variable. Apart from the valid values described
167above, it can be set to the symbol `set-from-style'. In that case, it 174above, it can be set to the symbol `set-from-style'. In that case,
168takes its value from the style system (see `c-default-style' and 175it 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,
170the value set here overrides the style system (there is a variable 177the 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.