X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d2fc7e3d0f6f57f962cbd94df3bf4fd15a37bb68..54c57cc6c7d1f77933ccaed32284aabecfa4a7c8:/lisp/progmodes/cc-styles.el diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index e161eb6d0f..ff76e21a38 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -1,6 +1,6 @@ ;;; cc-styles.el --- support for styles in CC Mode -;; Copyright (C) 1985, 1987, 1992-2011 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1987, 1992-2013 Free Software Foundation, Inc. ;; Authors: 2004- Alan Mackenzie ;; 1998- Martin Stjernholm @@ -352,8 +352,8 @@ might get set too. If DONT-OVERRIDE is neither nil nor t, style variables whose default values have been set (more precisely, whose default values are not the symbol `set-from-style') will not be changed. This avoids overriding global settings -done in ~/.emacs. It is useful to call c-set-style from a mode hook in this -way. +done in your init file. It is useful to call c-set-style from a mode hook +in this way. If DONT-OVERRIDE is t, style variables that already have values (i.e., whose values are not the symbol `set-from-style') will not be overridden. CC Mode @@ -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)