First, define a derived mode for each style you might want to use. Each minor mode inherits from c-mode, but adds a c-set-style call. (Obviously, this assumes that the styles you want to use are already defined.)
(define-derived-mode gnu-c-mode c-mode "GNU C mode" (c-set-style "gnu")) (define-derived-mode linux-c-mode c-mode "GNU C mode" (c-set-style "linux"))
Then add entries to your auto-mode-alist for each directory you want to treat specially:
(setq auto-mode-alist [ . . . ] (cons '("gimp.*/" . gnu-c-mode) (cons '("linux-.*/" . linux-c-mode) auto-mode-alist) ) )
Your normal default style will still work for any files not matching the patterns specified in auto-mode-alist.
It might be possible to skip the step of defining derived modes by switching on the file's pathname in the C mode hook, but I've never figured out how to get the pathname of the file being loaded in any reliable way.
[ 13:42 Sep 30, 2005 More programming | permalink to this entry | comments ]