1 ;; 03-c-mode-sy.el --- Set up C mode -*- Emacs-Lisp -*-
3 ;; Copyright (C) 2007 - 2020 Steve Youngs
5 ;; Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;; Created: <2007-12-02>
8 ;; Time-stamp: <Wednesday Feb 12, 2020 12:00:39 steve>
9 ;; Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
10 ;; HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/03-c-mode-sy.html>
11 ;; Git Repo: git clone http://git.sxemacs.org/syinit
12 ;; Keywords: init, compile
14 ;; This file is part of SYinit
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;; notice, this list of conditions and the following disclaimer.
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;; notice, this list of conditions and the following disclaimer in the
25 ;; documentation and/or other materials provided with the distribution.
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;; may be used to endorse or promote products derived from this
29 ;; software without specific prior written permission.
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 ;; This sets up my C programming styles. Note, too, that with this
45 ;; setup I am able to have different styles for different projects.
46 ;; It is a little kludgy, but it works.
50 ;; The HTML version of this file was created with Hrvoje Niksic's
51 ;; htmlize.el which is part of the XEmacs "text-modes" package.
59 ;:*=======================
61 (setq c-comment-leader " ")
66 (python-mode . "python")
69 ;:*=======================
70 ;:* Special style for Linux source files
71 (defun linux-c-mode ()
72 "C mode with adjusted defaults for use with the Linux kernel.
78 (setq mode-name "Linux/C"))
80 (unless (member '("^.*/linux.*/.*\\.[ch]$" . linux-c-mode)
82 (add-to-list 'auto-mode-alist
83 '("^.*/linux.*/.*\\.[ch]$" . linux-c-mode)))
85 ;:*=======================
86 ;:* C style for XEmacs core source files
87 (defun xemacs-c-mode ()
88 "C mode with adjusted defaults for use with XEmacs core sources.
94 (setq mode-name "XE/C"))
96 (unless (member '("^.*/xemacs.*/.*\\.[ch]$" . xemacs-c-mode)
98 (add-to-list 'auto-mode-alist
99 '("^.*/xemacs.*/.*\\.[ch]$" . xemacs-c-mode)))
101 ;:*=======================
102 ;:* C style for SXEmacs core source files
103 (defvar c-enable-xemacs-performance-kludge-p)
104 (defun sxemacs-c-mode ()
105 "C mode with adjusted defaults for use with SXEmacs core sources.
110 (c-set-style "linux")
111 (setq mode-name "SXE/C")
112 (make-variable-buffer-local 'c-enable-xemacs-performance-kludge-p)
113 (setq c-enable-xemacs-performance-kludge-p t))
115 (unless (member '("^.*/sxemacs.*/.*\\.[ch]$" . sxemacs-c-mode)
117 (add-to-list 'auto-mode-alist
118 '("^.*/sxemacs.*/.*\\.[ch]$" . sxemacs-c-mode)))
120 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
121 (message "C mode initialised.")