HowTo xemacsIndentation

From OpenFOAMWiki
Revision as of 19:34, 10 July 2007 by Vz7Cij (Talk | contribs)

free funny ringtones free cool ringtones free funny ringtones didrex online paxil online lorazepam mtv ringtones buy alprazolam cheap pharmacy online sony ringtones free ringtones vigrx online free polyphonic ringtones mp3 ringtones free polyphonic ringtones free polyphonic ringtones order tramadol adipex online cheap ultracet cheap viagra diazepam online zoloft online but vigrx cheap lisinopril cheap pharmacy online cheap celexa free sprint ringtones cheap clonazepam levitra online but sildenafil cheap vicodin online xanax cheap valium cheap pharmacy online sildenafil online wellbutrin online cheap adipex vicodin online wwe ringtones alltel ringtones free verizon ringtones free midi ringtones buy prozac but lipitor sony ericsson ringtones sony ringtones albuterol online viagra online cheap carisoprodol sony ericsson ringtones cheap propecia nexium lorazepam online cheap flexeril free tracfone ringtones cheap clomid cheap paxil motorola ringtones zyban online qwest ringtones nextel ringtones cheap clonazepam music ringtones cheap tramadol soma online buy cyclobenzaprine order tramadol ativan online adipex online nexium online clonazepam online cheap hgh tenuate online zoloft online midi ringtones alprazolam online ambien online free sony ericsson ringtones lisinopril online midi ringtones cheap carisoprodol nokia ringtones free funny ringtones cheap didrex hgh online cheap didrex sony ringtones ultram online buy hgh free ericsson ringtones online fioricet cialis online flexeril online carisoprodol online free real ringtones hoodia online but ambien lipitor online online pharmacy free ringtones zanaflex online cheap phentermine diethylpropion online buy soma sprint ringtones diazepam online free sharp ringtones cheap hydrocodone adipex online buy xanax clomid online tracfone ringtones free sharp ringtones online lisinopril cheap wellbutrin free kyocera ringtones motorola ringtones cheap phentermine buy zoloft cheap carisoprodol buy alprazolam diethylpropion online free nokia ringtones cheap albuterol funny ringtones cheap valium tramadol online online fioricet viagra online samsung ringtones mtv ringtones cheap norco free music ringtones ativan online cheap tenuate buy lipitor ericsson ringtones cheap soma ambien online order rivotril cialis tramadol online ericsson ringtones free mtv ringtones propecia online free jazz ringtones kyocera ringtones viagra online but norco free alltel ringtones buy zanaflex motorola ringtones cheap viagra cheap lortab music ringtones mp3 ringtones albuterol online buy clonazepam ambien online xenical online free real ringtones cheap nexium wellbutrin sonyericsson ringtones celexa online diazepam online nextel ringtones cheap soma mp3 ringtones online hoodia nextel ringtones vicodin online free sagem ringtones punk ringtones propecia online free mono ringtones polyphonic ringtones cheap levitra wwe ringtones cheap lorazepam free samsung ringtones buy zanaflex norco online buy nexium ultram online hoodia online hgh online free cool ringtones mono ringtones cheap rivotril buy meridia cialis online free jazz ringtones clomid online but ortho ativan online diazepam online cingular ringtones valium online hydrocodone online As disscussed on the message board the mighty XEmacs/Emacs-editor can be set up to automatically support the indentation-style favored by the OpenFOAM-developers.

The following two ELisp-snipplets have to be inserted into a file where your (X)Emacs will execute them at start-up (~/.emacs or similar - consult your documentation)

It has been split into two parts in order to give all users at a site

  • the possibility to use this style (and maintain it in a central place)
  • have to possibilty to not use this style

If you're working on a single-user machine or your admin is non-cooperative both snipplets can go to your personal initialization file.

1 Site-wide initialization

