Add some emacs code to make cc-mode almost compatible to style(9).

Sort entries in toplevel README.
This commit is contained in:
Martin Cracauer 1998-12-15 16:51:49 +00:00
parent 38db74296d
commit 37fcb38764
2 changed files with 47 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $Id: README,v 1.11 1998/05/20 09:19:50 wosch Exp $
# $Id: README,v 1.12 1998/09/09 05:48:51 jb Exp $
This directory is for tools.
@ -7,15 +7,15 @@ other categories.
Please make a subdir per program, and add a brief description to this file.
epfe extract printing filter examples from printing.sgml
ifinfo Uses the interface MIB to print out all the information
an interface exports in an ugly form.
kernxref Shellscript to cross reference symbols in the LINT kernel.
epfe extract printing filter examples from printing.sgml
tcl_bmake generates a bmake Makefile for src/lib/libtcl
html-mv Rename HTML generated filenames to human readable filenames.
kdrv KernelDriver; add/list/remove third-party kernel driver
source to/in/from a kernel source tree.
scsi-defects Get at the primary or grown defect list of a SCSI disk.
portsinfo Generate list of new ports for last two weeks.
html-mv Rename HTML generated filenames to human readable filenames.
kernxref Shellscript to cross reference symbols in the LINT kernel.
mid Create a Message-ID database for mailing lists.
portsinfo Generate list of new ports for last two weeks.
scsi-defects Get at the primary or grown defect list of a SCSI disk.
tcl_bmake generates a bmake Makefile for src/lib/libtcl
upgrade Scripts used for upgrading an installed system.

View File

@ -0,0 +1,40 @@
;;; This function switches C-mode so that it indents almost everything
;;; as specified in FreeBSD's style(9). Tested with emacs-19.34 and
;;; xemacs-20.4.
;;;
;;; Use "M-x bsd" in a C mode buffer to activate it.
;;;
;;; The only problem I found is top-level indenting:
;;;
;;; We want function definitions with the function name at the beginning
;;; of a second line after the return type specification in the first:
;;; > int
;;; > foo(int bla)
;;; But emacs c-mode can't treat this differently from other multiple-line
;;; toplevel constructs:
;;; > const char *const bar =
;;; > "sometext";
;;; which means the second line must be indented by hand.
;;;
;;; To make this the default, use a line like this, but you can't easily
;;; switch back to default GNU style, since the old state isn't saved.
;;; (add-hook 'c-mode-common-hook 'bsd)
;;; As long as you don't have this in the c-mode hook you can edit GNU
;;; and BSD style C sources within one emacs session with no problem.
;;;
;;; Please report problems and additions directly to cracauer@freebsd.org
(defun bsd () (interactive)
(c-set-style "bsd")
(setq indent-tabs-mode t)
;; Use C-c C-s at points of source code so see which
;; c-set-offset is in effect for this situation
(c-set-offset 'defun-block-intro 8)
(c-set-offset 'statement-block-intro 8)
(c-set-offset 'statement-case-intro 8)
(c-set-offset 'substatement-open 4)
(c-set-offset 'substatement 8)
(c-set-offset 'arglist-cont-nonempty 4)
(c-set-offset 'inclass 8)
(c-set-offset 'knr-argdecl-intro 8)
)