]> https://gitweb.dealii.org/ - dealii.git/commitdiff
copied deal related macros from my .emacs
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 3 Mar 2006 18:48:29 +0000 (18:48 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 3 Mar 2006 18:48:29 +0000 (18:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@12531 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/scripts/dealmacros.el [new file with mode: 0644]

diff --git a/deal.II/common/scripts/dealmacros.el b/deal.II/common/scripts/dealmacros.el
new file mode 100644 (file)
index 0000000..88cd885
--- /dev/null
@@ -0,0 +1,94 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; $Id$
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Emacs macros supporting deal.II programming
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun deal-indentation ()
+"Install the indentation offsets used in the deal.II source code.
+All contributions to the library should follow this indentation in
+order to maintain a common look and feel as well as avoiding
+unnecessary diffs in the archives.
+
+The function is intended as a part of the cc-mode-startup-fun hook."
+
+  (setq c-basic-offset 2)
+  (c-set-offset 'string                0)
+  (c-set-offset 'defun-open            0)
+  (c-set-offset 'defun-close           0)
+  (c-set-offset 'defun-block-intro     '+)
+  (c-set-offset 'class-open            0)
+  (c-set-offset 'class-close           0)
+  (c-set-offset 'inline-open           '+)
+  (c-set-offset 'inline-close          0)
+  (c-set-offset 'knr-argdecl-intro     '+)
+  (c-set-offset 'knr-argdecl           0)
+  (c-set-offset 'topmost-intro         0)
+  (c-set-offset 'topmost-intro-cont    0)
+  (c-set-offset 'member-init-intro     16)
+  (c-set-offset 'member-init-cont      0)
+  (c-set-offset 'inher-intro           '+)
+  (c-set-offset 'inher-cont            'c-lineup-multi-inher)
+  (c-set-offset 'block-close           0)
+  (c-set-offset 'brace-list-open       0)
+  (c-set-offset 'brace-list-close      0)
+  (c-set-offset 'brace-list-intro      6)
+  (c-set-offset 'brace-list-entry      0)
+  (c-set-offset 'statement             'c-lineup-runin-statements)
+  (c-set-offset 'statement-cont        'c-lineup-math)
+  (c-set-offset 'statement-block-intro '+)
+  (c-set-offset 'statement-case-intro  '+)
+  (c-set-offset 'statement-case-open   '-)
+  (c-set-offset 'substatement          '+)
+  (c-set-offset 'substatement-open     '+)
+  (c-set-offset 'case-label            '+)
+  (c-set-offset 'access-label          '-)
+  (c-set-offset 'label                 2)
+  (c-set-offset 'do-while-closure      0)
+  (c-set-offset 'else-clause           0)
+  (c-set-offset 'arglist-intro         '+)
+  (c-set-offset 'arglist-cont          0)
+  (c-set-offset 'arglist-cont-nonempty 'c-lineup-arglist)
+  (c-set-offset 'arglist-close         0)
+  (c-set-offset 'stream-op             'c-lineup-streamop)
+  (c-set-offset 'inclass               '++)
+  (c-set-offset 'cpp-macro             -1000)
+  (c-set-offset 'friend                0)
+
+  (c-set-offset 'comment-intro         'c-lineup-comment)
+  (c-set-offset 'c                     'c-lineup-C-comments)
+  
+  (c-set-offset 'objc-method-intro     -1000)
+  (c-set-offset 'objc-method-args-cont 'c-lineup-ObjC-method-args)
+  (c-set-offset 'objc-method-call-cont 'c-lineup-ObjC-method-call)
+       
+  (setq c-comment-only-line-offset 33)
+)
+
+(defun deal-newline ()
+"Setup emacs to automatically insert newlines and indentation before
+and after semicolon or braces, like it is done in the deal.II coding style."
+  (define-key c++-mode-map "\C-m" 'newline-and-indent)
+  (setq c-hanging-braces-alist '((defun-open        . (before after))
+                                 (defun-close       . (before after))
+                                 (class-open        . (before after))
+                                 (class-close       . (after))
+                                 (inline-open       . (before after))
+                                 (inline-close      . (before after))
+                                 (block-open        . (before after))
+                                 (block-close       . (after))
+                                 (brace-list-open   . (nil))))
+  (setq c-hanging-colons-alist '((member-init-intro . (after))
+                                (inher-intro       . (after))
+                                (label             . (after))
+                                (case-label        . (after))
+                                (access-label      . (after))))
+  (setq c-cleanup-list '(empty-defun-braces
+                        defun-close-semi
+                        list-close-comma
+                        scope-operator))
+)
+
+(provide 'dealmacros)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.