1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <!-- Created by htmlize-1.34 in css mode. -->
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>03-c-mode.el</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8 <meta name="author" content="Steve Youngs" />
9 <meta name="owner" content="steve@sxemacs.org" />
10 <style type="text/css">
14 background-color: #000000;
17 /* font-lock-comment-face */
21 /* font-lock-doc-string-face */
25 /* font-lock-function-name-face */
30 /* font-lock-keyword-face */
34 /* font-lock-reference-face */
38 /* font-lock-string-face */
42 /* font-lock-variable-name-face */
48 background-color: inherit;
51 text-decoration: underline;
55 background-color: #FD00FD;
56 text-decoration: underline;
59 background-color: #000000;
60 text-decoration: none;
67 <span class="comment">;; 03-c-mode.el --- Set up C mode
69 <span class="comment">;; Copyright (C) 2007 - 2020 Steve Youngs
71 <span class="comment">;; Author: Steve Youngs <<a href="mailto:steve@sxemacs.org">steve@sxemacs.org</a>>
72 ;; Maintainer: Steve Youngs <<a href="mailto:steve@sxemacs.org">steve@sxemacs.org</a>>
73 ;; Created: <2007-12-02>
74 ;; Time-stamp: <Thursday Apr 9, 2020 06:45:27 steve>
75 ;; Download: <<a href="https://downloads.sxemacs.org/SYinits/">https://downloads.sxemacs.org/SYinits/</a>>
76 ;; HTMLised: <<a href="https://www.sxemacs.org/SYinits/03-c-mode.html">https://www.sxemacs.org/SYinits/03-c-mode.html</a>>
77 ;; Git Repo: git clone https://git.sxemacs.org/syinit
78 ;; Keywords: init, compile
80 <span class="comment">;; This file is part of SYinit
82 <span class="comment">;; Redistribution and use in source and binary forms, with or without
83 ;; modification, are permitted provided that the following conditions
86 ;; 1. Redistributions of source code must retain the above copyright
87 ;; notice, this list of conditions and the following disclaimer.
89 ;; 2. Redistributions in binary form must reproduce the above copyright
90 ;; notice, this list of conditions and the following disclaimer in the
91 ;; documentation and/or other materials provided with the distribution.
93 ;; 3. Neither the name of the author nor the names of any contributors
94 ;; may be used to endorse or promote products derived from this
95 ;; software without specific prior written permission.
97 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
98 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
99 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
100 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
101 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
102 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
103 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
104 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
105 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
106 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
107 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109 <span class="comment">;;; Commentary:
110 ;; This sets up my C programming styles. Note, too, that with this
111 ;; setup I am able to have different styles for different projects.
112 ;; It is a little kludgy, but it works.
114 <span class="comment">;;; Credits:
116 ;; The HTML version of this file was created with Hrvoje Niksic's
117 ;; htmlize.el which is part of the XEmacs "text-modes" package.
120 <span class="comment">;;; Todo:
124 <span class="comment">;;; Code:
125 ;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
126 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Defaults
127 </span>(setq c-comment-leader "<span class="doc-string"> </span>")
128 (setq c-default-style
129 '((c-mode . "<span class="string">linux</span>")
130 (c++-mode . "<span class="string">linux</span>")
131 (java-mode . "<span class="string">java</span>")
132 (python-mode . "<span class="string">python</span>")
133 (other . "<span class="string">gnu</span>")))
135 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
136 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Special style for Linux source files
137 </span>(<span class="keyword">defun</span> <span class="function-name">linux-c-mode</span> ()
138 "<span class="doc-string">C mode with adjusted defaults for use with the Linux kernel.
141 \\{c-mode-map}</span>"
143 (c-set-style "<span class="string">linux</span>")
144 (setq mode-name "<span class="string">Linux/C</span>"))
147 'auto-mode-alist '("<span class="string">^.*/linux.*/.*\\.[ch]$</span>" . linux-c-mode))
149 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
150 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> C style for XEmacs core source files
151 </span>(<span class="keyword">defun</span> <span class="function-name">xemacs-c-mode</span> ()
152 "<span class="doc-string">C mode with adjusted defaults for use with XEmacs core sources.
155 \\{c-mode-map}</span>"
157 (c-set-style "<span class="string">gnu</span>")
158 (setq mode-name "<span class="string">XE/C</span>"))
161 'auto-mode-alist '("<span class="string">^.*/xemacs.*/.*\\.[ch]$</span>" . xemacs-c-mode))
163 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
164 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> C style for SXEmacs core source files
165 </span>(<span class="keyword">defvar</span> <span class="variable-name">c-enable-xemacs-performance-kludge-p</span>)
166 (<span class="keyword">defun</span> <span class="function-name">sxemacs-c-mode</span> ()
167 "<span class="doc-string">C mode with adjusted defaults for use with SXEmacs core sources.
170 \\{c-mode-map}</span>"
172 (c-set-style "<span class="string">linux</span>")
173 (setq mode-name "<span class="string">SXE/C</span>")
174 (make-variable-buffer-local 'c-enable-xemacs-performance-kludge-p)
175 (setq c-enable-xemacs-performance-kludge-p t))
178 'auto-mode-alist '("<span class="string">^.*/sxemacs.*/.*\\.[ch]$</span>" . sxemacs-c-mode))
180 <span class="comment">;</span><span class="comment"><span class="reference">:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</span></span><span class="comment">
181 </span>(message "<span class="doc-string">C mode initialised.</span>")
183 <!-- SXEmacs Logo -->
185 <a href="https://www.sxemacs.org/" target="_parent">
186 <img style="padding:0px 5px 0px 0px;border:0;width:88px;height:31px"
187 src="/Images/cbsx.png"
188 title="This page was created entirely in SXEmacs"
189 alt="Created with SXEmacs" />
191 <!-- End SXEmacs Logo -->
192 <!-- Valid XHTML 1.0 -->
193 <a href="http://validator.w3.org/check?uri=https%3a%2f%2fwww.sxemacs.org%2fSYinits%2f03-c-mode.html" target="_blank">
194 <img style="padding:0px 5px 0px 10px;border:0;width:88px;height:31px"
195 src="/Images/valid-xhtml10.png"
196 title="Valid XHTML 1.0 Transitional!"
197 alt="Valid XHTML 1.0 Transitional!" />
200 <!-- End Valid XHTML 1.0 -->
202 <h6>Copyright © 2020 Steve Youngs<br />
203 Verbatim copying and distribution is permitted in any medium,
204 providing this notice is preserved.<br />
206 Last modified: Wed Apr 15 18:11:21 AEST 2020