aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-09 18:36:45 +0000
committerRichard M. Stallman1997-08-09 18:36:45 +0000
commit63add9c9fe525ea61e1dbf26592790b4c34b04ae (patch)
tree0ccce36915e0dca5f516699a4d12efa1e3f557c6
parentaac90c529d36d784c6c55e58731af2d68b3ce652 (diff)
downloademacs-63add9c9fe525ea61e1dbf26592790b4c34b04ae.tar.gz
emacs-63add9c9fe525ea61e1dbf26592790b4c34b04ae.zip
(c-styles-alist): In "java" style, set
c-hanging-comment-starter-p to nil to preserve Javadoc starter lines. (c-set-style-2): Fixed broken implementation of inherited styles. (c-set-style): Call c-initialize-builtin-style. (c-initialize-builtin-style): Handle c-style-variables-are-local-p.
-rw-r--r--lisp/progmodes/cc-styles.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 1b6609c8ddf..ebd94d39475 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -7,7 +7,7 @@
7;; 1985 Richard M. Stallman 7;; 1985 Richard M. Stallman
8;; Maintainer: cc-mode-help@python.org 8;; Maintainer: cc-mode-help@python.org
9;; Created: 22-Apr-1997 (split from cc-mode.el) 9;; Created: 22-Apr-1997 (split from cc-mode.el)
10;; Version: 5.13 10;; Version: 5.14
11;; Keywords: c languages oop 11;; Keywords: c languages oop
12 12
13;; This file is part of GNU Emacs. 13;; This file is part of GNU Emacs.
@@ -128,6 +128,8 @@
128 ("java" 128 ("java"
129 (c-basic-offset . 2) 129 (c-basic-offset . 2)
130 (c-comment-only-line-offset . (0 . 0)) 130 (c-comment-only-line-offset . (0 . 0))
131 ;; the following preserves Javadoc starter lines
132 (c-hanging-comment-starter-p . nil)
131 (c-offsets-alist . ((topmost-intro-cont . +) 133 (c-offsets-alist . ((topmost-intro-cont . +)
132 (statement-block-intro . +) 134 (statement-block-intro . +)
133 (knr-argdecl-intro . 5) 135 (knr-argdecl-intro . 5)
@@ -209,17 +211,19 @@ the existing style.")
209 ;; Recursively set the base style. If no base style is given, the 211 ;; Recursively set the base style. If no base style is given, the
210 ;; default base style is "cc-mode" and the recursion stops. Be sure 212 ;; default base style is "cc-mode" and the recursion stops. Be sure
211 ;; to detect loops. 213 ;; to detect loops.
212 (if (not (string-equal style "cc-mode"))
213 (let ((base (if (stringp (car basestyles))
214 (downcase (car basestyles))
215 "cc-mode")))
216 (if (memq base basestyles)
217 (error "Style loop detected: %s in %s" base basestyles))
218 (c-set-style-2 base (cons base basestyles))))
219 (let ((vars (cdr (or (assoc (downcase style) c-style-alist) 214 (let ((vars (cdr (or (assoc (downcase style) c-style-alist)
220 (assoc (upcase style) c-style-alist) 215 (assoc (upcase style) c-style-alist)
221 (assoc style c-style-alist) 216 (assoc style c-style-alist)
222 (error "Undefined style: %s" style))))) 217 (error "Undefined style: %s" style)))))
218 (if (not (string-equal style "cc-mode"))
219 (let ((base (if (stringp (car vars))
220 (prog1
221 (downcase (car vars))
222 (setq vars (cdr vars)))
223 "cc-mode")))
224 (if (memq base basestyles)
225 (error "Style loop detected: %s in %s" base basestyles))
226 (c-set-style-2 base (cons base basestyles))))
223 (mapcar 'c-set-style-1 vars))) 227 (mapcar 'c-set-style-1 vars)))
224 228
225(defvar c-set-style-history nil) 229(defvar c-set-style-history nil)
@@ -239,6 +243,7 @@ style name."
239 (completing-read prompt c-style-alist nil t 243 (completing-read prompt c-style-alist nil t
240 (cons c-indentation-style 0) 244 (cons c-indentation-style 0)
241 'c-set-style-history)))) 245 'c-set-style-history))))
246 (c-initialize-builtin-style)
242 (c-set-style-2 stylename nil) 247 (c-set-style-2 stylename nil)
243 (setq c-indentation-style stylename) 248 (setq c-indentation-style stylename)
244 (c-keep-region-active)) 249 (c-keep-region-active))
@@ -577,7 +582,10 @@ offset for that syntactic element. Optional ADD says to add SYMBOL to
577 ))) 582 )))
578 ;; the default style is now GNU. This can be overridden in 583 ;; the default style is now GNU. This can be overridden in
579 ;; c-mode-common-hook or {c,c++,objc,java}-mode-hook. 584 ;; c-mode-common-hook or {c,c++,objc,java}-mode-hook.
580 (c-set-style c-site-default-style)))) 585 (c-set-style c-site-default-style)))
586 (if c-style-variables-are-local-p
587 (c-make-styles-buffer-local)))
588
581 589
582(defun c-make-styles-buffer-local () 590(defun c-make-styles-buffer-local ()
583 "Make all CC Mode style variables buffer local. 591 "Make all CC Mode style variables buffer local.