Add NetBSD.el containing some settings for emacs' c-mode to better

match NetBSD's KNF (kernel normal form).
This commit is contained in:
wiz 2006-08-08 18:41:11 +00:00
parent ffda6b7e64
commit 78c9a76781
3 changed files with 98 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.137 2006/07/27 23:01:27 lukem Exp $
# $NetBSD: mi,v 1.138 2006/08/08 18:41:11 wiz Exp $
./etc/mtree/set.misc misc-sys-root
./usr/share/dict/README misc-reference-share share
./usr/share/dict/american misc-reference-share share
@ -11,6 +11,16 @@
./usr/share/dict/web2 misc-reference-share share
./usr/share/dict/web2a misc-reference-share share
./usr/share/dict/words misc-reference-share share
./usr/share/doc/html/bind9/arm/Bv9ARM.ch01.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch02.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch03.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch04.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch05.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch06.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch07.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch08.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch09.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.html misc-bind-htmldoc doc
./usr/share/doc/html/bzip2/manual_1.html misc-util-htmldoc share
./usr/share/doc/html/bzip2/manual_2.html misc-util-htmldoc share
./usr/share/doc/html/bzip2/manual_3.html misc-util-htmldoc share
@ -119,30 +129,20 @@
./usr/share/doc/html/ntp/tickadj.htm misc-obsolete obsolete
./usr/share/doc/html/ntp/vxworks.htm misc-obsolete obsolete
./usr/share/doc/html/ntp/y2k.htm misc-obsolete obsolete
./usr/share/doc/html/bind9/arm/Bv9ARM.ch01.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch02.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch03.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch04.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch05.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch06.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch07.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch08.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.ch09.html misc-bind-htmldoc doc
./usr/share/doc/html/bind9/arm/Bv9ARM.html misc-bind-htmldoc doc
./usr/share/doc/html/postfix/ADDRESS_CLASS_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/ADDRESS_REWRITING_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/ADDRESS_VERIFICATION_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/BACKSCATTER_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/BASIC_CONFIGURATION_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/BUILTIN_FILTER_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/CDB_README.html misc-obsolete obsolete
./usr/share/doc/html/postfix/CONNECTION_CACHE_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/CONTENT_INSPECTION_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/CDB_README.html misc-obsolete obsolete
./usr/share/doc/html/postfix/CYRUS_README.html misc-obsolete obsolete
./usr/share/doc/html/postfix/DATABASE_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/DSN_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/DB_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/DEBUG_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/DSN_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/ETRN_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/FILTER_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/IPV6_README.html misc-postfix-htmldoc postfix,doc
@ -151,8 +151,8 @@
./usr/share/doc/html/postfix/LMTP_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/LOCAL_RECIPIENT_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/MAILDROP_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/MYSQL_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/MILTER_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/MYSQL_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/NFS_README.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/OVERVIEW.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/PACKAGE_README.html misc-obsolete obsolete
@ -189,8 +189,8 @@
./usr/share/doc/html/postfix/cleanup.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/commands.html misc-obsolete obsolete
./usr/share/doc/html/postfix/defer.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/discard.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/delivering.html misc-obsolete obsolete
./usr/share/doc/html/postfix/discard.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/error.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/faq.html misc-obsolete obsolete
./usr/share/doc/html/postfix/flush.8.html misc-postfix-htmldoc postfix,doc
@ -239,9 +239,9 @@
./usr/share/doc/html/postfix/receiving.html misc-obsolete obsolete
./usr/share/doc/html/postfix/regexp_table.5.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/relocated.5.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/scache.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/resource.html misc-obsolete obsolete
./usr/share/doc/html/postfix/rewrite.html misc-obsolete obsolete
./usr/share/doc/html/postfix/scache.8.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/security.html misc-obsolete obsolete
./usr/share/doc/html/postfix/sendmail.1.html misc-postfix-htmldoc postfix,doc
./usr/share/doc/html/postfix/showq.8.html misc-postfix-htmldoc postfix,doc
@ -590,8 +590,8 @@
./usr/share/examples/postfix/CONTENT_INSPECTION_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/DATABASE_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/DB_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/DSN_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/DEBUG_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/DSN_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/ETRN_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/FILTER_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/IPV6_README misc-postfix-examples postfix,doc
@ -600,8 +600,8 @@
./usr/share/examples/postfix/LMTP_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/LOCAL_RECIPIENT_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/MAILDROP_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/MYSQL_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/MILTER_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/MYSQL_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/NFS_README misc-postfix-examples postfix,doc
./usr/share/examples/postfix/OVERVIEW misc-postfix-examples postfix,doc
./usr/share/examples/postfix/PCRE_README misc-postfix-examples postfix,doc
@ -701,6 +701,7 @@
./usr/share/examples/usermgmt/.cshrc misc-obsolete obsolete
./usr/share/examples/usermgmt/.login misc-obsolete obsolete
./usr/share/examples/usermgmt/.profile misc-obsolete obsolete
./usr/share/misc/NetBSD.el misc-reference-share share
./usr/share/misc/airport misc-reference-share share
./usr/share/misc/birthtoken misc-reference-share share
./usr/share/misc/country misc-reference-share share

