Index: src/config.h
===================================================================
RCS file: /cygdrive/d/cvs_doxygen/doxygen/doxygen/src/config.h,v
retrieving revision 1.4
diff -u -r1.4 config.h
--- src/config.h	20 Jan 2013 13:57:48 -0000	1.4
+++ src/config.h	10 Feb 2013 17:35:07 -0000
@@ -67,6 +67,7 @@
     QCString dependsOn() const { return m_dependency; }
     void addDependency(const char *dep) { m_dependency = dep; }
     void setEncoding(const QCString &e) { m_encoding = e; }
+    void setUserComment(const QCString &u) { m_user_comment = u; }
 
   protected:
     virtual void writeTemplate(FTextStream &t,bool sl,bool upd) = 0;
@@ -75,7 +76,7 @@
     virtual void writeXML(FTextStream&) {}
     virtual void init() {}
 
-    QCString convertToComment(const QCString &s);
+    QCString convertToComment(const QCString &s, const QCString &u);
     void writeBoolValue(FTextStream &t,bool v);
     void writeIntValue(FTextStream &t,int i);
     void writeStringValue(FTextStream &t,QCString &s);
@@ -86,6 +87,7 @@
     QCString m_doc;
     QCString m_dependency;
     QCString m_encoding;
+    QCString m_user_comment;
     OptionType m_kind;
 };
 
@@ -135,7 +137,7 @@
       if (!sl)
       {
         t << endl;
-        t << convertToComment(m_doc);
+        t << convertToComment(m_doc, m_user_comment);
         t << endl;
       }
       t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
@@ -175,7 +177,7 @@
       if (!sl)
       {
         t << endl;
-        t << convertToComment(m_doc);
+        t << convertToComment(m_doc, m_user_comment);
         t << endl;
       }
       t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
@@ -216,7 +218,7 @@
       if (!sl)
       {
         t << endl;
-        t << convertToComment(m_doc);
+        t << convertToComment(m_doc, m_user_comment);
         t << endl;
       }
       t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
@@ -259,7 +261,7 @@
       if (!sl)
       {
         t << endl;
-        t << convertToComment(m_doc);
+        t << convertToComment(m_doc, m_user_comment);
         t << endl;
       }
       t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
@@ -306,7 +308,7 @@
       if (!sl)
       {
         t << endl;
-        t << convertToComment(m_doc);
+        t << convertToComment(m_doc, m_user_comment);
         t << endl;
       }
       t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
@@ -570,6 +572,27 @@
      */
     void create();
 
+    /*! Set user comment
+     */
+    void setUserComment(const QCString &u)
+    {
+      m_user_comment = u;
+    }
+
+    /*! Append user comment
+     */
+    void appendUserComment(const QCString &u)
+    {
+      m_user_comment += u;
+    }
+    /*! Get user comment
+     *  \returns user comment
+     */
+    QCString getUserComment()
+    {
+      return m_user_comment;
+    }
+
   protected:
 
     Config()
@@ -594,6 +617,7 @@
     QList<ConfigOption> *m_obsolete;
     QDict<ConfigOption> *m_dict;
     static Config *m_instance;
+    QCString m_user_comment;
     bool m_initialized;
 };
 
Index: src/config.l
===================================================================
RCS file: /cygdrive/d/cvs_doxygen/doxygen/doxygen/src/config.l,v
retrieving revision 1.6
diff -u -r1.6 config.l
--- src/config.l	20 Jan 2013 13:57:48 -0000	1.6
+++ src/config.l	10 Feb 2013 17:34:48 -0000
@@ -77,11 +77,10 @@
 
 /* -----------------------------------------------------------------
  */
-QCString ConfigOption::convertToComment(const QCString &s)
+QCString ConfigOption::convertToComment(const QCString &s, const QCString &u)
 {
   QCString result;
-  if (s.isEmpty()) return result;
-  else
+  if (!s.isEmpty())
   {
     QCString tmp=s.stripWhiteSpace();
     char *p=tmp.data();
@@ -101,6 +100,11 @@
     }
     result+='\n';
   }
+  if (!u.isEmpty())
+  {
+    result+='\n';
+    result+= u;
+  }
   return result;
 }
 
@@ -589,6 +593,7 @@
 %%
 
 <*>\0x0d
+<Start,GetString,GetStrList,GetBool,SkipInvalid>"##".*"\n"	 { config->appendUserComment(yytext);}
 <Start,GetString,GetStrList,GetBool,SkipInvalid>"#"	 { BEGIN(SkipComment); }
 <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"="	 { QCString cmd=yytext;
                                            cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); 
@@ -601,6 +606,7 @@
 					   }
 					   else // known tag
 					   {
+                                             option->setUserComment(config->getUserComment());
 					     option->setEncoding(encoding);
 					     switch(option->kind())
 					     {
@@ -642,6 +648,7 @@
 						 break;
 					     }
 					   }
+                                           config->setUserComment("");
 					}
 <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+="	{ QCString cmd=yytext;
                                           cmd=cmd.left(cmd.length()-2).stripWhiteSpace(); 
@@ -654,6 +661,7 @@
 					  }
 					  else // known tag
 					  {
+                                            option->setUserComment(config->getUserComment());
 					    switch(option->kind())
 					    {
 					      case ConfigOption::O_Info:
@@ -681,6 +689,7 @@
 						 break;
 					     }
 					   }
+                                           config->setUserComment("");
 					}
 <Start>"@INCLUDE_PATH"[ \t]*"=" 	{ BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; }
   /* include a config file */
@@ -798,6 +807,8 @@
     t << "# This file describes the settings to be used by the documentation system\n";
     t << "# doxygen (www.doxygen.org) for a project.\n";
     t << "#\n";
+    t << "# All text after a double hash (##) is considered a comment and is placed\n";
+    t << "# in front of the TAG it is preceding .\n";
     t << "# All text after a hash (#) is considered a comment and will be ignored.\n";
     t << "# The format is:\n";
     t << "#       TAG = value [value, ...]\n";
@@ -811,6 +822,12 @@
     option->writeTemplate(t,sl,upd);
     option = m_options->next();
   }
+  /* print last lines of user comment that were at the end of the file */
+  if (m_user_comment)
+  {
+    t << "\n";
+    t << m_user_comment;
+  }
 }
 
 void Config::writeXML(FTextStream &t)
Index: doc/config.doc
===================================================================
RCS file: /cygdrive/d/cvs_doxygen/doxygen/doxygen/doc/config.doc,v
retrieving revision 1.8
diff -u -r1.8 config.doc
--- doc/config.doc	10 Feb 2013 09:38:58 -0000	1.8
+++ doc/config.doc	10 Feb 2013 17:43:13 -0000
@@ -24,6 +24,10 @@
 parsed by \c doxygen.  The file may contain tabs and newlines for
 formatting purposes.  The statements in the file are case-sensitive.
 Comments may be placed anywhere within the file (except within quotes).
+Comments beginning with a two hash characters (\#\#) are kept when updating
+the configuration file and are placed in front of the TAG are in front of.
+Comments beginning with a two hash characters (\#\#) at the end of the
+configuration file is also kept and placed at the end of the file.
 Comments begin with the \# character and end at the end of the line.
 
 The file essentially consists of a list of assignment statements.