This part goes into a file that is executed for every user (your SysAdmin knows how to do that and will be glad to help you):

 
;; for OpenFOAM
(c-add-style "OpenFOAM_HGW"
	     '(
     (c-basic-offset . 4)
     (c-tab-always-indent . t)
     (indent-tabs-mode . nil)
     (c-comment-only-line-offset . (0 . 0))
     (c-indent-comments-syntactically-p . t)
     (c-block-comments-indent-p nil)
     (c-cleanup-list .
         '((defun-close-semi) (list-close-comma) (scope-operator)))
     (c-backslash-column . 48)
     (c-offsets-alist .
     (
     (c .  )                     ;; inside a multi-line C style block  comment
     (defun-open . 0)            ;; brace that opens a function definition
     (defun-close . 0)           ;; brace that closes a function definition
     (defun-block-intro .  )     ;; the first line in a top-level defun
     (class-open . 0)            ;; brace that opens a class definition
     (class-close . 0)           ;; brace that closes a class definition
     (inline-open .  )           ;; brace that opens an in-class inline method
     (inline-close . 0)          ;; brace that closes an in-class inline method
     (topmost-intro . 0)         ;; the first line in a topmost construct
                                 ;; definition
     (topmost-intro-cont . 0)    ;; topmost definition continuation lines
     (member-init-intro .  )     ;; first line in a member initialization list
     (member-init-cont . 0)      ;; subsequent member initialization list lines
     (inher-intro . 0)           ;; first line of a multiple inheritance list
     (inher-cont .  )            ;; subsequent multiple inheritance lines
     (block-open . 0)            ;; statement block open brace
     (block-close . 0)           ;; statement block close brace
     (brace-list-open . 0)       ;; open brace of an enum or static array list
     (brace-list-close . 0)      ;; open brace of an enum or static array list
     (brace-list-intro .  )      ;; first line in an enum or static array list
     (brace-list-entry . 0)      ;; subsequent lines in an enum or static array
                                 ;; list
     (statement . 0)             ;; a C/C  /ObjC statement
     (statement-cont .  )        ;; a continuation of a C/C  /ObjC statement
     (statement-block-intro .  ) ;; the first line in a new statement block
     (statement-case-intro .  )  ;; the first line in a case `block'
     (statement-case-open .  )   ;; the first line in a case `block'
                                 ;; starting with brace
     (substatement .  )          ;; the first line after an if/while/for/do/else
     (substatement-open . 0)     ;; the brace that opens a substatement block
     (case-label .  )            ;; a case or default label
     (access-label . -)          ;; C   private/protected/public access label
     (label . -)                 ;; any non-special C/C  /ObjC label
     (do-while-closure . 0)      ;; the `while' that ends a do/while construct
     (else-clause . 0)           ;; the `else' of an if/else construct
     (comment-intro . 0)         ;; line containing only a comment introduction
     (arglist-intro .  )         ;; the first line in an argument list
     (arglist-cont . 0)          ;; subsequent argument list lines when no
                                 ;; subsequent argument list lines
                                 ;; when no the
                                 ;; arglist opening paren
     (arglist-cont-nonempty . 0) ;; subsequent argument list lines when at
                                 ;; subsequent argument list lines
                                 ;; when at line
                                 ;; as the arglist opening paren
     (arglist-close . 0)         ;; line as the arglist opening paren
     (stream-op .  )             ;; lines continuing a stream operator construct
     (inclass .  )               ;; the construct is nested inside a class
                                 ;; definition
     (cpp-macro .  )             ;; the construct is nested inside a class
                                 ;; definition
     (friend . 0)                ;; a C   friend declaration
     )
     )
     )
)
 
(defun openfoam-hgw-c-mode-hook ()
  (c-set-style "OpenFOAM_HGW")
  )

2 Per-user initialization

Users that want to use that style as a default only have to add this line to their initialization-file (of course this can be done for the whole site if you don't want to give people the choice):

 
(add-hook 'c-mode-common-hook 'openfoam-hgw-c-mode-hook)

3 Manual activation

If the style is not activated for a user automatically it can be activated by calling the c-set-style-function in Emacs and selecting it.