summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2008-01-14 22:35:40 +0000
committerAlan Mackenzie <acm@muc.de>2008-01-14 22:35:40 +0000
commitb4d0e5173bc7f418dad60143f85b74ffd8983a1a (patch)
treeb2ea893c24eb590beb2704ca6f42d4188102bb14
parent872efa5166f423b54e6c33fd2d50003087819666 (diff)
downloademacs-b4d0e5173bc7f418dad60143f85b74ffd8983a1a.tar.gz
* progmodes/cc-vars.el (c-constant-symbol): New function which supersedes
c-const-symbol. During a customize-.. call it enables an element of (e.g.) c-hanging-braces alist to have its name displayed, even when the default value of c-h-b etc. doesn't include the elemnt. Replace uses of the old function by the new. * progmodes/cc-vars.el (c-hanging-braces-alist): Remove the obscure non-working fragment ":value c-".
-rw-r--r--lisp/progmodes/cc-vars.el49
1 files changed, 30 insertions, 19 deletions
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 25adb2be01b..5c5c4b3a001 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -73,8 +73,27 @@ Useful as last item in a `choice' widget."
:format "%t%n"
:value 'other))
+;; The next defun will supersede c-const-symbol.
+(defun c-constant-symbol (sym len)
+ "Create an uneditable symbol for customization buffers.
+SYM is the name of the symbol, LEN the length of the field (in
+characters) the symbol will be displayed in. LEN must be big
+enough.
+
+This returns a (const ....) structure, suitable for embedding
+within a customization type."
+ (or (symbolp sym) (error "c-constant-symbol: %s is not a symbol" sym))
+ (let* ((name (symbol-name sym))
+ (l (length name))
+ (disp (concat name ":" (make-string (- len l 1) ?\ ))))
+ `(const
+ :size ,len
+ :format ,disp
+ :value ,sym)))
+
(define-widget 'c-const-symbol 'item
- "An uneditable lisp symbol."
+ "An uneditable lisp symbol. This is obsolete -
+use c-constant-symbol instead."
:value nil
:tag "Symbol"
:format "%t: %v\n%d"
@@ -405,9 +424,7 @@ in that case, i.e. as if \\[c-indent-command] was used instead."
`(set ,@(mapcar
(lambda (elt)
`(cons :format "%v"
- (c-const-symbol :format "%v: "
- :size 20
- :value ,elt)
+ ,(c-constant-symbol elt 20)
(choice
:format "%[Choice%] %v"
:value (column . nil)
@@ -743,18 +760,15 @@ syntactic context for the brace line."
`(set ,@(mapcar
(lambda (elt)
`(cons :format "%v"
- (c-const-symbol :format "%v: "
- :size 20
- :value ,elt)
+ ,(c-constant-symbol elt 24)
(choice :format "%[Choice%] %v"
:value (before after)
(set :menu-tag "Before/after"
- :format "Newline %v brace\n"
- (const :format "%v, " before)
- (const :format "%v" after))
+ :format "Newline %v brace\n"
+ (const :format "%v, " before)
+ (const :format "%v " after))
(function :menu-tag "Function"
- :format "Run function: %v"
- :value c-))))
+ :format "Run function: %v"))))
'(defun-open defun-close
class-open class-close
inline-open inline-close
@@ -790,11 +804,9 @@ currently not supported for this variable."
`(set ,@(mapcar
(lambda (elt)
`(cons :format "%v"
- (c-const-symbol :format "%v: "
- :size 20
- :value ,elt)
- (set :format "Newline %v brace\n"
- (const :format "%v, " before)
+ ,(c-constant-symbol elt 20)
+ (set :format "Newline %v colon\n"
+ (const :format "%v, " before)
(const :format "%v" after))))
'(case-label label access-label member-init-intro inher-intro)))
:group 'c)
@@ -1307,8 +1319,7 @@ Here is the current list of valid syntactic element symbols:
(lambda (elt)
`(cons :format "%v"
:value ,elt
- (c-const-symbol :format "%v: "
- :size 25)
+ ,(c-constant-symbol (car elt) 25)
(sexp :format "%v"
:validate
(lambda (widget)