diff options
author | cracauer <cracauer@FreeBSD.org> | 1998-12-15 16:51:49 +0000 |
---|---|---|
committer | cracauer <cracauer@FreeBSD.org> | 1998-12-15 16:51:49 +0000 |
commit | 7c6a9a207833b1b036726d7660acfd3630bf64c2 (patch) | |
tree | ef838ae9e307f837ee297cb8973632c4bd7b8ae3 /tools | |
parent | 86c5de6d0d4f83f3bf3d81882670dc01d3e62310 (diff) | |
download | FreeBSD-src-7c6a9a207833b1b036726d7660acfd3630bf64c2.zip FreeBSD-src-7c6a9a207833b1b036726d7660acfd3630bf64c2.tar.gz |
Add some emacs code to make cc-mode almost compatible to style(9).
Sort entries in toplevel README.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/README | 14 | ||||
-rw-r--r-- | tools/tools/editing/freebsd.el | 40 |
2 files changed, 47 insertions, 7 deletions
diff --git a/tools/tools/README b/tools/tools/README index ae36093..123a517 100644 --- a/tools/tools/README +++ b/tools/tools/README @@ -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. diff --git a/tools/tools/editing/freebsd.el b/tools/tools/editing/freebsd.el new file mode 100644 index 0000000..63976b0 --- /dev/null +++ b/tools/tools/editing/freebsd.el @@ -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) + ) |