comparison lisp/cc-mode/cc-styles.el @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents 85ec50267440
children 2d532a89d707
comparison
equal deleted inserted replaced
170:98a42ee61975 171:929b76928fce
5 ;; Authors: 1992-1997 Barry A. Warsaw 5 ;; Authors: 1992-1997 Barry A. Warsaw
6 ;; 1987 Dave Detlefs and Stewart Clamen 6 ;; 1987 Dave Detlefs and Stewart Clamen
7 ;; 1985 Richard M. Stallman 7 ;; 1985 Richard M. Stallman
8 ;; Maintainer: cc-mode-help@python.org 8 ;; Maintainer: cc-mode-help@python.org
9 ;; Created: 22-Apr-1997 (split from cc-mode.el) 9 ;; Created: 22-Apr-1997 (split from cc-mode.el)
10 ;; Version: 5.11 10 ;; Version: 5.12
11 ;; Keywords: c languages oop 11 ;; Keywords: c languages oop
12 12
13 ;; This file is part of GNU Emacs. 13 ;; This file is part of GNU Emacs.
14 14
15 ;; GNU Emacs is free software; you can redistribute it and/or modify 15 ;; GNU Emacs is free software; you can redistribute it and/or modify
25 ;; You should have received a copy of the GNU General Public License 25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the 26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA. 28 ;; Boston, MA 02111-1307, USA.
29 29
30 (eval-when-compile
31 (load-file "./cc-align.el"))
32
33 (require 'cc-vars)
34 (require 'cc-align)
35 30
36 31
37 (defconst c-style-alist 32 (defconst c-style-alist
38 '(("gnu" 33 '(("gnu"
39 (c-basic-offset . 2) 34 (c-basic-offset . 2)
551 (error "%s is not a valid syntactic symbol." symbol)))) 546 (error "%s is not a valid syntactic symbol." symbol))))
552 (c-keep-region-active)) 547 (c-keep-region-active))
553 548
554 549
555 550
556 ;; Dynamically append the default value of most variables. This is 551 (defun c-initialize-builtin-style ()
557 ;; crucial because future c-set-style calls will always reset the 552 ;; Dynamically append the default value of most variables. This is
558 ;; variables first to the `cc-mode' style before instituting the new 553 ;; crucial because future c-set-style calls will always reset the
559 ;; style. Only do this once! 554 ;; variables first to the `cc-mode' style before instituting the new
560 (or (assoc "cc-mode" c-style-alist) 555 ;; style. Only do this once!
561 (progn 556 (require 'cl)
562 (c-add-style "cc-mode" 557 (or (assoc "cc-mode" c-style-alist)
563 (mapcar 558 (progn
564 (function 559 (c-add-style "cc-mode"
565 (lambda (var) 560 (mapcar
566 (let ((val (symbol-value var))) 561 (function
567 (cons var (if (atom val) val 562 (lambda (var)
568 (copy-tree val) 563 (let ((val (symbol-value var)))
569 )) 564 (cons var (if (atom val) val
570 ))) 565 (copy-tree val)
571 '(c-backslash-column 566 ))
572 c-basic-offset 567 )))
573 c-cleanup-list 568 '(c-backslash-column
574 c-comment-only-line-offset 569 c-basic-offset
575 c-electric-pound-behavior 570 c-cleanup-list
576 c-hanging-braces-alist 571 c-comment-only-line-offset
577 c-hanging-colons-alist 572 c-electric-pound-behavior
578 c-hanging-comment-starter-p 573 c-hanging-braces-alist
579 c-hanging-comment-ender-p 574 c-hanging-colons-alist
580 c-offsets-alist 575 c-hanging-comment-starter-p
581 ))) 576 c-hanging-comment-ender-p
582 ;; the default style is now GNU. This can be overridden in 577 c-offsets-alist
583 ;; c-mode-common-hook or {c,c++,objc,java}-mode-hook. 578 )))
584 (c-set-style c-site-default-style))) 579 ;; the default style is now GNU. This can be overridden in
580 ;; c-mode-common-hook or {c,c++,objc,java}-mode-hook.
581 (c-set-style c-site-default-style))))
585 582
586 (defun c-make-styles-buffer-local () 583 (defun c-make-styles-buffer-local ()
587 "Make all CC Mode style variables buffer local. 584 "Make all CC Mode style variables buffer local.
588 If you edit primarily one style of C (or C++, Objective-C, Java) code, 585 If you edit primarily one style of C (or C++, Objective-C, Java) code,
589 you probably want style variables to be global. This is the default. 586 you probably want style variables to be global. This is the default.
613 (make-variable-buffer-local 'c-backslash-column) 610 (make-variable-buffer-local 'c-backslash-column)
614 (make-variable-buffer-local 'c-label-minimum-indentation) 611 (make-variable-buffer-local 'c-label-minimum-indentation)
615 (make-variable-buffer-local 'c-special-indent-hook) 612 (make-variable-buffer-local 'c-special-indent-hook)
616 (make-variable-buffer-local 'c-indentation-style)) 613 (make-variable-buffer-local 'c-indentation-style))
617 614
618 (if c-style-variables-are-local-p
619 (c-make-styles-buffer-local))
620
621
622 615
623 (provide 'cc-styles) 616 (provide 'cc-styles)
624 ;;; cc-styles.el ends here 617 ;;; cc-styles.el ends here