1 ;; 03-c-mode.el --- Set up C mode
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: <Thursday Apr 9, 2020 06:45:27 steve>
9 ;; Download: <https://downloads.sxemacs.org/SYinits/>
10 ;; HTMLised: <https://www.sxemacs.org/SYinits/03-c-mode.html>
11 ;; Git Repo: git clone https://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"))
81 'auto-mode-alist '("^.*/linux.*/.*\\.[ch]$" . linux-c-mode))
83 ;:*=======================
84 ;:* C style for XEmacs core source files
85 (defun xemacs-c-mode ()
86 "C mode with adjusted defaults for use with XEmacs core sources.
92 (setq mode-name "XE/C"))
95 'auto-mode-alist '("^.*/xemacs.*/.*\\.[ch]$" . xemacs-c-mode))
97 ;:*=======================
98 ;:* C style for SXEmacs core source files
99 (defvar c-enable-xemacs-performance-kludge-p)
100 (defun sxemacs-c-mode ()
101 "C mode with adjusted defaults for use with SXEmacs core sources.
106 (c-set-style "linux")
107 (setq mode-name "SXE/C")
108 (make-variable-buffer-local 'c-enable-xemacs-performance-kludge-p)
109 (setq c-enable-xemacs-performance-kludge-p t))
112 'auto-mode-alist '("^.*/sxemacs.*/.*\\.[ch]$" . sxemacs-c-mode))
114 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
115 (message "C mode initialised.")