summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-styles.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2011-06-30 20:45:12 +0000
committerAlan Mackenzie <acm@muc.de>2011-06-30 20:45:12 +0000
commitb14c0c5545592e86b968405c794c10bc55f95124 (patch)
treefb2060d7722cea9c1fd829af1d075a6066b20bcc /lisp/progmodes/cc-styles.el
parent1fa280a3def73608707921d7978cb91d23c90cad (diff)
downloademacs-b14c0c5545592e86b968405c794c10bc55f95124.tar.gz
progmodes/cc-guess.el: New file.
progmodes/cc-langs.el (c-mode-menu): Added "Style..." submenu. progmodes/cc-styles.el (cc-choose-style-for-mode): New function derived from `c-basic-common-init'. progmodes/cc-mode.el (top-level): Require cc-guess. (c-basic-common-init): Use `cc-choose-style-for-mode'.
Diffstat (limited to 'lisp/progmodes/cc-styles.el')
-rw-r--r--lisp/progmodes/cc-styles.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index e161eb6d0f5..96cb15f2a72 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -650,6 +650,15 @@ any reason to call this function directly."
(setq c-style-variables-are-local-p t))
))
+(defun cc-choose-style-for-mode (mode default-style)
+ "Return suitable style for MODE from DEFAULT-STYLE.
+DEFAULT-STYLE has the same format as `c-default-style'."
+ (if (stringp default-style)
+ default-style
+ (or (cdr (assq mode default-style))
+ (cdr (assq 'other default-style))
+ "gnu")))
+
(cc-provide 'cc-styles)