On Mon, 3 Mar 2014, Dirk Hohndel wrote: > > OK, I used my lunch break (the things I do for fun...) to tweak the tool > and fixed two odd cases that I noticed when studying profile.c.
And I used my sick leave to do the same :)
See attached elisp script subsurface.el.
The 'linux-tabs-only' style is (for now) restricted to .[ch] files.
> Would you test the emacs auto-generated indentation settings against
> the latest?
Did that. The result in not perfect, but there are a few more knobs
for further adjustments.
It corrects a few indentation problems, makes some indentation
glitches obvious and creates new ones ;)
One thing I noticed is that dive.h needs possibly some more love.
Things like:
#define MAX_CYLINDERS (8)
#define MAX_WEIGHTSYSTEMS (6)
#define W_IDX_PRIMARY 0
#define W_IDX_SECONDARY 1
although not incorrect, create some coding style confusion. And this:
#define TRIP_THRESHOLD 3600 * 24 * 3
may be a good idea to change to:
#define TRIP_THRESHOLD (3600 * 24 * 3)
Well, why not let people take a look and improve the elisp script.
> And add them to CodingStyle if they seem to work?
Shouldn't I wait a while to give people time to play with it?
If I were to add subsurface.el to the repository I would put it in the
scripts directory.
Cheers,
--
Cristian(c-add-style "linux-tabs-only"
'("linux"
(c-basic-offset . 8) ; Guessed value
;; the _backslash_ stuff exposes some grotesque things, IMO
;; remove comments and check out the result
;;(c-backslash-column . 16) ; down from default 48
;;(c-backslash-max-column . 16) ; down from default 72
(c-offsets-alist
(access-label . -)
(annotation-top-cont . 0)
(annotation-var-cont . +)
(arglist-close . c-lineup-close-paren)
(arglist-cont c-lineup-gcc-asm-reg 0)
(arglist-cont-nonempty . c-lineup-arglist)
(arglist-intro . +)
(block-close . 0) ; Guessed value
(block-open . 0)
(brace-entry-open . 0)
(brace-list-close . 0) ; Guessed value
(brace-list-open . 0)
(brace-list-entry . 0) ; Guessed value
(brace-list-intro . +) ; Guessed value
(c . c-lineup-C-comments)
(case-label . 0) ; Guessed value
(catch-clause . 0)
(class-close . 0) ; Guessed value
(class-open . 0) ; Guessed value
(comment-intro . c-lineup-comment)
(composition-close . 0)
(composition-open . 0)
(cpp-define-intro . +) ; Guessed value
(cpp-macro . -1000)
(cpp-macro-cont . +)
(defun-block-intro . +) ; Guessed value
(defun-close . 0) ; Guessed value
(defun-open . 0) ; Guessed value
(do-while-closure . 0)
(else-clause . 0) ; Guessed value
(extern-lang-open . 0)
(extern-lang-close . 0) ; Guessed value
(friend . 0)
(func-decl-cont . +)
(inclass . +) ; Guessed value
(incomposition . +)
(inexpr-class . +)
(inexpr-statement . +)
(inextern-lang . 0) ; Guessed value
(inher-cont . c-lineup-multi-inher)
(inher-intro . +)
(inlambda . c-lineup-inexpr-block)
(inline-close . 0)
(inline-open . +)
(inmodule . +)
(innamespace . +)
(knr-argdecl . 0)
(knr-argdecl-intro . 0)
(label . 0) ; Guessed value
(lambda-intro-cont . +)
(member-init-cont . c-lineup-multi-inher)
(member-init-intro . +)
(module-close . 0)
(module-open . 0)
(namespace-close . 0)
(namespace-open . 0)
(objc-method-args-cont . c-lineup-ObjC-method-args)
(objc-method-call-cont c-lineup-ObjC-method-call-colons
c-lineup-ObjC-method-call +)
(objc-method-intro .
[0])
(statement . 0) ; Guessed value
(statement-block-intro . +) ; Guessed value
(statement-case-open . 0)
(statement-case-intro . +) ; Guessed value
;; this should insert one TAB on the line(s) that
;; continue an assignment
;;(statement-cont . +) ; Guessed value
;; this takes notice of an assignment character '=' and
;; aligns code at the right of the '='
(statement-cont . (c-lineup-assignments +)) ; cii
(stream-op . c-lineup-streamop)
(string . -1000)
(substatement . +) ; Guessed value
(substatement-label . 0)
(substatement-open . 0)
(template-args-cont c-lineup-template-args +)
(topmost-intro . 0) ; Guessed value
(topmost-intro-cont . c-lineup-topmost-intro-cont))))
;; subsurface c-style hook
(defun subsurface-file-hook ()
"Subsurface style (automaticaly activated only for .[ch] files)"
(if (and (string-match "/subsurface/" (buffer-file-name))
(string-match "\.[ch]$" (buffer-file-name)))
(progn
(c-set-style "linux-tabs-only")
(setq c-file-style "linux-tabs-only"))))
(add-hook 'c-mode-hook 'subsurface-file-hook)
(defun subsurface-indent-buffer ()
"Indent entire buffer; just `M-x subsurface-indent-buffer'"
(interactive)
(indent-region (point-min) (point-max) nil))
subsurface-indentation.patch.gz
Description: Binary data
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
