[Genabel-commits] r1632 - www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 5 14:59:36 CET 2014


Author: lckarssen
Date: 2014-03-05 14:59:35 +0100 (Wed, 05 Mar 2014)
New Revision: 1632

Modified:
   www/codingstyle.html
   www/codingstyle.org
Log:
Minor updates to the coding style guidelines:
- Separate heading for Emacs 23 and 24, because of the new prog-mode
- Fix spelling mistakes


Modified: www/codingstyle.html
===================================================================
--- www/codingstyle.html	2014-03-03 21:05:20 UTC (rev 1631)
+++ www/codingstyle.html	2014-03-05 13:59:35 UTC (rev 1632)
@@ -1,63 +1,88 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
-<title>GenABEL project coding style guidelines</title>
-<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
-<meta name="title" content="GenABEL project coding style guidelines"/>
+<title>The GenABEL project coding style guidelines</title>
+<!-- 2014-03-05 wo 14:59 -->
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
 <meta name="generator" content="Org-mode"/>
-<meta name="generated" content="2013-05-17T09:25+0200"/>
 <meta name="author" content="The GenABEL development team"/>
-<meta name="description" content=""/>
-<meta name="keywords" content=""/>
 <style type="text/css">
  <!--/*--><![CDATA[/*><!--*/
-  html { font-family: Times, serif; font-size: 12pt; }
   .title  { text-align: center; }
-  .todo   { color: red; }
+  .todo   { font-family: monospace; color: red; }
   .done   { color: green; }
