← Back to team overview

dolfin team mailing list archive

Re: [noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/error-control] Rev 5211: Add documentation (I think) and use the peculiar dolfin convention for]

 

On Sun, Nov 07, 2010 at 11:04:31PM +0100, Kristian Ølgaard wrote:
> On 7 November 2010 21:41, Marie Rognes <meg@xxxxxxxxx> wrote:
> > On 07. nov. 2010 21:27, Kristian Ølgaard wrote:
> >> On 7 November 2010 11:59, Marie E. Rognes <meg@xxxxxxxxx> wrote:
> >>
> >>> On 6. nov. 2010, at 00:17, Anders Logg <logg@xxxxxxxxx> wrote:
> >>>
> >>>
> >>>> It is not peculiar, it's just the right way to brace!
> >>>>
> >>>>
> >>> No, it isn't.
> >>>
> >> Yes, it is!
> >>
> >> http://www.fenicsproject.org/doc/styleguides/codestyleguides.html#placement-of-brackets-and-indent-style
> >>
> >> :)
> >>
> >> Kristian
> >>
> >>
> >
> > I fully agree that it is the DOLFIN way. Hence, my previous comment on
> > adapting to the DOLFIN convention. However, that does not mean that it
> > is not "peculiar" or that it is the right way. At least, it is not the
> > true way ;)
>
> I tend to disagree, I like BSD/Allman best.
>
> > However, more importantly than discussing religion: how do you get your
> > emacs to get the indentation right?
>
> I don't know since I just use gedit, occasionally vi (we can disagree
> on that too ;) ), but I found this page:
>
> http://www.emacswiki.org/emacs/IndentingC
>
> hope it helps.

Here's some useful Emacs stuff:

;; --- Indentation of braces for C++ ---

(defun my-c++-mode-hook ()
  (c-set-offset 'substatement-open 0))
(add-hook 'c++-mode-hook 'my-c++-mode-hook)

;; --- Indentation of braces for C ---

(defun my-c-mode-hook ()
  (c-set-offset 'substatement-open 0))
(add-hook 'c-mode-hook 'my-c-mode-hook)

;; --- Convert all tabs to spaces ---
(setq-default indent-tabs-mode nil)

;; Update time stamp for DOLFIN source code
(setq
  time-stamp-start "Last changed:\\\\? "; start of pattern
  time-stamp-end "\\\\?\n"              ; end of pattern
  time-stamp-active t                   ; do enable time-stamps
  time-stamp-line-limit 20              ; check first 10 lines
  time-stamp-format "%04y-%02m-%02d")   ; date format

;; Update timestamp before saving
(add-hook 'before-save-hook 'time-stamp)

;; Remove trailing whitespaces before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)

;; turn on interactive do
(require 'ido)
(ido-mode t)

--
Anders



Follow ups

References