comparison lisp/progmodes/cc-vars.el @ 91367:c70e45a7acfd

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
author Miles Bader <miles@gnu.org>
date Wed, 30 Jan 2008 07:57:28 +0000
parents 606f2d163a64 a31afa284500
children
comparison
equal deleted inserted replaced
91366:86f3a8f0a3a6 91367:c70e45a7acfd
71 Useful as last item in a `choice' widget." 71 Useful as last item in a `choice' widget."
72 :tag "Other" 72 :tag "Other"
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 (eval-and-compile
78 (defun c-constant-symbol (sym len)
79 "Create an uneditable symbol for customization buffers.
80 SYM is the name of the symbol, LEN the length of the field (in
81 characters) the symbol will be displayed in. LEN must be big
82 enough.
83
84 This returns a (const ....) structure, suitable for embedding
85 within a customization type."
86 (or (symbolp sym) (error "c-constant-symbol: %s is not a symbol" sym))
87 (let* ((name (symbol-name sym))
88 (l (length name))
89 (disp (concat name ":" (make-string (- len l 1) ?\ ))))
90 `(const
91 :size ,len
92 :format ,disp
93 :value ,sym))))
94
76 (define-widget 'c-const-symbol 'item 95 (define-widget 'c-const-symbol 'item
77 "An uneditable lisp symbol." 96 "An uneditable lisp symbol. This is obsolete -
97 use c-constant-symbol instead."
78 :value nil 98 :value nil
79 :tag "Symbol" 99 :tag "Symbol"
80 :format "%t: %v\n%d" 100 :format "%t: %v\n%d"
81 :match (lambda (widget value) (symbolp value)) 101 :match (lambda (widget value) (symbolp value))
82 :value-to-internal 102 :value-to-internal
303 effect in this mode, nor any of the indentation associated variables, 323 effect in this mode, nor any of the indentation associated variables,
304 e.g. `c-special-indent-hook'." 324 e.g. `c-special-indent-hook'."
305 :type 'boolean 325 :type 'boolean
306 :group 'c) 326 :group 'c)
307 (make-variable-buffer-local 'c-syntactic-indentation) 327 (make-variable-buffer-local 'c-syntactic-indentation)
328 (put 'c-syntactic-indentation 'safe-local-variable 'booleanp)
308 329
309 (defcustom c-syntactic-indentation-in-macros t 330 (defcustom c-syntactic-indentation-in-macros t
310 "*Enable syntactic analysis inside macros. 331 "*Enable syntactic analysis inside macros.
311 If this is nil, all lines inside macro definitions are analyzed as 332 If this is nil, all lines inside macro definitions are analyzed as
312 `cpp-macro-cont'. Otherwise they are analyzed syntactically, just 333 `cpp-macro-cont'. Otherwise they are analyzed syntactically, just
321 handle this in most cases. If this problem occurs, it's usually 342 handle this in most cases. If this problem occurs, it's usually
322 countered easily by surrounding the statements by a block \(or even 343 countered easily by surrounding the statements by a block \(or even
323 better with the \"do { ... } while \(0)\" trick)." 344 better with the \"do { ... } while \(0)\" trick)."
324 :type 'boolean 345 :type 'boolean
325 :group 'c) 346 :group 'c)
347 (put 'c-syntactic-indentation-in-macros 'safe-local-variable 'booleanp)
326 348
327 (defcustom-c-stylevar c-comment-only-line-offset 0 349 (defcustom-c-stylevar c-comment-only-line-offset 0
328 "*Extra offset for line which contains only the start of a comment. 350 "*Extra offset for line which contains only the start of a comment.
329 Can contain an integer or a cons cell of the form: 351 Can contain an integer or a cons cell of the form:
330 352
403 (const :format "column " column) 425 (const :format "column " column)
404 (c-integer-or-nil :format "%v")))) 426 (c-integer-or-nil :format "%v"))))
405 `(set ,@(mapcar 427 `(set ,@(mapcar
406 (lambda (elt) 428 (lambda (elt)
407 `(cons :format "%v" 429 `(cons :format "%v"
408 (c-const-symbol :format "%v: " 430 ,(c-constant-symbol elt 20)
409 :size 20
410 :value ,elt)
411 (choice 431 (choice
412 :format "%[Choice%] %v" 432 :format "%[Choice%] %v"
413 :value (column . nil) 433 :value (column . nil)
414 ,space 434 ,space
415 ,column 435 ,column
707 (extern-lang-open after) 727 (extern-lang-open after)
708 (namespace-open after) 728 (namespace-open after)
709 (module-open after) 729 (module-open after)
710 (composition-open after) 730 (composition-open after)
711 (inexpr-class-open after) 731 (inexpr-class-open after)
712 (inexpr-class-close before)) 732 (inexpr-class-close before)
733 (arglist-cont-nonempty))
713 "*Controls the insertion of newlines before and after braces 734 "*Controls the insertion of newlines before and after braces
714 when the auto-newline feature is active. This variable contains an 735 when the auto-newline feature is active. This variable contains an
715 association list with elements of the following form: 736 association list with elements of the following form:
716 \(SYNTACTIC-SYMBOL . ACTION). 737 \(SYNTACTIC-SYMBOL . ACTION).
717 738
741 syntactic context for the brace line." 762 syntactic context for the brace line."
742 :type 763 :type
743 `(set ,@(mapcar 764 `(set ,@(mapcar
744 (lambda (elt) 765 (lambda (elt)
745 `(cons :format "%v" 766 `(cons :format "%v"
746 (c-const-symbol :format "%v: " 767 ,(c-constant-symbol elt 24)
747 :size 20
748 :value ,elt)
749 (choice :format "%[Choice%] %v" 768 (choice :format "%[Choice%] %v"
750 :value (before after) 769 :value (before after)
751 (set :menu-tag "Before/after" 770 (set :menu-tag "Before/after"
752 :format "Newline %v brace\n" 771 :format "Newline %v brace\n"
753 (const :format "%v, " before) 772 (const :format "%v, " before)
754 (const :format "%v" after)) 773 (const :format "%v " after))
755 (function :menu-tag "Function" 774 (function :menu-tag "Function"
756 :format "Run function: %v" 775 :format "Run function: %v"))))
757 :value c-))))
758 '(defun-open defun-close 776 '(defun-open defun-close
759 class-open class-close 777 class-open class-close
760 inline-open inline-close 778 inline-open inline-close
761 block-open block-close 779 block-open block-close
762 statement-cont substatement-open statement-case-open 780 statement-cont substatement-open statement-case-open
764 brace-list-intro brace-entry-open 782 brace-list-intro brace-entry-open
765 extern-lang-open extern-lang-close 783 extern-lang-open extern-lang-close
766 namespace-open namespace-close 784 namespace-open namespace-close
767 module-open module-close 785 module-open module-close
768 composition-open composition-close 786 composition-open composition-close
769 inexpr-class-open inexpr-class-close))) 787 inexpr-class-open inexpr-class-close
788 arglist-cont-nonempty)))
770 :group 'c) 789 :group 'c)
771 790
772 (defcustom c-max-one-liner-length 80 791 (defcustom c-max-one-liner-length 80
773 "Maximum length of line that clean-up \"one-liner-defun\" will compact to. 792 "Maximum length of line that clean-up \"one-liner-defun\" will compact to.
774 Zero or nil means no limit." 793 Zero or nil means no limit."
788 currently not supported for this variable." 807 currently not supported for this variable."
789 :type 808 :type
790 `(set ,@(mapcar 809 `(set ,@(mapcar
791 (lambda (elt) 810 (lambda (elt)
792 `(cons :format "%v" 811 `(cons :format "%v"
793 (c-const-symbol :format "%v: " 812 ,(c-constant-symbol elt 20)
794 :size 20 813 (set :format "Newline %v colon\n"
795 :value ,elt) 814 (const :format "%v, " before)
796 (set :format "Newline %v brace\n"
797 (const :format "%v, " before)
798 (const :format "%v" after)))) 815 (const :format "%v" after))))
799 '(case-label label access-label member-init-intro inher-intro))) 816 '(case-label label access-label member-init-intro inher-intro)))
800 :group 'c) 817 :group 'c)
801 818
802 (defcustom-c-stylevar c-hanging-semi&comma-criteria 819 (defcustom-c-stylevar c-hanging-semi&comma-criteria
1305 %v" 1322 %v"
1306 ,@(mapcar 1323 ,@(mapcar
1307 (lambda (elt) 1324 (lambda (elt)
1308 `(cons :format "%v" 1325 `(cons :format "%v"
1309 :value ,elt 1326 :value ,elt
1310 (c-const-symbol :format "%v: " 1327 ,(c-constant-symbol (car elt) 25)
1311 :size 25)
1312 (sexp :format "%v" 1328 (sexp :format "%v"
1313 :validate 1329 :validate
1314 (lambda (widget) 1330 (lambda (widget)
1315 (unless (c-valid-offset (widget-value widget)) 1331 (unless (c-valid-offset (widget-value widget))
1316 (widget-put widget :error "Invalid offset") 1332 (widget-put widget :error "Invalid offset")