-  .tag    { background-color: #add8e6; font-weight:normal }
-  .target { }
+  .tag    { background-color: #eee; font-family: monospace;
+            padding: 2px; font-size: 80%; font-weight: normal; }
   .timestamp { color: #bebebe; }
   .timestamp-kwd { color: #5f9ea0; }
-  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
-  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
-  .center {margin-left:auto; margin-right:auto; text-align:center;}
-  p.verse { margin-left: 3% }
+  .right  { margin-left: auto; margin-right: 0px;  text-align: right; }
+  .left   { margin-left: 0px;  margin-right: auto; text-align: left; }
+  .center { margin-left: auto; margin-right: auto; text-align: center; }
+  .underline { text-decoration: underline; }
+  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
+  p.verse { margin-left: 3%; }
   pre {
-	border: 1pt solid #AEBDCC;
-	background-color: #F3F5F7;
-	padding: 5pt;
-	font-family: courier, monospace;
-        font-size: 90%;
-        overflow:auto;
+    border: 1px solid #ccc;
+    box-shadow: 3px 3px 3px #eee;
+    padding: 8pt;
+    font-family: monospace;
+    overflow: auto;
+    margin: 1.2em;
   }
-  table { border-collapse: collapse; }
-  td, th { vertical-align: top;  }
-  th.right  { text-align:center;  }
-  th.left   { text-align:center;   }
-  th.center { text-align:center; }
-  td.right  { text-align:right;  }
-  td.left   { text-align:left;   }
-  td.center { text-align:center; }
+  pre.src {
+    position: relative;
+    overflow: visible;
+    padding-top: 1.2em;
+  }
+  pre.src:before {
+    display: none;
+    position: absolute;
+    background-color: white;
+    top: -10px;
+    right: 10px;
+    padding: 3px;
+    border: 1px solid black;
+  }
+  pre.src:hover:before { display: inline;}
+  pre.src-sh:before    { content: 'sh'; }
+  pre.src-bash:before  { content: 'sh'; }
+  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
+  pre.src-R:before     { content: 'R'; }
+  pre.src-perl:before  { content: 'Perl'; }
+  pre.src-java:before  { content: 'Java'; }
+  pre.src-sql:before   { content: 'SQL'; }
+
+  table { border-collapse:collapse; }
+  td, th { vertical-align:top;  }
+  th.right  { text-align: center;  }
+  th.left   { text-align: center;   }
+  th.center { text-align: center; }
+  td.right  { text-align: right;  }
+  td.left   { text-align: left;   }
+  td.center { text-align: center; }
   dt { font-weight: bold; }
-  div.figure { padding: 0.5em; }
-  div.figure p { text-align: center; }
-  div.inlinetask {
-    padding:10px;
-    border:2px solid gray;
-    margin:10px;
+  .footpara:nth-child(2) { display: inline; }
+  .footpara { display: block; }
+  .footdef  { margin-bottom: 1em; }
+  .figure { padding: 1em; }
+  .figure p { text-align: center; }
+  .inlinetask {
+    padding: 10px;
+    border: 2px solid gray;
+    margin: 10px;
     background: #ffffcc;
   }
+  #org-div-home-and-up
+   { text-align: right; font-size: 70%; white-space: nowrap; }
   textarea { overflow-x: auto; }
-  .linenr { font-size:smaller }
-  .code-highlighted {background-color:#ffff00;}
-  .org-info-js_info-navigation { border-style:none; }
-  #org-info-js_console-label { font-size:10px; font-weight:bold;
-                               white-space:nowrap; }
-  .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
-                                 font-weight:bold; }
+  .linenr { font-size: smaller }
+  .code-highlighted { background-color: #ffff00; }
+  .org-info-js_info-navigation { border-style: none; }
+  #org-info-js_console-label
+    { font-size: 10px; font-weight: bold; white-space: nowrap; }
+  .org-info-js_search-highlight
+    { background-color: #ffff00; color: #000000; font-weight: bold; }
   /*]]>*/-->
 </style>
 <script type="text/javascript">
@@ -106,285 +131,323 @@
  }
 /*]]>*///-->
 </script>
-
 </head>
 <body>
-
-<div id="preamble">
-
-</div>
-
 <div id="content">
-<h1 class="title">GenABEL project coding style guidelines</h1>
-
-<p>This document describes the coding style guidelines of the GenABEL
-project. At present it is considered <b>work in progress</b>. As the name
-says these are guidelines, not rules. We don't want these guidelines
-to restrict people from contributing code to the project. On the other
-hand, respecting these guidelines will lead to uniform and more easily
-maintainable code and consequently we encourage everyone to follow
-them.
-</p>
-
+<h1 class="title">The GenABEL project coding style guidelines</h1>
 <div id="table-of-contents">
 <h2>Table of Contents</h2>
 <div id="text-table-of-contents">
 <ul>
-<li><a href="#sec-1">1 General</a>
+<li><a href="#sec-1">1. General</a>
 <ul>
-<li><a href="#sec-1-1">1.1 White space</a></li>
-<li><a href="#sec-1-2">1.2 Other</a></li>
+<li><a href="#sec-1-1">1.1. White space</a></li>
+<li><a href="#sec-1-2">1.2. Other</a></li>
 </ul>
 </li>
-<li><a href="#sec-2">2 R</a>
+<li><a href="#sec-2">2. R</a>
 <ul>
-<li><a href="#sec-2-1">2.1 Code</a></li>
-<li><a href="#sec-2-2">2.2 Documentation</a></li>
+<li><a href="#sec-2-1">2.1. Code</a></li>
+<li><a href="#sec-2-2">2.2. Documentation</a></li>
 </ul>
 </li>
-<li><a href="#sec-3">3 C/C++</a></li>
-<li><a href="#sec-4">4 LaTeX</a></li>
-<li><a href="#sec-5">5 Configuring editors and IDEs to support the guidelines</a>
+<li><a href="#sec-3">3. C/C++</a></li>
+<li><a href="#sec-4">4. LaTeX</a></li>
+<li><a href="#sec-5">5. Configuring editors and IDEs to support the guidelines</a>
 <ul>
-<li><a href="#sec-5-1">5.1 Eclipse</a></li>
-<li><a href="#sec-5-2">5.2 Emacs</a></li>
+<li><a href="#sec-5-1">5.1. Eclipse</a></li>
+<li><a href="#sec-5-2">5.2. Emacs</a>
+<ul>
+<li><a href="#sec-5-2-1">5.2.1. Emacs 23</a></li>
+<li><a href="#sec-5-2-2">5.2.2. Emacs 24</a></li>
 </ul>
 </li>
 </ul>
+</li>
+</ul>
 </div>
 </div>
+<p>
+This document describes the coding style guidelines of the GenABEL
+project. At present it is considered <b>work in progress</b>. As the name
+says these are guidelines, not rules. We don't want these guidelines
+to restrict people from contributing code to the project. On the other
+hand, respecting these guidelines will lead to uniform and more easily
+maintainable code and consequently we encourage everyone to follow
+them.
+</p>
 
-<div id="outline-container-1" class="outline-2">
+<div id="outline-container-sec-1" class="outline-2">
 <h2 id="sec-1"><span class="section-number-2">1</span> General</h2>
 <div class="outline-text-2" id="text-1">
-
-
-</div>
-
-<div id="outline-container-1-1" class="outline-3">
+</div><div id="outline-container-sec-1-1" class="outline-3">
 <h3 id="sec-1-1"><span class="section-number-3">1.1</span> White space</h3>
 <div class="outline-text-3" id="text-1-1">
-
-<ul>
-<li>comma's should be followed by a space
+<ul class="org-ul">
+<li>commas should be followed by a space
 </li>
-<li>operators (<code>= + - *</code> etc.) should be surrounded by a space (and in R
-     the <code><-</code> operator too)
+<li>operators (<code>= + - * && >=</code> etc.) should be surrounded by a space (and in R
+the <code><-</code> operator too)
 </li>
 <li>a file should always have a newline at the end (Why?)
 </li>
 <li>don't use tabs (as everyone seems to have a different setting for
-     the tab stop): use spaces. How many spaces is up for debate (YA &
-     LCK suggest 4). Of course Makefiles are exempt from this rule as
-     tabs are mandatory
+the tab stop): use spaces. How many spaces is up for debate (YA &
+LCK suggest 4). Of course Makefiles are exempt from this rule as
+tabs are mandatory
 </li>
 <li>no (unnecessary) empty lines. Empty lines separating (logical)
-     blocks of code are OK, empty lines at the bottom of a file, a
-     function, an if-statement are not.
+blocks of code are OK, empty lines at the bottom of a file, a
+function, an if-statement are not.
 </li>
 </ul>
-
 </div>
-
 </div>
 
-<div id="outline-container-1-2" class="outline-3">
+<div id="outline-container-sec-1-2" class="outline-3">
 <h3 id="sec-1-2"><span class="section-number-3">1.2</span> Other</h3>
 <div class="outline-text-3" id="text-1-2">
-
-<ul>
+<ul class="org-ul">
 <li>lines should not be longer than 80 characters
 </li>
-<li>do not use one charcter variables, except when it is a counter in a loop
+<li>do not use one-character variable names, except for simple
+counters in loops
 </li>
 <li>issues to be be fixed should be represented as:
-
-
-
-<pre class="example">//FIXME(name_of_person): explanation what is wrong.
+<pre class="example">
+//FIXME(name_of_person): explanation what is wrong.
 </pre>
-
 <p>
-     This  makes looking and finxing for this types of problems easier
-</p></li>
+This  makes looking and finxing for this types of problems easier
+</p>
+</li>
 <li>things to do must be annotated with:
-
-
-
-<pre class="example">//TODO(name_of_person): explain what to do
+<pre class="example">
+//TODO(name_of_person): explain what to do
 </pre>
-
 <p>
-     Don't be shy and put your name in there if this is something that
-     you expect will take a while.
-</p></li>
+Don't be shy and put your name in there if this is something that
+you expect will take a while.
+</p>
+</li>
 <li>code that is old/broken should be removed (we have our version
-     control system so we can always go back to see how things were in
-     the past)
+control system so we can always go back to see how things were in
+the past)
 </li>
 <li>functions should not contain more than ~30 lines. If you need
-     more: you probably need a new function anyway to separate
-     logical parts of the code.
+more: you probably need a new function anyway to separate
+logical parts of the code.
 </li>
 <li>seperate code that outputs to file or console from rest of the code
 </li>
 </ul>
-
 </div>
 </div>
-
 </div>
 
-<div id="outline-container-2" class="outline-2">
+<div id="outline-container-sec-2" class="outline-2">
 <h2 id="sec-2"><span class="section-number-2">2</span> R</h2>
 <div class="outline-text-2" id="text-2">
-
-
-</div>
-
-<div id="outline-container-2-1" class="outline-3">
+</div><div id="outline-container-sec-2-1" class="outline-3">
 <h3 id="sec-2-1"><span class="section-number-3">2.1</span> Code</h3>
 <div class="outline-text-3" id="text-2-1">
-
-<ul>
+<ul class="org-ul">
 <li>Use the <code><-</code> operator for assignments, not <code>=</code>
 </li>
 <li>use codetools in R to check your functions
 </li>
 </ul>
-
 </div>
-
 </div>
 
-<div id="outline-container-2-2" class="outline-3">
+<div id="outline-container-sec-2-2" class="outline-3">
 <h3 id="sec-2-2"><span class="section-number-3">2.2</span> Documentation</h3>
 <div class="outline-text-3" id="text-2-2">
-
-<p>   We prefer that all documentation should be in roxygen2 format.
-</p></div>
+<p>
+We prefer that all documentation should be in roxygen2 format.
+</p>
 </div>
-
 </div>
+</div>
 
-<div id="outline-container-3" class="outline-2">
+<div id="outline-container-sec-3" class="outline-2">
 <h2 id="sec-3"><span class="section-number-2">3</span> C/C++</h2>
 <div class="outline-text-2" id="text-3">
-
-<ul>
+<ul class="org-ul">
 <li>style of brackets: is the opening bracket on the same line as the
-    name of the loop/function or on a new line on its own? (e.g. K&R,
-    Allman or bsd style) <b>TODO: decide which one</b>
+name of the loop/function or on a new line on its own? (e.g. K&R,
+Allman or bsd style) <b>TODO: decide which one</b>
 </li>
 <li>both brackets of else statements should be on the same line
     <b>Depends on previous item</b>
 </li>
 <li>always use {} in if clauses/for loops (even if there is only one
-    statement in the clause/loop
+statement in the clause/loop
 </li>
 <li>make sure your code compiles without warnings/errors using
-
-
-
-<pre class="example">gcc -wall
+<pre class="example">
+gcc -wall
 </pre>
-
 </li>
 </ul>
-
 </div>
-
 </div>
 
-<div id="outline-container-4" class="outline-2">
+<div id="outline-container-sec-4" class="outline-2">
 <h2 id="sec-4"><span class="section-number-2">4</span> LaTeX</h2>
-<div class="outline-text-2" id="text-4">
-
 </div>
-
-</div>
-
-<div id="outline-container-5" class="outline-2">
+<div id="outline-container-sec-5" class="outline-2">
 <h2 id="sec-5"><span class="section-number-2">5</span> Configuring editors and IDEs to support the guidelines</h2>
 <div class="outline-text-2" id="text-5">
-
-
-</div>
-
-<div id="outline-container-5-1" class="outline-3">
+</div><div id="outline-container-sec-5-1" class="outline-3">
 <h3 id="sec-5-1"><span class="section-number-3">5.1</span> Eclipse</h3>
 <div class="outline-text-3" id="text-5-1">
-
-<p>   This works for Eclipse IDE for C/C++ Developers Juno Service release 2.
-   To replace tabs with spaces go to
-</p><ul>
+<p>
+This works for Eclipse IDE for C/C++ Developers Juno Service release 2.
+To replace tabs with spaces go to
+</p>
+<ul class="org-ul">
 <li>Preferences -> C/C++ -> Code Style -> Formatter
 </li>
 <li>Preferences -> StatET -> R code Formatting
 </li>
 </ul>
-
 </div>
-
 </div>
 
-<div id="outline-container-5-2" class="outline-3">
+<div id="outline-container-sec-5-2" class="outline-3">
 <h3 id="sec-5-2"><span class="section-number-3">5.2</span> Emacs</h3>
 <div class="outline-text-3" id="text-5-2">
+<p>
+Add the following to your <code>~/.emacs</code> file (tested in Emacs 23 and
+24).
+</p>
+</div>
+<div id="outline-container-sec-5-2-1" class="outline-4">
+<h4 id="sec-5-2-1"><span class="section-number-4">5.2.1</span> Emacs 23</h4>
+<div class="outline-text-4" id="text-5-2-1">
+<div class="org-src-container">
 
-
-
-
-<pre class="src src-lisp"><span style="font-weight: bold; font-style: italic;">;;; </span><span style="font-weight: bold; font-style: italic;">Trailing white space stuff</span>
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">Show trailing white space in orange</span>
+<pre class="src src-lisp"><span style="color: #99968b;">;;; </span><span style="color: #99968b;">Trailing white space stuff</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Show trailing white space in orange</span>
 (setq-default show-trailing-whitespace t)
-(set-face-background 'trailing-whitespace <span style="font-style: italic;">"orange1"</span>)
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">nuke whitespaces when writing to a file</span>
+(set-face-background 'trailing-whitespace <span style="color: #95e454;">"orange1"</span>)
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">nuke whitespaces when writing to a file</span>
 (add-hook 'before-save-hook 'whitespace-cleanup)
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">Don't insert tabs when indenting regions (setq-default is used here</span>
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">to only overwrite this in buffers that do not have their own local</span>
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">values for this variable)</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Don't insert tabs when indenting regions (setq-default is used here</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">to only overwrite this in buffers that do not have their own local</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">values for this variable)</span>
 (setq-default indent-tabs-mode nil)
 
-<span style="font-weight: bold; font-style: italic;">;;; </span><span style="font-weight: bold; font-style: italic;">ESS mode (R, S, etc.)</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">always insert at final newline character (if not present yet) when</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">saving a file.</span>
+(setq require-final-newline t)
+
+
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">ESS mode (R, S, etc.)</span>
 (add-hook 'ess-mode-hook
-   (<span style="font-weight: bold;">lambda</span> ()
-     (auto-fill-mode t)          <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Turn on auto-fill-mode</span>
-     <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Set pdflatex as the default command for Sweave (default: texi2pdf)</span>
-     (setq ess-swv-pdflatex-commands (quote (<span style="font-style: italic;">"pdflatex"</span> <span style="font-style: italic;">"texi2pdf"</span> <span style="font-style: italic;">"make"</span>)))
+   (<span style="color: #8ac6f2; font-weight: bold;">lambda</span> ()
+     (auto-fill-mode t)          <span style="color: #99968b;">; </span><span style="color: #99968b;">Turn on auto-fill-mode</span>
+     <span style="color: #99968b;">; </span><span style="color: #99968b;">Set pdflatex as the default command for Sweave (default: texi2pdf)</span>
+     (setq ess-swv-pdflatex-commands (quote (<span style="color: #95e454;">"pdflatex"</span> <span style="color: #95e454;">"texi2pdf"</span> <span style="color: #95e454;">"make"</span>)))
      ))
 
 
-<span style="font-weight: bold; font-style: italic;">;;; </span><span style="font-weight: bold; font-style: italic;">C-mode:</span>
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">change C indentation style ("{" directly under "for" etc.)</span>
-(setq c-default-style <span style="font-style: italic;">"bsd"</span>
-   c-basic-offset 4)            <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Indentation of 4 spaces</span>
-<span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">Turn on auto fill mode (max 80 columns)</span>
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">C-mode:</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">change C indentation style ("{" directly under "for" etc.)</span>
+(setq c-default-style <span style="color: #95e454;">"bsd"</span>
+   c-basic-offset 4)            <span style="color: #99968b;">; </span><span style="color: #99968b;">Indentation of 4 spaces</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Turn on auto fill mode (max 80 columns)</span>
 (add-hook 'c-mode-common-hook 'auto-fill-mode)
 
-<span style="font-weight: bold; font-style: italic;">;;; </span><span style="font-weight: bold; font-style: italic;">LaTeX using AucTeX</span>
-(load <span style="font-style: italic;">"auctex.el"</span> nil t t)
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">LaTeX using AucTeX</span>
+(load <span style="color: #95e454;">"auctex.el"</span> nil t t)
 (add-hook 'LaTeX-mode-hook
-(<span style="font-weight: bold;">lambda</span>()
-   'turn-on-auto-fill     <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Set max of 80 columns</span>
+(<span style="color: #8ac6f2; font-weight: bold;">lambda</span>()
+   'turn-on-auto-fill     <span style="color: #99968b;">; </span><span style="color: #99968b;">Set max of 80 columns</span>
  ))
 
- <span style="font-weight: bold; font-style: italic;">;; </span><span style="font-weight: bold; font-style: italic;">Emacs' regular latex mode (when AucTeX isn't present)</span>
+ <span style="color: #99968b;">;; </span><span style="color: #99968b;">Emacs' regular latex mode (when AucTeX isn't present)</span>
  (add-hook 'latex-mode-hook 'turn-on-reftex)
  (add-hook 'latex-mode-hook 'turn-on-auto-fill)
 </pre>
+</div>
+</div>
+</div>
 
+<div id="outline-container-sec-5-2-2" class="outline-4">
+<h4 id="sec-5-2-2"><span class="section-number-4">5.2.2</span> Emacs 24</h4>
+<div class="outline-text-4" id="text-5-2-2">
+<p>
+Emacs 24 has a new mode, called <code>prog-mode</code>, from which all
+programming modes inherit.
+</p>
+<div class="org-src-container">
+
+<pre class="src src-lisp"><span style="color: #99968b;">;;; </span><span style="color: #99968b;">Trailing white space stuff</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Show trailing white space in orange</span>
+(setq-default show-trailing-whitespace t)
+(set-face-background 'trailing-whitespace <span style="color: #95e454;">"orange1"</span>)
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">nuke whitespaces when writing to a file</span>
+(add-hook 'before-save-hook 'whitespace-cleanup)
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Don't insert tabs when indenting regions (setq-default is used here</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">to only overwrite this in buffers that do not have their own local</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">values for this variable)</span>
+(setq-default indent-tabs-mode nil)
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Apparently Emacs 24 has a bug and tabs can reappear again. This</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">fixes it. Thanks to</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">http://stackoverflow.com/questions/7349487/emacs-different-tab-indent-settings-in-different-modes</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">for the fix.</span>
+(<span style="color: #8ac6f2; font-weight: bold;">defadvice</span> <span style="color: #cae682;">whitespace-cleanup</span> (around whitespace-cleanup-indent-tab
+                                      activate)
+  <span style="color: #95e454;">"Fix whitespace-cleanup indent-tabs-mode bug"</span>
+  (<span style="color: #8ac6f2; font-weight: bold;">let</span> ((whitespace-indent-tabs-mode indent-tabs-mode)
+        (whitespace-tab-width tab-width))
+    ad-do-it))
+
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">always insert at final newline character (if not present yet) when</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">saving a file.</span>
+(setq require-final-newline t)
+
+
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">Customisation of prog-mode. All programming modes inherit from</span>
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">this mode. This mode exists since Emacs 24.</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Wrap lines after 80 columns</span>
+(add-hook 'prog-mode-hook 'auto-fill-mode)
+
+
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">ESS mode (R, S, etc.)</span>
+(add-hook 'ess-mode-hook
+   (<span style="color: #8ac6f2; font-weight: bold;">lambda</span> ()
+     <span style="color: #99968b;">; </span><span style="color: #99968b;">Set pdflatex as the default command for Sweave (default: texi2pdf)</span>
+     (setq ess-swv-pdflatex-commands (quote (<span style="color: #95e454;">"pdflatex"</span> <span style="color: #95e454;">"texi2pdf"</span> <span style="color: #95e454;">"make"</span>)))
+     ))
+
+
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">C-mode:</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">change C indentation style ("{" directly under "for" etc.)</span>
+(setq c-default-style <span style="color: #95e454;">"bsd"</span>
+   c-basic-offset 4)            <span style="color: #99968b;">; </span><span style="color: #99968b;">Indentation of 4 spaces</span>
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Turn on auto fill mode (max 80 columns)</span>
+
+<span style="color: #99968b;">;;; </span><span style="color: #99968b;">LaTeX using AucTeX</span>
+(load <span style="color: #95e454;">"auctex.el"</span> nil t t)
+
+<span style="color: #99968b;">;; </span><span style="color: #99968b;">Emacs' regular latex mode (when AucTeX isn't present)</span>
+(add-hook 'latex-mode-hook 'turn-on-reftex)
+(add-hook 'latex-mode-hook 'turn-on-auto-fill)
+</pre>
 </div>
 </div>
 </div>
 </div>
-
-<div id="postamble">
-<p class="date">Date: 2013-05-17T09:25+0200</p>
+</div>
+</div>
+<div id="postamble" class="status">
 <p class="author">Author: The GenABEL development team</p>
-<p class="creator"><a href="http://orgmode.org">Org</a> version 7.9.2 with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24</p>
-<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
-
+<p class="date">Created: 2014-03-05 wo 14:59</p>
+<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.3.1 (<a href="http://orgmode.org">Org</a> mode 8.0.6)</p>
+<p class="xhtml-validation"><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
 </div>
 </body>
 </html>

Modified: www/codingstyle.org
===================================================================
--- www/codingstyle.org	2014-03-03 21:05:20 UTC (rev 1631)
+++ www/codingstyle.org	2014-03-05 13:59:35 UTC (rev 1632)
@@ -1,4 +1,4 @@
-#+TITLE:     GenABEL project coding style guidelines
+#+TITLE:     The GenABEL project coding style guidelines
 #+AUTHOR:    The GenABEL development team
 #+EMAIL:
 #+DESCRIPTION:
@@ -22,8 +22,8 @@
 
 * General
 ** White space
-   - comma's should be followed by a space
-   - operators (~= + - *~ etc.) should be surrounded by a space (and in R
+   - commas should be followed by a space
+   - operators (~= + - * && >=~ etc.) should be surrounded by a space (and in R
      the ~<-~ operator too)
    - a file should always have a newline at the end (Why?)
    - don't use tabs (as everyone seems to have a different setting for
@@ -35,7 +35,8 @@
      function, an if-statement are not.
 ** Other
    - lines should not be longer than 80 characters
-   - do not use one charcter variables, except when it is a counter in a loop
+   - do not use one-character variable names, except for simple
+     counters in loops
    - issues to be be fixed should be represented as:
      #+begin_example
      //FIXME(name_of_person): explanation what is wrong.
@@ -80,42 +81,107 @@
    - Preferences -> C/C++ -> Code Style -> Formatter
    - Preferences -> StatET -> R code Formatting
 ** Emacs
-   #+begin_src lisp
-   ;;; Trailing white space stuff
-   ;; Show trailing white space in orange
-   (setq-default show-trailing-whitespace t)
-   (set-face-background 'trailing-whitespace "orange1")
-   ;; nuke whitespaces when writing to a file
-   (add-hook 'before-save-hook 'whitespace-cleanup)
-   ;; Don't insert tabs when indenting regions (setq-default is used here
-   ;; to only overwrite this in buffers that do not have their own local
-   ;; values for this variable)
-   (setq-default indent-tabs-mode nil)
+   Add the following to your =~/.emacs= file (tested in Emacs 23 and
+   24).
+*** Emacs 23
+    #+begin_src lisp
+    ;;; Trailing white space stuff
+    ;; Show trailing white space in orange
+    (setq-default show-trailing-whitespace t)
+    (set-face-background 'trailing-whitespace "orange1")
+    ;; nuke whitespaces when writing to a file
+    (add-hook 'before-save-hook 'whitespace-cleanup)
+    ;; Don't insert tabs when indenting regions (setq-default is used here
+    ;; to only overwrite this in buffers that do not have their own local
+    ;; values for this variable)
+    (setq-default indent-tabs-mode nil)
 
-   ;;; ESS mode (R, S, etc.)
-   (add-hook 'ess-mode-hook
-      (lambda ()
-        (auto-fill-mode t)          ; Turn on auto-fill-mode
-        ; Set pdflatex as the default command for Sweave (default: texi2pdf)
-        (setq ess-swv-pdflatex-commands (quote ("pdflatex" "texi2pdf" "make")))
-        ))
+    ;; always insert at final newline character (if not present yet) when
+    ;; saving a file.
+    (setq require-final-newline t)
 
 
-   ;;; C-mode:
-   ;; change C indentation style ("{" directly under "for" etc.)
-   (setq c-default-style "bsd"
-      c-basic-offset 4)            ; Indentation of 4 spaces
-   ;; Turn on auto fill mode (max 80 columns)
-   (add-hook 'c-mode-common-hook 'auto-fill-mode)
+    ;;; ESS mode (R, S, etc.)
+    (add-hook 'ess-mode-hook
+       (lambda ()
+         (auto-fill-mode t)          ; Turn on auto-fill-mode
+         ; Set pdflatex as the default command for Sweave (default: texi2pdf)
+         (setq ess-swv-pdflatex-commands (quote ("pdflatex" "texi2pdf" "make")))
+         ))
 
-   ;;; LaTeX using AucTeX
-   (load "auctex.el" nil t t)
-   (add-hook 'LaTeX-mode-hook
-   (lambda()
-      'turn-on-auto-fill     ; Set max of 80 columns
-    ))
 
+    ;;; C-mode:
+    ;; change C indentation style ("{" directly under "for" etc.)
+    (setq c-default-style "bsd"
+       c-basic-offset 4)            ; Indentation of 4 spaces
+    ;; Turn on auto fill mode (max 80 columns)
+    (add-hook 'c-mode-common-hook 'auto-fill-mode)
+
+    ;;; LaTeX using AucTeX
+    (load "auctex.el" nil t t)
+    (add-hook 'LaTeX-mode-hook
+    (lambda()
+       'turn-on-auto-fill     ; Set max of 80 columns
+     ))
+
+     ;; Emacs' regular latex mode (when AucTeX isn't present)
+     (add-hook 'latex-mode-hook 'turn-on-reftex)
+     (add-hook 'latex-mode-hook 'turn-on-auto-fill)
+    #+end_src
+*** Emacs 24
+    Emacs 24 has a new mode, called =prog-mode=, from which all
+    programming modes inherit.
+    #+begin_src lisp
+    ;;; Trailing white space stuff
+    ;; Show trailing white space in orange
+    (setq-default show-trailing-whitespace t)
+    (set-face-background 'trailing-whitespace "orange1")
+    ;; nuke whitespaces when writing to a file
+    (add-hook 'before-save-hook 'whitespace-cleanup)
+    ;; Don't insert tabs when indenting regions (setq-default is used here
+    ;; to only overwrite this in buffers that do not have their own local
+    ;; values for this variable)
+    (setq-default indent-tabs-mode nil)
+    ;; Apparently Emacs 24 has a bug and tabs can reappear again. This
+    ;; fixes it. Thanks to
+    ;; http://stackoverflow.com/questions/7349487/emacs-different-tab-indent-settings-in-different-modes
+    ;; for the fix.
+    (defadvice whitespace-cleanup (around whitespace-cleanup-indent-tab
+                                          activate)
+      "Fix whitespace-cleanup indent-tabs-mode bug"
+      (let ((whitespace-indent-tabs-mode indent-tabs-mode)
+            (whitespace-tab-width tab-width))
+        ad-do-it))
+
+    ;; always insert at final newline character (if not present yet) when
+    ;; saving a file.
+    (setq require-final-newline t)
+
+
+    ;;; Customisation of prog-mode. All programming modes inherit from
+    ;;; this mode. This mode exists since Emacs 24.
+    ;; Wrap lines after 80 columns
+    (add-hook 'prog-mode-hook 'auto-fill-mode)
+
+
+    ;;; ESS mode (R, S, etc.)
+    (add-hook 'ess-mode-hook
+       (lambda ()
+         ; Set pdflatex as the default command for Sweave (default: texi2pdf)
+         (setq ess-swv-pdflatex-commands (quote ("pdflatex" "texi2pdf" "make")))
+         ))
+
+
+    ;;; C-mode:
+    ;; change C indentation style ("{" directly under "for" etc.)
+    (setq c-default-style "bsd"
+       c-basic-offset 4)            ; Indentation of 4 spaces
+    ;; Turn on auto fill mode (max 80 columns)
+
+    ;;; LaTeX using AucTeX
+    (load "auctex.el" nil t t)
+
     ;; Emacs' regular latex mode (when AucTeX isn't present)
     (add-hook 'latex-mode-hook 'turn-on-reftex)
     (add-hook 'latex-mode-hook 'turn-on-auto-fill)
-   #+end_src
+    #+end_src



More information about the Genabel-commits mailing list