View File

@ -1,9 +1,10 @@
# $NetBSD: Makefile,v 1.28 2003/04/11 11:07:15 jmmv Exp $
# $NetBSD: Makefile,v 1.29 2006/08/08 18:41:11 wiz Exp $
# @(#)Makefile 8.1 (Berkeley) 6/8/93
NOOBJ= # defined
FILES= acronyms acronyms.comp airport ascii birthtoken bsd-family-tree \
FILES= NetBSD.el acronyms acronyms.comp airport ascii \
birthtoken bsd-family-tree \
country domains \
eqnchar flowers indent.pro inter.phone language man.template \
mdoc.template na.phone na.postal operator style zipcodes

76
share/misc/NetBSD.el Normal file
View File

@ -0,0 +1,76 @@
(defconst netbsd-knf-style
'(
;; (c-auto-newline . nil)
;; default indentation level
(c-basic-offset . 8)
;; in which column to add backslashes when macroizing a region
(c-backslash-column . 78)
;; automatically compact brace-else(if)-brace on one line and
;; semi-colon after closing struct brace
(c-cleanup-list . (brace-else-brace
brace-elseif-brace
defun-close-semi))
;; do not indent lines containing only start-of-comment more than default
(c-comment-only-line-offset . 0)
;; start new lines after braces
;; default is: before and after (for all other cases)
(c-hanging-braces-alist . ((defun-open . (before after))
(defun-close . (before after))
(block-open . (after))
(block-close . c-snug-do-while)
(substatement-open . after)
(statement-case-open . nil)
(brace-list-open . after)
(brace-list-close . nil)
))
;; where to put newlines around colons
(c-hanging-colons-alist . (quote ((label after)
(case-label after))))
;; indent comments syntactically
(c-indent-comments-syntactically-p . t)
;; no spaces needed before a label
;; (c-label-minimum-indentation . 0)
;; define offsets for some code parts
(c-offsets-alist . ((arglist-cont-nonempty . 4)
(block-open . 0)
;; (block-open . -)
(brace-list-entry . 8)
(brace-list-open . 8)
(brace-list-close . 0)
(knr-argdecl . 0)
(knr-argdecl-intro . +)
(label . -)
(member-init-intro . ++)
(statement-cont . 4)
(substatement-open . 0)
(case-label . 0)))
;; XXX: undocumented. Recognize KNR style?
(c-recognize-knr-p . t)
;; indent line when pressing tab, instead of a plain tab character
(c-tab-always-indent . t)
;; use TABs for indentation, not spaces
(indent-tabs-mode . t)
;; set default tab width to 8
(tab-width . 8)
)
"NetBSD KNF Style")
(defun knf-c-mode-hook ()
;; Add style and set it for current buffer
(c-add-style "NetBSD KNF" netbsd-knf-style t)
;; useful, but not necessary for the mode
;; give syntactic information in message buffer
;;(setq c-echo-syntactic-information-p t)
;; automatic newlines after special characters
(setq c-toggle-auto-state 1)
;; delete all connected whitespace when pressing delete
(setq c-toggle-hungry-state 1)
;; auto-indent new lines
(define-key c-mode-base-map "\C-m" 'newline-and-indent)
)
(add-hook 'c-mode-hook 'knf-c-mode-hook)
;; breaks saving -- writes "/path/to/file clean" and marks buffer dirty
;;(require 'whitespace)
;;(add-hook 'write-file-hooks 'whitespace-cleanup)