freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] .emacs


From: Masatake YAMATO
Subject: Re: [Devel] .emacs
Date: Mon, 08 Mar 2004 00:22:42 +0900 (JST)

> > I'd like to read your emacs's c-mode setting.
> 
> If you can develop something similar I would be glad to incorporate
> it.  BTW, a fundamental property is `no tabs in the source code'.  Too
> many (non-Unix?) editors set the tabs width to a non-standard value.

I've developed. This one is not perfect. I will improve it step by
step.

Masatake YAMATO

;; ft-style.el --- c-mode indentation style for freetype's source files
;;
;;  Copyright 2004 Masatake YAMATO
;;
;; Author: Masatake YAMATO<address@hidden>
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:
;; (See http://www.freetype.org/pipermail/devel/2004-January/010085.html.
;;  This program tries to emulate the mater of the universe.)
;;
;; 1. Put this program to your `load-path'.
;; 2. Put (require 'ft-style) in your .emacs.
;; 3. Do C-x C-f a freetype source file.
;; 4. C-c . in the c-mode buffer. Emacs will ask you "Which C indentation 
style? "
;; 5. Type "freetype" and return.
;;
;;
;;; Other conding rules I found in the source files.
;; 1. A source file ends with 2 new lines and /* END */.
;;
;; 2. A space is needed before/after a parenthesis like;
;;
;;           if ( !err )
;;              error = FT_New_Face( library, (const char*)path,
;;                                   face_index, aface );
;;
;;  3. A space is needed after if/while. See above example.
;;
;;
;;; TODO:
;; 1. comment indentation
;; 2. statement-cont: ftmac.c.
;;           is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
;;                                     sfnt_data[1] == 'T' &&
;;                                     sfnt_data[2] == 'T' &&
;;                                     sfnt_data[3] == 'O';
;; 3. topmost-intro-cont: (freetype.h, typedef struct  FT_Glyph_Metrics_)
;; 4. Put the file variables setting to the source files 
;;    if freetype developers agree.
;;    /* Local variables: */
;;    /* c-file-style: "freetype" */
;;    /* End: */
;;
(defconst ft-c-style
  '((indent-tabs-mode . t)
    (c-basic-offset . 2)
    (c-offsets-alist . ((topmost-intro     . 2)
                        (defun-open        . 2)
                        (defun-block-intro . +)
                        (func-decl-cont    . 0)
                        (knr-argdecl-intro . 0)
                        (substatement-open . 0)
                        (substatement      . +)
                        (label             . 0)
                        (inclass           . 0)
                        (brace-list-open   . 0)
                        (brace-list-intro  . +)
                        ;; ???
                        (arglist-cont-nonempty . (c-lineup-gcc-asm-reg 
                                                  c-lineup-arglist))
                        (statement-cont . 0))))
  "C Programming Style used in FreeType.")

(defun ft-c-mode-common-hook ()
  (c-add-style "FreeType" ft-c-style nil))

(add-hook 'c-mode-common-hook 'ft-c-mode-common-hook)

(provide 'ft-style)
;; ft-style.el ends here.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]