annotate lisp/progmodes/cc-styles.el @ 99465:3bf4c25d3b4b

(Basic Windows, Splitting Windows) (Deleting Windows, Selecting Windows, Cyclic Window Ordering) (Buffers and Windows, Displaying Buffers, Dedicated Windows) (Resizing Windows, Window Configurations, Window Parameters): Fix wording and markup.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 08 Nov 2008 18:06:56 +0000
parents 3e78f2abb23d
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cc-styles.el --- support for styles in CC Mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
74372
cf3e4c6cd4c3 Fix Copyright format.
Glenn Morris <rgm@gnu.org>
parents: 70742
diff changeset
3 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
79717
a1342e6e097a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
4 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 75307
diff changeset
5 ;; Free Software Foundation, Inc.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
75307
4389f67a231f Add my name.
Alan Mackenzie <acm@muc.de>
parents: 75027
diff changeset
7 ;; Authors: 2004- Alan Mackenzie
4389f67a231f Add my name.
Alan Mackenzie <acm@muc.de>
parents: 75027
diff changeset
8 ;; 1998- Martin Stjernholm
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
9 ;; 1992-1999 Barry A. Warsaw
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; 1987 Dave Detlefs and Stewart Clamen
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; 1985 Richard M. Stallman
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
12 ;; Maintainer: bug-cc-mode@gnu.org
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; Created: 22-Apr-1997 (split from cc-mode.el)
20147
481af10544cc (c-initialize-builtin-style):
Karl Heuer <kwzh@gnu.org>
parents: 20136
diff changeset
14 ;; Version: See cc-mode.el
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; Keywords: c languages oop
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; This file is part of GNU Emacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
19 ;; GNU Emacs is free software: you can redistribute it and/or modify
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; it under the terms of the GNU General Public License as published by
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
21 ;; the Free Software Foundation, either version 3 of the License, or
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; (at your option) any later version.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; GNU Emacs is distributed in the hope that it will be useful,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; GNU General Public License for more details.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; You should have received a copy of the GNU General Public License
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
30 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38167
diff changeset
32 ;;; Commentary:
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38167
diff changeset
33
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38167
diff changeset
34 ;;; Code:
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38167
diff changeset
35
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
36 (eval-when-compile
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
37 (let ((load-path
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
38 (if (and (boundp 'byte-compile-dest-file)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
39 (stringp byte-compile-dest-file))
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
40 (cons (file-name-directory byte-compile-dest-file) load-path)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
41 load-path)))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
42 (load "cc-bytecomp" nil t)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
44 (cc-require 'cc-defs)
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
45 (cc-require 'cc-vars)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
46 (cc-require 'cc-align)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
47 ;; cc-align is only indirectly required: Styles added with
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
48 ;; `c-add-style' often contains references to functions defined there.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
49
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
50 ;; Silence the compiler.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
51 (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
62641
27b53b1903b6 2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents: 56646
diff changeset
52 (cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
53
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
51748
f3cad02bce62 (c-style-alist, c-lang-variable-inits, c-lang-variable-inits-tail): The
Martin Stjernholm <mast@lysator.liu.se>
parents: 51714
diff changeset
55 (defvar c-style-alist
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 '(("gnu"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (c-basic-offset . 2)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (c-comment-only-line-offset . (0 . 0))
79936
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
59 (c-hanging-braces-alist . ((substatement-open before after)
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
60 (arglist-cont-nonempty)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (c-offsets-alist . ((statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (knr-argdecl-intro . 5)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (substatement-open . +)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
64 (substatement-label . 0)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (label . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (statement-case-open . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (statement-cont . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (arglist-intro . c-lineup-arglist-intro-after-paren)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (arglist-close . c-lineup-arglist)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
70 (inline-open . 0)
75027
9f636bd65206 Update CC Mode to version 5.31.4. The detailed changes are those
Alan Mackenzie <acm@muc.de>
parents: 74372
diff changeset
71 (brace-list-open . +)
9f636bd65206 Update CC Mode to version 5.31.4. The detailed changes are those
Alan Mackenzie <acm@muc.de>
parents: 74372
diff changeset
72 (topmost-intro-cont
9f636bd65206 Update CC Mode to version 5.31.4. The detailed changes are those
Alan Mackenzie <acm@muc.de>
parents: 74372
diff changeset
73 . (first c-lineup-topmost-intro-cont
9f636bd65206 Update CC Mode to version 5.31.4. The detailed changes are those
Alan Mackenzie <acm@muc.de>
parents: 74372
diff changeset
74 c-lineup-gnu-DEFUN-intro-cont))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (c-special-indent-hook . c-gnu-impose-minimum)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
76 (c-block-comment-prefix . ""))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
77
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ("k&r"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (c-basic-offset . 5)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (c-comment-only-line-offset . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (c-offsets-alist . ((statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (knr-argdecl-intro . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (substatement-open . 0)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
84 (substatement-label . 0)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (label . 0)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
86 (statement-cont . +))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
87
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ("bsd"
30400
58d2360c8677 (c-style-alist): The basic offset for the BSD
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
89 (c-basic-offset . 8)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (c-comment-only-line-offset . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (c-offsets-alist . ((statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (knr-argdecl-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (substatement-open . 0)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
94 (substatement-label . 0)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (label . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (statement-cont . +)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
97 (inline-open . 0)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
98 (inexpr-class . 0))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
99
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ("stroustrup"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (c-basic-offset . 4)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (c-comment-only-line-offset . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (c-offsets-alist . ((statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (substatement-open . 0)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
105 (substatement-label . 0)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (label . 0)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
107 (statement-cont . +))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
108
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ("whitesmith"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (c-basic-offset . 4)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (c-comment-only-line-offset . 0)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
112 ;; It's obvious that the CC Mode way of choosing anchor positions
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
113 ;; doesn't fit this style at all. :P
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
114 (c-offsets-alist . ((defun-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
115 (defun-close . c-lineup-whitesmith-in-block)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
116 (defun-block-intro . (add c-lineup-whitesmith-in-block
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
117 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
118 (class-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
119 (class-close . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
120 (inline-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
121 (inline-close . c-lineup-whitesmith-in-block)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
122 (knr-argdecl-intro . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
123 (block-open . 0) ; Get indentation from `statement' instead.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
124 (block-close . c-lineup-whitesmith-in-block)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
125 (brace-list-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
126 (brace-list-close . c-lineup-whitesmith-in-block)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
127 (brace-list-intro . (add c-lineup-whitesmith-in-block
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
128 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
129 (brace-list-entry . (add c-lineup-after-whitesmith-blocks
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
130 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
131 (brace-entry-open . (add c-lineup-after-whitesmith-blocks
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
132 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
133 (statement . (add c-lineup-after-whitesmith-blocks
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
134 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
135 (statement-block-intro . (add c-lineup-whitesmith-in-block
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
136 c-indent-multi-line-block))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
137 (substatement-open . +)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
138 (substatement-label . +)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
139 (label . 0)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
140 (arglist-intro . (add c-lineup-whitesmith-in-block
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
141 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
142 (arglist-cont . (add c-lineup-after-whitesmith-blocks
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
143 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
144 (arglist-cont-nonempty . (add c-lineup-whitesmith-in-block
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
145 c-indent-multi-line-block))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
146 (arglist-close . c-lineup-whitesmith-in-block)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
147 (inclass . c-lineup-whitesmith-in-block)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
148 (extern-lang-open . +)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
149 (namespace-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
150 (module-open . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
151 (composition-open . +)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
152 (extern-lang-close . +)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
153 (namespace-close . +)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
154 (module-close . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
155 (composition-close . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
156 (inextern-lang . c-lineup-whitesmith-in-block)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
157 (innamespace . c-lineup-whitesmith-in-block)
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
158 (inmodule . c-lineup-whitesmith-in-block)
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
159 (incomposition . c-lineup-whitesmith-in-block)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
160 (inexpr-class . 0))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
161
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ("ellemtel"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (c-basic-offset . 3)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (c-comment-only-line-offset . 0)
97147
3e78f2abb23d (c-style-alist): For the Ellemtel style, move the
Chong Yidong <cyd@stupidchicken.com>
parents: 94673
diff changeset
165 (c-hanging-braces-alist . ((substatement-open before after)
3e78f2abb23d (c-style-alist): For the Ellemtel style, move the
Chong Yidong <cyd@stupidchicken.com>
parents: 94673
diff changeset
166 (arglist-cont-nonempty)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (c-offsets-alist . ((topmost-intro . 0)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
168 (substatement . +)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (substatement-open . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (case-label . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (access-label . -)
97147
3e78f2abb23d (c-style-alist): For the Ellemtel style, move the
Chong Yidong <cyd@stupidchicken.com>
parents: 94673
diff changeset
172 (inclass . +)
3e78f2abb23d (c-style-alist): For the Ellemtel style, move the
Chong Yidong <cyd@stupidchicken.com>
parents: 94673
diff changeset
173 (inline-open . 0))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ("linux"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (c-basic-offset . 8)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (c-comment-only-line-offset . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (c-hanging-braces-alist . ((brace-list-open)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
178 (brace-entry-open)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (substatement-open after)
79936
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
180 (block-close . c-snug-do-while)
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
181 (arglist-cont-nonempty)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (c-cleanup-list . (brace-else-brace))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (c-offsets-alist . ((statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (knr-argdecl-intro . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (substatement-open . 0)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
186 (substatement-label . 0)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (label . 0)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
188 (statement-cont . +))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
189
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 ("python"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 (indent-tabs-mode . t)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
192 (fill-column . 78)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (c-basic-offset . 8)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (c-offsets-alist . ((substatement-open . 0)
19807
86412da1174b (c-style-alist) <python>:, knr-argdecl-intro == +
Richard M. Stallman <rms@gnu.org>
parents: 19376
diff changeset
195 (inextern-lang . 0)
86412da1174b (c-style-alist) <python>:, knr-argdecl-intro == +
Richard M. Stallman <rms@gnu.org>
parents: 19376
diff changeset
196 (arglist-intro . +)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
197 (knr-argdecl-intro . +)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (c-hanging-braces-alist . ((brace-list-open)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (brace-list-intro)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (brace-list-close)
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
201 (brace-entry-open)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (substatement-open after)
79936
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
203 (block-close . c-snug-do-while)
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
204 (arglist-cont-nonempty)))
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
205 (c-block-comment-prefix . ""))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
206
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 ("java"
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
208 (c-basic-offset . 4)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 (c-comment-only-line-offset . (0 . 0))
19254
81353d4e05b7 (c-styles-alist): In "java" style, set
Richard M. Stallman <rms@gnu.org>
parents: 19212
diff changeset
210 ;; the following preserves Javadoc starter lines
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
211 (c-offsets-alist . ((inline-open . 0)
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
212 (topmost-intro-cont . +)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (statement-block-intro . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (knr-argdecl-intro . 5)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
215 (substatement-open . +)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
216 (substatement-label . +)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
217 (label . +)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (statement-case-open . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 (statement-cont . +)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (arglist-intro . c-lineup-arglist-intro-after-paren)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (arglist-close . c-lineup-arglist)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 (access-label . 0)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (inher-cont . c-lineup-java-inher)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
224 (func-decl-cont . c-lineup-java-throws))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
225
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
226 ;; awk style exists primarily for auto-newline settings. Otherwise it's
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
227 ;; pretty much like k&r.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
228 ("awk"
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
229 (c-basic-offset . 4)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
230 (c-comment-only-line-offset . 0)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
231 (c-hanging-braces-alist . ((defun-open after)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
232 (defun-close . c-snug-1line-defun-close)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
233 (substatement-open after)
79936
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
234 (block-close . c-snug-do-while)
996fec9cb719 Introduce elements for the syntactic symbol arglist-cont-nonempty into
Alan Mackenzie <acm@muc.de>
parents: 79717
diff changeset
235 (arglist-cont-nonempty)))
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
236 (c-hanging-semi&comma-criteria . nil)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
237 (c-cleanup-list . nil) ; You might want one-liner-defun here.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
238 (c-offsets-alist . ((statement-block-intro . +)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
239 (substatement-open . 0)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
240 (statement-cont . +))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
241
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 "Styles of indentation.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 Elements of this alist are of the form:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (STYLE-STRING [BASE-STYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 where STYLE-STRING is a short descriptive string used to select a
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 style, VARIABLE is any Emacs variable, and VALUE is the intended value
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 for that variable when using the selected style.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 Optional BASE-STYLE if present, is a string and must follow
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 STYLE-STRING. BASE-STYLE names a style that this style inherits from.
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
254 By default, all styles inherit from the \"user\" style, which is
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 computed at run time. Style loops generate errors.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 Two variables are treated specially. When VARIABLE is
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 `c-offsets-alist', the VALUE is a list containing elements of the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 form:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 (SYNTACTIC-SYMBOL . OFFSET)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 as described in `c-offsets-alist'. These are passed directly to
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 `c-set-offset' so there is no need to set every syntactic symbol in
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 your style, only those that are different from the default.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 When VARIABLE is `c-special-indent-hook', its VALUE is added to
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 `c-special-indent-hook' using `add-hook'. If VALUE is a list, each
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 element of the list is added with `add-hook'.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 Do not change this variable directly. Use the function `c-add-style'
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 to add new styles or modify existing styles (it is not a good idea to
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 modify existing styles -- you should create a new style that inherits
70742
6d812049e04c (c-style-alist): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69140
diff changeset
274 the existing style).")
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 ;; Functions that manipulate styles
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
278 (defun c-set-style-1 (conscell dont-override)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ;; Set the style for one variable
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (let ((attr (car conscell))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (val (cdr conscell)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (cond
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 ;; first special variable
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 ((eq attr 'c-offsets-alist)
45703
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
285 (let ((offsets (cond ((eq dont-override t)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
286 c-offsets-alist)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
287 (dont-override
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
288 (default-value 'c-offsets-alist)))))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
289 (mapcar (lambda (langentry)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
290 (let ((langelem (car langentry))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
291 (offset (cdr langentry)))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
292 (unless (assq langelem offsets)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
293 (c-set-offset langelem offset))))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
294 val)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 ;; second special variable
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 ((eq attr 'c-special-indent-hook)
45703
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
297 ;; Maybe we should ignore dont-override here and always add new
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
298 ;; hooks?
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
299 (unless (cond ((eq dont-override t)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
300 c-special-indent-hook)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
301 (dont-override
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
302 (default-value 'c-special-indent-hook)))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
303 (if (listp val)
45703
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
304 (mapcar (lambda (func)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
305 (add-hook 'c-special-indent-hook func t t))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
306 val)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
307 (add-hook 'c-special-indent-hook val t t))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 ;; all other variables
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
309 (t (when (or (not dont-override)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
310 (not (memq attr c-style-variables))
45703
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
311 (eq (if (eq dont-override t)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
312 (symbol-value attr)
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
313 (default-value attr))
b022aba47c59 (c-set-style, c-set-style-1): Added another state for the
Martin Stjernholm <mast@lysator.liu.se>
parents: 44728
diff changeset
314 'set-from-style))
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
315 (set attr val)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
316 ;; Must update a number of other variables if
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
317 ;; c-comment-prefix-regexp is set.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
318 (if (eq attr 'c-comment-prefix-regexp)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
319 (c-setup-paragraph-variables)))))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
321 (defun c-get-style-variables (style basestyles)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
322 ;; Return all variables in a style by resolving inheritances.
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
323 (if (not style)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
324 (copy-alist c-fallback-style)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
325 (let ((vars (cdr (or (assoc (downcase style) c-style-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
326 (assoc (upcase style) c-style-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
327 (assoc style c-style-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
328 (progn
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
329 (c-benign-error "Undefined style: %s" style)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
330 nil)))))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
331 (let ((base (and (stringp (car-safe vars))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
332 (prog1
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
333 (downcase (car vars))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
334 (setq vars (cdr vars))))))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
335 (if (memq base basestyles)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
336 (c-benign-error "Style loop detected: %s in %s" base basestyles)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
337 (nconc (c-get-style-variables base (cons base basestyles))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
338 (copy-alist vars)))))))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
339
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (defvar c-set-style-history nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 ;;;###autoload
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
343 (defun c-set-style (stylename &optional dont-override)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
344 "Set the current buffer to use the style STYLENAME.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
345 STYLENAME, a string, must be an existing CC Mode style - These are contained
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
346 in the variable `c-style-alist'.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
348 The variable `c-indentation-style' will get set to STYLENAME.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
349
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
350 \"Setting the style\" is done by setting CC Mode's \"style variables\" to the
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
351 values indicated by the pertinent entry in `c-style-alist'. Other variables
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
352 might get set too.
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
353
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
354 If DONT-OVERRIDE is neither nil nor t, style variables whose default values
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
355 have been set (more precisely, whose default values are not the symbol
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
356 `set-from-style') will not be changed. This avoids overriding global settings
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
357 done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
358 way.
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
359
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
360 If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
361 values are not the symbol `set-from-style') will not be overridden. CC Mode
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
362 calls c-set-style internally in this way whilst initializing a buffer; if
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
363 cc-set-style is called like this from anywhere else, it will usually behave as
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
364 a null operation."
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
365 (interactive
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
366 (list (let ((completion-ignore-case t)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
367 (prompt (format "Which %s indentation style? "
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
368 mode-name)))
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
369 (completing-read prompt c-style-alist nil t nil
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
370 'c-set-style-history
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
371 c-indentation-style))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
372 (or c-buffer-is-cc-mode
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
373 (error "Buffer %s is not a CC Mode buffer (c-set-style)" (buffer-name)))
56646
b7446b6f097d Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52608
diff changeset
374 (or (stringp stylename)
b7446b6f097d Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52608
diff changeset
375 (error "Argument to c-set-style was not a string"))
19254
81353d4e05b7 (c-styles-alist): In "java" style, set
Richard M. Stallman <rms@gnu.org>
parents: 19212
diff changeset
376 (c-initialize-builtin-style)
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
377 (let ((vars (c-get-style-variables stylename nil)))
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
378 (unless dont-override
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
379 ;; Since we always add to c-special-indent-hook we must reset it
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
380 ;; first, or else the hooks from the preceding style will
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
381 ;; remain. This is not necessary for c-offsets-alist, since
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
382 ;; c-get-style-variables contains every valid offset type in the
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
383 ;; fallback entry.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
384 (setq c-special-indent-hook
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
385 (default-value 'c-special-indent-hook)))
85224
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
386 (mapc (lambda (elem)
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
387 (c-set-style-1 elem dont-override))
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
388 ;; Need to go through the variables backwards when we
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
389 ;; don't override any settings.
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
390 (if (eq dont-override t) (nreverse vars) vars)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (setq c-indentation-style stylename)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (c-keep-region-active))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 ;;;###autoload
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
395 (defun c-add-style (style description &optional set-p)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 "Adds a style to `c-style-alist', or updates an existing one.
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
397 STYLE is a string identifying the style to add or update. DESCRIPTION
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
398 is an association list describing the style and must be of the form:
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 ([BASESTYLE] (VARIABLE . VALUE) [(VARIABLE . VALUE) ...])
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 See the variable `c-style-alist' for the semantics of BASESTYLE,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 VARIABLE and VALUE. This function also sets the current style to
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 STYLE using `c-set-style' if the optional SET-P flag is non-nil."
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (interactive
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (let ((stylename (completing-read "Style to add: " c-style-alist
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 nil nil nil 'c-set-style-history))
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
408 (descr (eval-minibuffer "Style description: ")))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
409 (list stylename descr
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (y-or-n-p "Set the style too? "))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (setq style (downcase style))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (let ((s (assoc style c-style-alist)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (if s
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
414 (setcdr s (copy-alist description)) ; replace
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
415 (setq c-style-alist (cons (cons style description) c-style-alist))))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (and set-p (c-set-style style)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (defvar c-read-offset-history nil)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (defun c-read-offset (langelem)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 ;; read new offset value for LANGELEM from minibuffer. return a
80056
20a6490b2f90 *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79936
diff changeset
423 ;; valid value only
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
424 (let* ((oldoff (cdr-safe (or (assq langelem c-offsets-alist)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
425 (assq langelem (get 'c-offsets-alist
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
426 'c-stylevar-fallback)))))
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
427 (symname (symbol-name langelem))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
428 (defstr (format "(default %s): " oldoff))
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
429 (errmsg (concat "Offset must be int, func, var, vector, list, "
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
430 "or [+,-,++,--,*,/] "
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
431 defstr))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
432 (prompt (concat symname " offset " defstr))
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
433 (keymap (make-sparse-keymap))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
434 (minibuffer-completion-table obarray)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
435 (minibuffer-completion-predicate 'fboundp)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
436 offset input)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
437 ;; In principle completing-read is used here, but SPC is unbound
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
438 ;; to make it less annoying to enter lists.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
439 (set-keymap-parent keymap minibuffer-local-completion-map)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
440 (define-key keymap " " 'self-insert-command)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (while (not offset)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
442 (setq input (read-from-minibuffer prompt nil keymap t
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
443 'c-read-offset-history
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
444 (format "%s" oldoff)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
445 (if (c-valid-offset input)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
446 (setq offset input)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
447 ;; error, but don't signal one, keep trying
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
448 ;; to read an input value
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
449 (ding)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
450 (setq prompt errmsg)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 offset))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452
19212
024594beef65 (c-set-offset): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 18845
diff changeset
453 ;;;###autoload
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
454 (defun c-set-offset (symbol offset &optional ignored)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 "Change the value of a syntactic element symbol in `c-offsets-alist'.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 SYMBOL is the syntactic element symbol to change and OFFSET is the new
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
457 offset for that syntactic element. The optional argument is not used
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
458 and exists only for compatibility reasons."
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (interactive
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (let* ((langelem
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (intern (completing-read
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (concat "Syntactic symbol to change"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (if current-prefix-arg " or add" "")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 ": ")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (mapcar
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 #'(lambda (langelem)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (cons (format "%s" (car langelem)) nil))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
468 (get 'c-offsets-alist 'c-stylevar-fallback))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 nil (not current-prefix-arg)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 ;; initial contents tries to be the last element
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ;; on the syntactic analysis list for the current
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 ;; line
49660
425dcb97eca4 (c-set-offset): Don't find a default syntactic element through
Martin Stjernholm <mast@lysator.liu.se>
parents: 49478
diff changeset
473 (and c-buffer-is-cc-mode
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
474 (c-save-buffer-state
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
475 ((syntax (c-guess-basic-syntax))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
476 (len (length syntax))
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
477 (ic (format "%s" (car (nth (1- len) syntax)))))
49660
425dcb97eca4 (c-set-offset): Don't find a default syntactic element through
Martin Stjernholm <mast@lysator.liu.se>
parents: 49478
diff changeset
478 (cons ic 0)))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 )))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 (offset (c-read-offset langelem)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (list langelem offset current-prefix-arg)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 ;; sanity check offset
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
483 (if (c-valid-offset offset)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
484 (let ((entry (assq symbol c-offsets-alist)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
485 (if entry
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
486 (setcdr entry offset)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
487 (if (assq symbol (get 'c-offsets-alist 'c-stylevar-fallback))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
488 (setq c-offsets-alist (cons (cons symbol offset)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
489 c-offsets-alist))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
490 (c-benign-error "%s is not a valid syntactic symbol" symbol))))
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
491 (c-benign-error "Invalid indentation setting for symbol %s: %S"
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
492 symbol offset))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 (c-keep-region-active))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
495
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
496 (defun c-setup-paragraph-variables ()
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
497 "Fix things up for paragraph recognition and filling inside comments and
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
498 strings by incorporating the values of `c-comment-prefix-regexp',
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
499 `sentence-end', `paragraph-start' and `paragraph-separate' in the relevant
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
500 variables."
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
501
52608
fae5ff03687a (c-setup-paragraph-variables): Made it interactive.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52401
diff changeset
502 (interactive)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
503 (or c-buffer-is-cc-mode
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
504 (error "Buffer %s is not a CC Mode buffer (c-setup-paragraph-variables)"
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
505 (buffer-name)))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
506 ;; Set up the values for use in comments.
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
507 (setq c-current-comment-prefix
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
508 (if (listp c-comment-prefix-regexp)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
509 (cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
510 (assoc 'other c-comment-prefix-regexp)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
511 c-comment-prefix-regexp))
52608
fae5ff03687a (c-setup-paragraph-variables): Made it interactive.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52401
diff changeset
512
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
513 (let ((comment-line-prefix
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
514 (concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
52608
fae5ff03687a (c-setup-paragraph-variables): Made it interactive.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52401
diff changeset
515
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
516 (setq paragraph-start (concat comment-line-prefix
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
517 c-paragraph-start
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
518 "\\|"
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
519 page-delimiter)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
520 paragraph-separate (concat comment-line-prefix
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
521 c-paragraph-separate
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
522 "\\|"
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
523 page-delimiter)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
524 paragraph-ignore-fill-prefix t
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
525 adaptive-fill-mode t
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
526 adaptive-fill-regexp
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
527 (concat comment-line-prefix
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
528 (if (default-value 'adaptive-fill-regexp)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
529 (concat "\\("
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
530 (default-value 'adaptive-fill-regexp)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
531 "\\)")
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
532 "")))
52608
fae5ff03687a (c-setup-paragraph-variables): Made it interactive.
Martin Stjernholm <mast@lysator.liu.se>
parents: 52401
diff changeset
533
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
534 (when (boundp 'adaptive-fill-first-line-regexp)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
535 ;; XEmacs adaptive fill mode doesn't have this.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
536 (make-local-variable 'adaptive-fill-first-line-regexp)
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
537 (setq adaptive-fill-first-line-regexp
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
538 (concat "\\`" comment-line-prefix
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
539 ;; Maybe we should incorporate the old value here,
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
540 ;; but then we have to do all sorts of kludges to
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
541 ;; deal with the \` and \' it probably contains.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
542 "\\'"))))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
543
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
544 ;; Set up the values for use in strings. These are the default
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
545 ;; paragraph-start/separate values, enhanced to accept escaped EOLs as
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
546 ;; whitespace. Used in c-beginning/end-of-sentence-in-string in cc-cmds.
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
547 (setq c-string-par-start
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
548 ;;(concat "\\(" (default-value 'paragraph-start) "\\)\\|[ \t]*\\\\$"))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
549 "\f\\|[ \t]*\\\\?$")
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
550 (setq c-string-par-separate
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
551 ;;(concat "\\(" (default-value 'paragraph-separate) "\\)\\|[ \t]*\\\\$"))
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
552 "[ \t\f]*\\\\?$")
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
553 (setq c-sentence-end-with-esc-eol
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
554 (concat "\\(\\(" (c-default-value-sentence-end) "\\)"
80056
20a6490b2f90 *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79936
diff changeset
555 ;; N.B.: "$" would be invalid when not enclosed like "\\($\\)".
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
556 "\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
557 "\\)")))
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
558
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
559
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
560 ;; Helper for setting up Filladapt mode. It's not used by CC Mode itself.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
561
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
562 (cc-bytecomp-defvar filladapt-token-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
563 (cc-bytecomp-defvar filladapt-token-match-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
564 (cc-bytecomp-defvar filladapt-token-conversion-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
565
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
566 (defun c-setup-filladapt ()
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
567 "Convenience function to configure Kyle E. Jones' Filladapt mode for
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
568 CC Mode by making sure the proper entries are present on
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
569 `filladapt-token-table', `filladapt-token-match-table', and
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
570 `filladapt-token-conversion-table'. This is intended to be used on
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
571 `c-mode-common-hook' or similar."
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
572 ;; This function is intended to be used explicitly by the end user
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
573 ;; only.
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
574
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
575 ;; The default configuration already handles C++ comments, but we
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
576 ;; need to add handling of C block comments. A new filladapt token
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
577 ;; `c-comment' is added for that.
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
578 (let (p)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
579 (setq p filladapt-token-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
580 (while (and p (not (eq (car-safe (cdr-safe (car-safe p))) 'c-comment)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
581 (setq p (cdr-safe p)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
582 (if p
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
583 (setcar (car p) c-current-comment-prefix)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
584 (setq filladapt-token-table
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
585 (append (list (car filladapt-token-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
586 (list c-current-comment-prefix 'c-comment))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
587 (cdr filladapt-token-table)))))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
588 (unless (assq 'c-comment filladapt-token-match-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
589 (setq filladapt-token-match-table
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
590 (append '((c-comment c-comment))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
591 filladapt-token-match-table)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
592 (unless (assq 'c-comment filladapt-token-conversion-table)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
593 (setq filladapt-token-conversion-table
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
594 (append '((c-comment . exact))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
595 filladapt-token-conversion-table))))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
596
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
597
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 (defun c-initialize-builtin-style ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 ;; Dynamically append the default value of most variables. This is
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 ;; crucial because future c-set-style calls will always reset the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 ;; variables first to the `cc-mode' style before instituting the new
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 ;; style. Only do this once!
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
603 (unless (get 'c-initialize-builtin-style 'is-run)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
604 (put 'c-initialize-builtin-style 'is-run t)
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
605 ;;(c-initialize-cc-mode)
44728
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
606 (unless (assoc "user" c-style-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
607 (let ((vars c-style-variables) var val uservars)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
608 (while vars
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
609 (setq var (car vars)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
610 val (symbol-value var)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
611 vars (cdr vars))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
612 (cond ((eq var 'c-offsets-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
613 (or (null val)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
614 (setq uservars (cons (cons 'c-offsets-alist val)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
615 uservars))))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
616 ((not (eq val 'set-from-style))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
617 (setq uservars (cons (cons var val)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
618 uservars)))))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
619 (c-add-style "user" uservars)))
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
620 (unless (assoc "cc-mode" c-style-alist)
7a3ac6c387fe CC Mode update to version 5.29. This is for testing; it's not a released
Martin Stjernholm <mast@lysator.liu.se>
parents: 38422
diff changeset
621 (c-add-style "cc-mode" '("user")))
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
622 (if c-style-variables-are-local-p
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 20920
diff changeset
623 (c-make-styles-buffer-local))))
19254
81353d4e05b7 (c-styles-alist): In "java" style, set
Richard M. Stallman <rms@gnu.org>
parents: 19212
diff changeset
624
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
625 (defun c-make-styles-buffer-local (&optional this-buf-only-p)
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 "Make all CC Mode style variables buffer local.
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
627 If `this-buf-only-p' is non-nil, the style variables will be made
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
628 buffer local only in the current buffer. Otherwise they'll be made
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
629 permanently buffer local in any buffer that changes their values.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630
51714
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
631 The buffer localness of the style variables are normally controlled
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
632 with the variable `c-style-variables-are-local-p', so there's seldom
bc91cbf50c24 Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents: 49660
diff changeset
633 any reason to call this function directly."
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 ;; style variables
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
636 (let ((func (if this-buf-only-p
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
637 'make-local-variable
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
638 'make-variable-buffer-local))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
639 (varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
640 (delq 'c-special-indent-hook varsyms)
85224
37dfa62aaf49 (c-make-styles-buffer-local)
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
641 (mapc func varsyms)
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
642 ;; Hooks must be handled specially
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
643 (if this-buf-only-p
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
644 (make-local-hook 'c-special-indent-hook)
67252
04d2abb755d9 Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents: 65811
diff changeset
645 (with-no-warnings (make-variable-buffer-local 'c-special-indent-hook))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24282
diff changeset
646 (setq c-style-variables-are-local-p t))
20918
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
647 ))
8e64bd5b1b5f (c-make-styles-buffer-local): Take an optional argument which switches
Richard M. Stallman <rms@gnu.org>
parents: 20147
diff changeset
648
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650
36920
32a4317c6aa5 Update to version 5.28.
Gerd Moellmann <gerd@gnu.org>
parents: 34304
diff changeset
651 (cc-provide 'cc-styles)
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38167
diff changeset
652
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92148
diff changeset
653 ;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 ;;; cc-styles.el ends here