diff options
| author | Alan Mackenzie | 2008-01-14 22:35:40 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2008-01-14 22:35:40 +0000 |
| commit | b4d0e5173bc7f418dad60143f85b74ffd8983a1a (patch) | |
| tree | b2ea893c24eb590beb2704ca6f42d4188102bb14 | |
| parent | 872efa5166f423b54e6c33fd2d50003087819666 (diff) | |
| download | emacs-b4d0e5173bc7f418dad60143f85b74ffd8983a1a.tar.gz emacs-b4d0e5173bc7f418dad60143f85b74ffd8983a1a.zip | |
* 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.el | 49 |
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." | |||
| 73 | :format "%t%n" | 73 | :format "%t%n" |
| 74 | :value 'other)) | 74 | :value 'other)) |
| 75 | 75 | ||
| 76 | ;; The next defun will supersede c-const-symbol. | ||
| 77 | (defun c-constant-symbol (sym len) | ||
| 78 | "Create an uneditable symbol for customization buffers. | ||
| 79 | SYM is the name of the symbol, LEN the length of the field (in | ||
| 80 | characters) the symbol will be displayed in. LEN must be big | ||
| 81 | enough. | ||
| 82 | |||
| 83 | This returns a (const ....) structure, suitable for embedding | ||
| 84 | within a customization type." | ||
| 85 | (or (symbolp sym) (error "c-constant-symbol: %s is not a symbol" sym)) | ||
| 86 | (let* ((name (symbol-name sym)) | ||
| 87 | (l (length name)) | ||
| 88 | (disp (concat name ":" (make-string (- len l 1) ?\ )))) | ||
| 89 | `(const | ||
| 90 | :size ,len | ||
| 91 | :format ,disp | ||
| 92 | :value ,sym))) | ||
| 93 | |||
| 76 | (define-widget 'c-const-symbol 'item | 94 | (define-widget 'c-const-symbol 'item |
| 77 | "An uneditable lisp symbol." | 95 | "An uneditable lisp symbol. This is obsolete - |
| 96 | use c-constant-symbol instead." | ||
| 78 | :value nil | 97 | :value nil |
| 79 | :tag "Symbol" | 98 | :tag "Symbol" |
| 80 | :format "%t: %v\n%d" | 99 | :format "%t: %v\n%d" |
| @@ -405,9 +424,7 @@ in that case, i.e. as if \\[c-indent-command] was used instead." | |||
| 405 | `(set ,@(mapcar | 424 | `(set ,@(mapcar |
| 406 | (lambda (elt) | 425 | (lambda (elt) |
| 407 | `(cons :format "%v" | 426 | `(cons :format "%v" |
| 408 | (c-const-symbol :format "%v: " | 427 | ,(c-constant-symbol elt 20) |
| 409 | :size 20 | ||
| 410 | :value ,elt) | ||
| 411 | (choice | 428 | (choice |
| 412 | :format "%[Choice%] %v" | 429 | :format "%[Choice%] %v" |
| 413 | :value (column . nil) | 430 | :value (column . nil) |
| @@ -743,18 +760,15 @@ syntactic context for the brace line." | |||
| 743 | `(set ,@(mapcar | 760 | `(set ,@(mapcar |
| 744 | (lambda (elt) | 761 | (lambda (elt) |
| 745 | `(cons :format "%v" | 762 | `(cons :format "%v" |
| 746 | (c-const-symbol :format "%v: " | 763 | ,(c-constant-symbol elt 24) |
| 747 | :size 20 | ||
| 748 | :value ,elt) | ||
| 749 | (choice :format "%[Choice%] %v" | 764 | (choice :format "%[Choice%] %v" |
| 750 | :value (before after) | 765 | :value (before after) |
| 751 | (set :menu-tag "Before/after" | 766 | (set :menu-tag "Before/after" |
| 752 | :format "Newline %v brace\n" | 767 | :format "Newline %v brace\n" |
| 753 | (const :format "%v, " before) | 768 | (const :format "%v, " before) |
| 754 | (const :format "%v" after)) | 769 | (const :format "%v " after)) |
| 755 | (function :menu-tag "Function" | 770 | (function :menu-tag "Function" |
| 756 | :format "Run function: %v" | 771 | :format "Run function: %v")))) |
| 757 | :value c-)))) | ||
| 758 | '(defun-open defun-close | 772 | '(defun-open defun-close |
| 759 | class-open class-close | 773 | class-open class-close |
| 760 | inline-open inline-close | 774 | inline-open inline-close |
| @@ -790,11 +804,9 @@ currently not supported for this variable." | |||
| 790 | `(set ,@(mapcar | 804 | `(set ,@(mapcar |
| 791 | (lambda (elt) | 805 | (lambda (elt) |
| 792 | `(cons :format "%v" | 806 | `(cons :format "%v" |
| 793 | (c-const-symbol :format "%v: " | 807 | ,(c-constant-symbol elt 20) |
| 794 | :size 20 | 808 | (set :format "Newline %v colon\n" |
| 795 | :value ,elt) | 809 | (const :format "%v, " before) |
| 796 | (set :format "Newline %v brace\n" | ||
| 797 | (const :format "%v, " before) | ||
| 798 | (const :format "%v" after)))) | 810 | (const :format "%v" after)))) |
| 799 | '(case-label label access-label member-init-intro inher-intro))) | 811 | '(case-label label access-label member-init-intro inher-intro))) |
| 800 | :group 'c) | 812 | :group 'c) |
| @@ -1307,8 +1319,7 @@ Here is the current list of valid syntactic element symbols: | |||
| 1307 | (lambda (elt) | 1319 | (lambda (elt) |
| 1308 | `(cons :format "%v" | 1320 | `(cons :format "%v" |
| 1309 | :value ,elt | 1321 | :value ,elt |
| 1310 | (c-const-symbol :format "%v: " | 1322 | ,(c-constant-symbol (car elt) 25) |
| 1311 | :size 25) | ||
| 1312 | (sexp :format "%v" | 1323 | (sexp :format "%v" |
| 1313 | :validate | 1324 | :validate |
| 1314 | (lambda (widget) | 1325 | (lambda (widget) |