SF.net SVN: geany: [2093] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Dec 7 14:13:07 UTC 2007


Revision: 2093
          http://geany.svn.sourceforge.net/geany/?rev=2093&view=rev
Author:   eht16
Date:     2007-12-07 06:13:05 -0800 (Fri, 07 Dec 2007)

Log Message:
-----------
Store more document-related settings session-based in the configuration file(including the file encoding).
Detect in-file specified file encoding by scanning the file using regular expressions.	    

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/callbacks.c
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/encodings.c
    trunk/src/encodings.h
    trunk/src/keyfile.c
    trunk/src/main.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/ChangeLog	2007-12-07 14:13:05 UTC (rev 2093)
@@ -1,3 +1,14 @@
+2007-12-07  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * doc/geany.html, doc/geany.txt, src/callbacks.c, src/document.c,
+   src/document.h, src/encodings.c, src/encodings.h, src/keyfile.c,
+   src/main.c:
+   Store more document-related settings session-based in the
+   configuration file(including the file encoding).
+   Detect in-file specified file encoding by scanning the file using
+   regular expressions.
+
+
 2007-12-06  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/build.c, src/vte.c, src/vte.h:

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/doc/geany.html	2007-12-07 14:13:05 UTC (rev 2093)
@@ -6,7 +6,7 @@
 <meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
 <title>Geany</title>
 <meta name="authors" content="Enrico Tröger  Nick Treleaven  Frank Lanitz" />
-<meta name="date" content="2007-11-20" />
+<meta name="date" content="2007-11-29" />
 <style type="text/css">
 
 /*
@@ -133,7 +133,7 @@
 <br />Nick Treleaven
 <br />Frank Lanitz</td></tr>
 <tr><th class="docinfo-name">Date:</th>
-<td>2007-11-20</td></tr>
+<td>2007-11-29</td></tr>
 <tr><th class="docinfo-name">Version:</th>
 <td>0.13</td></tr>
 </tbody>
@@ -172,139 +172,140 @@
 </li>
 <li><a class="reference" href="#character-sets-and-unicode-byte-order-mark-bom" id="id19" name="id19">Character sets and Unicode Byte-Order-Mark (BOM)</a><ul>
 <li><a class="reference" href="#using-character-sets" id="id20" name="id20">Using character sets</a></li>
-<li><a class="reference" href="#special-encoding-none" id="id21" name="id21">Special encoding "None"</a></li>
-<li><a class="reference" href="#unicode-byte-order-mark-bom" id="id22" name="id22">Unicode Byte-Order-Mark (BOM)</a></li>
+<li><a class="reference" href="#in-file-encoding-specification" id="id21" name="id21">In-file encoding specification</a></li>
+<li><a class="reference" href="#special-encoding-none" id="id22" name="id22">Special encoding "None"</a></li>
+<li><a class="reference" href="#unicode-byte-order-mark-bom" id="id23" name="id23">Unicode Byte-Order-Mark (BOM)</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#editing" id="id23" name="id23">Editing</a><ul>
-<li><a class="reference" href="#folding" id="id24" name="id24">Folding</a></li>
-<li><a class="reference" href="#drag-and-drop-of-text" id="id25" name="id25">Drag and drop of text</a></li>
-<li><a class="reference" href="#auto-indentation" id="id26" name="id26">Auto indentation</a></li>
-<li><a class="reference" href="#bookmarks" id="id27" name="id27">Bookmarks</a></li>
-<li><a class="reference" href="#code-navigation-history" id="id28" name="id28">Code Navigation History</a></li>
-<li><a class="reference" href="#send-text-through-definable-commands" id="id29" name="id29">Send text through definable commands</a></li>
-<li><a class="reference" href="#context-actions" id="id30" name="id30">Context actions</a></li>
-<li><a class="reference" href="#user-definable-snippets" id="id31" name="id31">User-definable snippets</a></li>
-<li><a class="reference" href="#inserting-unicode-characters" id="id32" name="id32">Inserting unicode characters</a></li>
+<li><a class="reference" href="#editing" id="id24" name="id24">Editing</a><ul>
+<li><a class="reference" href="#folding" id="id25" name="id25">Folding</a></li>
+<li><a class="reference" href="#drag-and-drop-of-text" id="id26" name="id26">Drag and drop of text</a></li>
+<li><a class="reference" href="#auto-indentation" id="id27" name="id27">Auto indentation</a></li>
+<li><a class="reference" href="#bookmarks" id="id28" name="id28">Bookmarks</a></li>
+<li><a class="reference" href="#code-navigation-history" id="id29" name="id29">Code Navigation History</a></li>
+<li><a class="reference" href="#send-text-through-definable-commands" id="id30" name="id30">Send text through definable commands</a></li>
+<li><a class="reference" href="#context-actions" id="id31" name="id31">Context actions</a></li>
+<li><a class="reference" href="#user-definable-snippets" id="id32" name="id32">User-definable snippets</a></li>
+<li><a class="reference" href="#inserting-unicode-characters" id="id33" name="id33">Inserting unicode characters</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#search-replace-and-go-to" id="id33" name="id33">Search, replace and go to</a><ul>
-<li><a class="reference" href="#find" id="id34" name="id34">Find</a><ul>
-<li><a class="reference" href="#matching-options" id="id35" name="id35">Matching options</a></li>
-<li><a class="reference" href="#find-all" id="id36" name="id36">Find all</a></li>
+<li><a class="reference" href="#search-replace-and-go-to" id="id34" name="id34">Search, replace and go to</a><ul>
+<li><a class="reference" href="#find" id="id35" name="id35">Find</a><ul>
+<li><a class="reference" href="#matching-options" id="id36" name="id36">Matching options</a></li>
+<li><a class="reference" href="#find-all" id="id37" name="id37">Find all</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#find-usage" id="id37" name="id37">Find usage</a></li>
-<li><a class="reference" href="#find-in-files" id="id38" name="id38">Find in files</a><ul>
-<li><a class="reference" href="#filtering-out-version-control-files" id="id39" name="id39">Filtering out version control files</a></li>
+<li><a class="reference" href="#find-usage" id="id38" name="id38">Find usage</a></li>
+<li><a class="reference" href="#find-in-files" id="id39" name="id39">Find in files</a><ul>
+<li><a class="reference" href="#filtering-out-version-control-files" id="id40" name="id40">Filtering out version control files</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#replace" id="id40" name="id40">Replace</a><ul>
-<li><a class="reference" href="#replace-all" id="id41" name="id41">Replace all</a></li>
+<li><a class="reference" href="#replace" id="id41" name="id41">Replace</a><ul>
+<li><a class="reference" href="#replace-all" id="id42" name="id42">Replace all</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#go-to-tag-definition" id="id42" name="id42">Go to tag definition</a></li>
-<li><a class="reference" href="#go-to-tag-declaration" id="id43" name="id43">Go to tag declaration</a></li>
-<li><a class="reference" href="#go-to-line" id="id44" name="id44">Go to line</a></li>
-<li><a class="reference" href="#regular-expressions" id="id45" name="id45">Regular expressions</a><ul>
-<li><a class="reference" href="#partial-posix-compatibility" id="id46" name="id46">Partial POSIX compatibility</a></li>
+<li><a class="reference" href="#go-to-tag-definition" id="id43" name="id43">Go to tag definition</a></li>
+<li><a class="reference" href="#go-to-tag-declaration" id="id44" name="id44">Go to tag declaration</a></li>
+<li><a class="reference" href="#go-to-line" id="id45" name="id45">Go to line</a></li>
+<li><a class="reference" href="#regular-expressions" id="id46" name="id46">Regular expressions</a><ul>
+<li><a class="reference" href="#partial-posix-compatibility" id="id47" name="id47">Partial POSIX compatibility</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#tags" id="id47" name="id47">Tags</a><ul>
-<li><a class="reference" href="#workspace-tags" id="id48" name="id48">Workspace tags</a></li>
-<li><a class="reference" href="#global-tags" id="id49" name="id49">Global tags</a><ul>
-<li><a class="reference" href="#default-global-tags-files" id="id50" name="id50">Default global tags files</a></li>
-<li><a class="reference" href="#generating-a-global-tags-file" id="id51" name="id51">Generating a global tags file</a></li>
+<li><a class="reference" href="#tags" id="id48" name="id48">Tags</a><ul>
+<li><a class="reference" href="#workspace-tags" id="id49" name="id49">Workspace tags</a></li>
+<li><a class="reference" href="#global-tags" id="id50" name="id50">Global tags</a><ul>
+<li><a class="reference" href="#default-global-tags-files" id="id51" name="id51">Default global tags files</a></li>
+<li><a class="reference" href="#generating-a-global-tags-file" id="id52" name="id52">Generating a global tags file</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#preferences" id="id52" name="id52">Preferences</a><ul>
-<li><a class="reference" href="#general-tab-in-preferences-dialog" id="id53" name="id53">General tab in preferences dialog</a></li>
-<li><a class="reference" href="#interface-tab-in-preferences-dialog" id="id54" name="id54">Interface tab in preferences dialog</a></li>
-<li><a class="reference" href="#toolbar-tab-in-preferences-dialog" id="id55" name="id55">Toolbar tab in preferences dialog</a></li>
-<li><a class="reference" href="#display-tab-in-preferences-dialog" id="id56" name="id56">Display tab in preferences dialog</a></li>
-<li><a class="reference" href="#editor-tab-in-preferences-dialog" id="id57" name="id57">Editor tab in preferences dialog</a></li>
-<li><a class="reference" href="#files-tab-in-preferences-dialog" id="id58" name="id58">Files tab in preferences dialog</a></li>
-<li><a class="reference" href="#tools-tab-in-preferences-dialog" id="id59" name="id59">Tools tab in preferences dialog</a></li>
-<li><a class="reference" href="#template-tab-in-preferences-dialog" id="id60" name="id60">Template tab in preferences dialog</a></li>
-<li><a class="reference" href="#keybinding-tab-in-preferences-dialog" id="id61" name="id61">Keybinding tab in preferences dialog</a></li>
-<li><a class="reference" href="#vte-tab-in-preferences-dialog" id="id62" name="id62">VTE tab in preferences dialog</a></li>
+<li><a class="reference" href="#preferences" id="id53" name="id53">Preferences</a><ul>
+<li><a class="reference" href="#general-tab-in-preferences-dialog" id="id54" name="id54">General tab in preferences dialog</a></li>
+<li><a class="reference" href="#interface-tab-in-preferences-dialog" id="id55" name="id55">Interface tab in preferences dialog</a></li>
+<li><a class="reference" href="#toolbar-tab-in-preferences-dialog" id="id56" name="id56">Toolbar tab in preferences dialog</a></li>
+<li><a class="reference" href="#display-tab-in-preferences-dialog" id="id57" name="id57">Display tab in preferences dialog</a></li>
+<li><a class="reference" href="#editor-tab-in-preferences-dialog" id="id58" name="id58">Editor tab in preferences dialog</a></li>
+<li><a class="reference" href="#files-tab-in-preferences-dialog" id="id59" name="id59">Files tab in preferences dialog</a></li>
+<li><a class="reference" href="#tools-tab-in-preferences-dialog" id="id60" name="id60">Tools tab in preferences dialog</a></li>
+<li><a class="reference" href="#template-tab-in-preferences-dialog" id="id61" name="id61">Template tab in preferences dialog</a></li>
+<li><a class="reference" href="#keybinding-tab-in-preferences-dialog" id="id62" name="id62">Keybinding tab in preferences dialog</a></li>
+<li><a class="reference" href="#vte-tab-in-preferences-dialog" id="id63" name="id63">VTE tab in preferences dialog</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#project-management" id="id63" name="id63">Project Management</a><ul>
-<li><a class="reference" href="#new-project" id="id64" name="id64">New Project</a></li>
-<li><a class="reference" href="#project-properties" id="id65" name="id65">Project Properties</a><ul>
-<li><a class="reference" href="#run-command" id="id66" name="id66">Run command</a></li>
+<li><a class="reference" href="#project-management" id="id64" name="id64">Project Management</a><ul>
+<li><a class="reference" href="#new-project" id="id65" name="id65">New Project</a></li>
+<li><a class="reference" href="#project-properties" id="id66" name="id66">Project Properties</a><ul>
+<li><a class="reference" href="#run-command" id="id67" name="id67">Run command</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#close-project" id="id67" name="id67">Close Project</a></li>
-<li><a class="reference" href="#open-project" id="id68" name="id68">Open Project</a></li>
+<li><a class="reference" href="#close-project" id="id68" name="id68">Close Project</a></li>
+<li><a class="reference" href="#open-project" id="id69" name="id69">Open Project</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#build-system" id="id69" name="id69">Build system</a><ul>
-<li><a class="reference" href="#compile" id="id70" name="id70">Compile</a></li>
-<li><a class="reference" href="#build" id="id71" name="id71">Build</a></li>
-<li><a class="reference" href="#make-all" id="id72" name="id72">Make all</a></li>
-<li><a class="reference" href="#make-custom-target" id="id73" name="id73">Make custom target</a></li>
-<li><a class="reference" href="#make-object" id="id74" name="id74">Make object</a></li>
-<li><a class="reference" href="#execute" id="id75" name="id75">Execute</a></li>
-<li><a class="reference" href="#stopping-running-processes" id="id76" name="id76">Stopping running processes</a><ul>
-<li><a class="reference" href="#terminal-emulators" id="id77" name="id77">Terminal emulators</a></li>
+<li><a class="reference" href="#build-system" id="id70" name="id70">Build system</a><ul>
+<li><a class="reference" href="#compile" id="id71" name="id71">Compile</a></li>
+<li><a class="reference" href="#build" id="id72" name="id72">Build</a></li>
+<li><a class="reference" href="#make-all" id="id73" name="id73">Make all</a></li>
+<li><a class="reference" href="#make-custom-target" id="id74" name="id74">Make custom target</a></li>
+<li><a class="reference" href="#make-object" id="id75" name="id75">Make object</a></li>
+<li><a class="reference" href="#execute" id="id76" name="id76">Execute</a></li>
+<li><a class="reference" href="#stopping-running-processes" id="id77" name="id77">Stopping running processes</a><ul>
+<li><a class="reference" href="#terminal-emulators" id="id78" name="id78">Terminal emulators</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#set-includes-and-arguments" id="id78" name="id78">Set Includes and Arguments</a><ul>
-<li><a class="reference" href="#one-step-compilation" id="id79" name="id79">One step compilation</a></li>
+<li><a class="reference" href="#set-includes-and-arguments" id="id79" name="id79">Set Includes and Arguments</a><ul>
+<li><a class="reference" href="#one-step-compilation" id="id80" name="id80">One step compilation</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#indicators" id="id80" name="id80">Indicators</a></li>
+<li><a class="reference" href="#indicators" id="id81" name="id81">Indicators</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#printing-support" id="id81" name="id81">Printing support</a></li>
-<li><a class="reference" href="#plugins" id="id82" name="id82">Plugins</a></li>
-<li><a class="reference" href="#keybindings" id="id83" name="id83">Keybindings</a><ul>
-<li><a class="reference" href="#switching-documents" id="id84" name="id84">Switching documents</a></li>
-<li><a class="reference" href="#configurable-keybindings" id="id85" name="id85">Configurable keybindings</a></li>
+<li><a class="reference" href="#printing-support" id="id82" name="id82">Printing support</a></li>
+<li><a class="reference" href="#plugins" id="id83" name="id83">Plugins</a></li>
+<li><a class="reference" href="#keybindings" id="id84" name="id84">Keybindings</a><ul>
+<li><a class="reference" href="#switching-documents" id="id85" name="id85">Switching documents</a></li>
+<li><a class="reference" href="#configurable-keybindings" id="id86" name="id86">Configurable keybindings</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#configuration-files" id="id86" name="id86">Configuration files</a><ul>
-<li><a class="reference" href="#global-configuration-file" id="id87" name="id87">Global configuration file</a></li>
-<li><a class="reference" href="#filetype-definition-files" id="id88" name="id88">Filetype definition files</a><ul>
-<li><a class="reference" href="#format" id="id89" name="id89">Format</a><ul>
-<li><a class="reference" href="#styling-section" id="id90" name="id90">[styling] Section</a></li>
-<li><a class="reference" href="#keywords-section" id="id91" name="id91">[keywords] Section</a></li>
-<li><a class="reference" href="#settings-section" id="id92" name="id92">[settings] Section</a></li>
-<li><a class="reference" href="#build-settings-section" id="id93" name="id93">[build_settings] Section</a></li>
+<li><a class="reference" href="#configuration-files" id="id87" name="id87">Configuration files</a><ul>
+<li><a class="reference" href="#global-configuration-file" id="id88" name="id88">Global configuration file</a></li>
+<li><a class="reference" href="#filetype-definition-files" id="id89" name="id89">Filetype definition files</a><ul>
+<li><a class="reference" href="#format" id="id90" name="id90">Format</a><ul>
+<li><a class="reference" href="#styling-section" id="id91" name="id91">[styling] Section</a></li>
+<li><a class="reference" href="#keywords-section" id="id92" name="id92">[keywords] Section</a></li>
+<li><a class="reference" href="#settings-section" id="id93" name="id93">[settings] Section</a></li>
+<li><a class="reference" href="#build-settings-section" id="id94" name="id94">[build_settings] Section</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#special-file-filetypes-common" id="id94" name="id94">Special file filetypes.common</a></li>
+<li><a class="reference" href="#special-file-filetypes-common" id="id95" name="id95">Special file filetypes.common</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#filetype-extensions" id="id95" name="id95">Filetype extensions</a></li>
-<li><a class="reference" href="#templates" id="id96" name="id96">Templates</a><ul>
-<li><a class="reference" href="#template-metadata" id="id97" name="id97">Template metadata</a></li>
-<li><a class="reference" href="#filetype-templates" id="id98" name="id98">Filetype templates</a></li>
-<li><a class="reference" href="#customizing-templates" id="id99" name="id99">Customizing templates</a><ul>
-<li><a class="reference" href="#template-wildcards" id="id100" name="id100">Template wildcards</a></li>
+<li><a class="reference" href="#filetype-extensions" id="id96" name="id96">Filetype extensions</a></li>
+<li><a class="reference" href="#templates" id="id97" name="id97">Templates</a><ul>
+<li><a class="reference" href="#template-metadata" id="id98" name="id98">Template metadata</a></li>
+<li><a class="reference" href="#filetype-templates" id="id99" name="id99">Filetype templates</a></li>
+<li><a class="reference" href="#customizing-templates" id="id100" name="id100">Customizing templates</a><ul>
+<li><a class="reference" href="#template-wildcards" id="id101" name="id101">Template wildcards</a></li>
 </ul>
 </li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#contributing-to-this-document" id="id101" name="id101">Contributing to this document</a></li>
-<li><a class="reference" href="#scintilla-keyboard-commands" id="id102" name="id102">Scintilla keyboard commands</a><ul>
-<li><a class="reference" href="#keyboard-commands" id="id103" name="id103">Keyboard commands</a></li>
+<li><a class="reference" href="#contributing-to-this-document" id="id102" name="id102">Contributing to this document</a></li>
+<li><a class="reference" href="#scintilla-keyboard-commands" id="id103" name="id103">Scintilla keyboard commands</a><ul>
+<li><a class="reference" href="#keyboard-commands" id="id104" name="id104">Keyboard commands</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#hidden-preferences" id="id104" name="id104">Hidden preferences</a></li>
-<li><a class="reference" href="#compile-time-options" id="id105" name="id105">Compile-time options</a></li>
-<li><a class="reference" href="#gnu-general-public-license" id="id106" name="id106">GNU General Public License</a></li>
-<li><a class="reference" href="#license-for-scintilla-and-scite" id="id107" name="id107">License for Scintilla and SciTE</a></li>
+<li><a class="reference" href="#hidden-preferences" id="id105" name="id105">Hidden preferences</a></li>
+<li><a class="reference" href="#compile-time-options" id="id106" name="id106">Compile-time options</a></li>
+<li><a class="reference" href="#gnu-general-public-license" id="id107" name="id107">GNU General Public License</a></li>
+<li><a class="reference" href="#license-for-scintilla-and-scite" id="id108" name="id108">License for Scintilla and SciTE</a></li>
 </ul>
 </div>
 <div class="section">
@@ -643,8 +644,8 @@
 <p>Only text files are supported, i.e. opening files which contain
 NUL-bytes may fail. Geany will try to open the file anyway but it is
 likely that the file will be truncated because it can only opened up
-to the first occurrence of the first NUL-byte. All characters after
-this position are lost and are not written when you save the file.</p>
+to the first occurrence of a NUL-byte. All characters after this
+position are lost and are not written when you save the file.</p>
 <p>Geany tries to detect the encoding of a file while opening it. It
 might be that the encoding of a file cannot be detected correctly so
 you have to set manually the encoding of the file in order to display
@@ -672,10 +673,51 @@
 the current file unless you save it. It is useful when you want to
 change the encoding of the file.</p>
 </li>
+<li><p class="first">Specifying the encoding in the file itself
+As mentioned above, auto detecting the encoding of a file may fail on
+some encodings. If you know that Geany doesn't open a certain file,
+you can add a special line to the beginning of the file to force an
+encoding when opening the file (for details see below).</p>
+</li>
 </ul>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id21" id="special-encoding-none" name="special-encoding-none">Special encoding "None"</a></h3>
+<h3><a class="toc-backref" href="#id21" id="in-file-encoding-specification" name="in-file-encoding-specification">In-file encoding specification</a></h3>
+<p>Geany detects meta tags of HTML files which contain charset information
+like:</p>
+<pre class="literal-block">
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15" />
+</pre>
+<p>and the found charset is used when opening the file. This is useful if the
+encoding of the file cannot be detected properly.
+For non-HTML files you can also define a line like:</p>
+<pre class="literal-block">
+/* geany_encoding=ISO-8859-15 */
+</pre>
+<p>or:</p>
+<pre class="literal-block">
+# geany_encoding=ISO-8859-15 #
+</pre>
+<p>to force an encoding to be used. The used #, /* and */ are only examples
+for filetype-specific comment characters. It doesn't matter which
+characters are around the string " geany_encoding=ISO-8859-15 " as long
+as there is at least one whitespace character before and after this
+string. Whitespace characters are in this case a space or tab character.
+"geany_encoding" must be in lower-case, the charset string is
+case-independent. There must <strong>not</strong> be any whitespace between
+"geany_encoding", the "=" sign and the charset.
+An example to use this could be you have a file with ISO-8859-15
+encoding but Geany constantly detects the file encoding as ISO-8859-1.
+Then you simply add such a line to the file and Geany will open it
+correctly the next time.</p>
+<div class="note">
+<p class="first admonition-title">Note</p>
+<p class="last">These specifications must be in the first 512 bytes of the file.
+Anything after the first 512 bytes will not be recognised.</p>
+</div>
+</div>
+<div class="section">
+<h3><a class="toc-backref" href="#id22" id="special-encoding-none" name="special-encoding-none">Special encoding "None"</a></h3>
 <p>There is a special encoding "None" which is actually no real
 encoding. It is useful when you know that Geany cannot auto detect
 the encoding of a file and it is not displayed correctly. Especially
@@ -685,7 +727,7 @@
 without any character conversion.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id22" id="unicode-byte-order-mark-bom" name="unicode-byte-order-mark-bom">Unicode Byte-Order-Mark (BOM)</a></h3>
+<h3><a class="toc-backref" href="#id23" id="unicode-byte-order-mark-bom" name="unicode-byte-order-mark-bom">Unicode Byte-Order-Mark (BOM)</a></h3>
 <p>Furthermore, Geany detects an Unicode Byte Order Mark (see
 <a class="reference" href="http://en.wikipedia.org/wiki/Byte_Order_Mark">http://en.wikipedia.org/wiki/Byte_Order_Mark</a> for details). Of course,
 this feature is only available if the opened file is in an unicode
@@ -706,9 +748,9 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id23" id="editing" name="editing">Editing</a></h2>
+<h2><a class="toc-backref" href="#id24" id="editing" name="editing">Editing</a></h2>
 <div class="section">
-<h3><a class="toc-backref" href="#id24" id="folding" name="folding">Folding</a></h3>
+<h3><a class="toc-backref" href="#id25" id="folding" name="folding">Folding</a></h3>
 <p>Geany provides basic code folding support. Folding means the ability to
 show and hide parts of the text in the current file. You can hide
 unimportant code sections and concentrate on the parts you are working on
@@ -722,17 +764,17 @@
 folding support completely in the preferences dialog.</p>
 <p>The folding behaviour can be changed with the "Fold/Unfold all children of
 a fold point" option in the preference dialog. If activated, Geany will
-unfold all nested(child) fold points below the current one if they are
-already folded (when clicking on a [+] symbol).
-When clicking on a [-] symbol, Geany will fold all nested(child) fold
-points below the current one if they are unfolded.
-The usage of this option can be instantly inverted by pressing the Shift
+unfold all nested fold points below the current one if they are already
+folded (when clicking on a [+] symbol).
+When clicking on a [-] symbol, Geany will fold all nested fold points
+below the current one if they are unfolded.</p>
+<p>The usage of this option can be instantly inverted by pressing the Shift
 key while clicking on a fold symbol. That means, if the "Fold/Unfold all
 children of a fold point" option is enabled, pressing Shift will disable
 it for this click and vice versa.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id25" id="drag-and-drop-of-text" name="drag-and-drop-of-text">Drag and drop of text</a></h3>
+<h3><a class="toc-backref" href="#id26" id="drag-and-drop-of-text" name="drag-and-drop-of-text">Drag and drop of text</a></h3>
 <p>If you drag selected text in the editor widget of Geany the text is
 moved to the position where the mouse pointer is when releasing the
 mouse button. Holding Control when releasing the mouse button will
@@ -740,7 +782,7 @@
 before the selected text was copied to the new position.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id26" id="auto-indentation" name="auto-indentation">Auto indentation</a></h3>
+<h3><a class="toc-backref" href="#id27" id="auto-indentation" name="auto-indentation">Auto indentation</a></h3>
 <p>Geany knows four types of auto indentation:</p>
 <dl class="docutils">
 <dt>None</dt>
@@ -757,7 +799,7 @@
 </dl>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id27" id="bookmarks" name="bookmarks">Bookmarks</a></h3>
+<h3><a class="toc-backref" href="#id28" id="bookmarks" name="bookmarks">Bookmarks</a></h3>
 <p>Geany provides a handy bookmarking feature that lets you mark one
 or more lines in a document, and return the cursor to them using a
 key combination.</p>
@@ -775,7 +817,7 @@
 navigate around multiple files.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id28" id="code-navigation-history" name="code-navigation-history">Code Navigation History</a></h3>
+<h3><a class="toc-backref" href="#id29" id="code-navigation-history" name="code-navigation-history">Code Navigation History</a></h3>
 <p>To ease navigation in source files and especially between
 different files, Geany lets you jump between different navigation
 points. Currently, this works when using the <a class="reference" href="#go-to-tag-declaration">Go to tag declaration</a>,
@@ -789,7 +831,7 @@
 and between different files.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id29" id="send-text-through-definable-commands" name="send-text-through-definable-commands">Send text through definable commands</a></h3>
+<h3><a class="toc-backref" href="#id30" id="send-text-through-definable-commands" name="send-text-through-definable-commands">Send text through definable commands</a></h3>
 <p>You can define several custom commands in Geany and send the current
 selection to one of these commands. The output of the command will be
 used to replace the current selection. So, it is possible to use text
@@ -806,7 +848,7 @@
 entry and press Ok. It will be deleted automatically.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id30" id="context-actions" name="context-actions">Context actions</a></h3>
+<h3><a class="toc-backref" href="#id31" id="context-actions" name="context-actions">Context actions</a></h3>
 <p>You can execute a specified command on the current word near the
 cursor position or an available selection and this word is passed
 as an argument to this command. It can be used for example to open
@@ -832,7 +874,7 @@
 called firefox) and it will open the address: <a class="reference" href="http://www.php.net/echo">http://www.php.net/echo</a>.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id31" id="user-definable-snippets" name="user-definable-snippets">User-definable snippets</a></h3>
+<h3><a class="toc-backref" href="#id32" id="user-definable-snippets" name="user-definable-snippets">User-definable snippets</a></h3>
 <p>Snippets are small strings or code constructs which can be replaced or
 completed to a more complex string. So you can save a lot of time by
 not typing often used strings and letting Geany do the work for you.
@@ -919,7 +961,7 @@
 needs.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id32" id="inserting-unicode-characters" name="inserting-unicode-characters">Inserting unicode characters</a></h3>
+<h3><a class="toc-backref" href="#id33" id="inserting-unicode-characters" name="inserting-unicode-characters">Inserting unicode characters</a></h3>
 <p>With GTK 2.10 and above, you can hit Ctrl-Shift-u, then still holding
 Ctrl-Shift, type some hex digits representing the code point for the
 character you want, then let go of Ctrl-Shift and hit a key such as
@@ -935,7 +977,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id33" id="search-replace-and-go-to" name="search-replace-and-go-to">Search, replace and go to</a></h2>
+<h2><a class="toc-backref" href="#id34" id="search-replace-and-go-to" name="search-replace-and-go-to">Search, replace and go to</a></h2>
 <p>This section describes search-related commands from the Search menu
 and the editor window's popup menu:</p>
 <ul class="simple">
@@ -950,11 +992,11 @@
 <p>* These items are available from the editor window's popup menu, or by
 using a keyboard shortcut (see the section called <a class="reference" href="#keybindings">Keybindings</a>).</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id34" id="find" name="find">Find</a></h3>
+<h3><a class="toc-backref" href="#id35" id="find" name="find">Find</a></h3>
 <p>The Find dialog is used for finding text in one or more open documents.</p>
 <img alt="./images/find_dialog.png" src="./images/find_dialog.png" />
 <div class="section">
-<h4><a class="toc-backref" href="#id35" id="matching-options" name="matching-options">Matching options</a></h4>
+<h4><a class="toc-backref" href="#id36" id="matching-options" name="matching-options">Matching options</a></h4>
 <p>The syntax for the Use regular expressions option is shown in
 <a class="reference" href="#regular-expressions">Regular expressions</a>.</p>
 <p>The Use escape sequences option will transform any escaped characters
@@ -963,7 +1005,7 @@
 (Unicode chararacters).</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id36" id="find-all" name="find-all">Find all</a></h4>
+<h4><a class="toc-backref" href="#id37" id="find-all" name="find-all">Find all</a></h4>
 <p>To find all matches, click on the Find All expander. This will reveal
 several options:</p>
 <ul class="simple">
@@ -981,7 +1023,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id37" id="find-usage" name="find-usage">Find usage</a></h3>
+<h3><a class="toc-backref" href="#id38" id="find-usage" name="find-usage">Find usage</a></h3>
 <p>Find usage searches all open files. It is similar to the Find All In
 Session Find dialog command.</p>
 <p>If there is a selection, then it is used as the search text; otherwise
@@ -991,7 +1033,7 @@
 shown in the Messages tab of the Message Window.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id38" id="find-in-files" name="find-in-files">Find in files</a></h3>
+<h3><a class="toc-backref" href="#id39" id="find-in-files" name="find-in-files">Find in files</a></h3>
 <p>Find in files is a more powerful version of Find usage that searches
 all files in a certain directory using the Grep tool. The Grep tool
 must be correctly set in Preferences to the path of the system's Grep
@@ -1000,7 +1042,7 @@
 <p>The Extra options field is used to pass any additional arguments to
 the grep tool.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id39" id="filtering-out-version-control-files" name="filtering-out-version-control-files">Filtering out version control files</a></h4>
+<h4><a class="toc-backref" href="#id40" id="filtering-out-version-control-files" name="filtering-out-version-control-files">Filtering out version control files</a></h4>
 <p>When using the <em>Recurse in subfolders</em> option with a directory that's
 under version control, you can set the <em>Extra options</em> field to use
 grep's <tt class="docutils literal"><span class="pre">--exclude</span></tt> flag to filter out filenames.</p>
@@ -1016,7 +1058,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id40" id="replace" name="replace">Replace</a></h3>
+<h3><a class="toc-backref" href="#id41" id="replace" name="replace">Replace</a></h3>
 <p>The Replace dialog is used for replacing text in one or more open
 documents.</p>
 <img alt="./images/replace_dialog.png" src="./images/replace_dialog.png" />
@@ -1026,7 +1068,7 @@
 and to the replacement text; for the latter back references can be
 used -- see the entry for '\n' in <a class="reference" href="#regular-expressions">Regular expressions</a>.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id41" id="replace-all" name="replace-all">Replace all</a></h4>
+<h4><a class="toc-backref" href="#id42" id="replace-all" name="replace-all">Replace all</a></h4>
 <p>To replace several matches, click on the <em>Replace All</em> expander. This
 will reveal several options:</p>
 <ul class="simple">
@@ -1041,7 +1083,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id42" id="go-to-tag-definition" name="go-to-tag-definition">Go to tag definition</a></h3>
+<h3><a class="toc-backref" href="#id43" id="go-to-tag-definition" name="go-to-tag-definition">Go to tag definition</a></h3>
 <p>If the current word is the name of a tag definition (like a function
 body) and the file containing the tag definition is open, this command
 will switch to that file and go to the corresponding line number. The
@@ -1050,17 +1092,17 @@
 menu is used.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id43" id="go-to-tag-declaration" name="go-to-tag-declaration">Go to tag declaration</a></h3>
+<h3><a class="toc-backref" href="#id44" id="go-to-tag-declaration" name="go-to-tag-declaration">Go to tag declaration</a></h3>
 <p>Like Go to tag definition, but for a forward declaration such as a
 function prototype or <tt class="docutils literal"><span class="pre">extern</span></tt> declaration instead of a function
 body.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id44" id="go-to-line" name="go-to-line">Go to line</a></h3>
+<h3><a class="toc-backref" href="#id45" id="go-to-line" name="go-to-line">Go to line</a></h3>
 <p>Go to a particular line number in the current file.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id45" id="regular-expressions" name="regular-expressions">Regular expressions</a></h3>
+<h3><a class="toc-backref" href="#id46" id="regular-expressions" name="regular-expressions">Regular expressions</a></h3>
 <p>You can use regular expressions in the Find and Replace dialogs
 by selecting the Use regular expressions check box. The syntax is
 POSIX-like, as described below in <a class="reference" href="#regular-expressions">Regular expressions</a>.</p>
@@ -1129,14 +1171,14 @@
 </tbody>
 </table>
 <div class="section">
-<h4><a class="toc-backref" href="#id46" id="partial-posix-compatibility" name="partial-posix-compatibility">Partial POSIX compatibility</a></h4>
+<h4><a class="toc-backref" href="#id47" id="partial-posix-compatibility" name="partial-posix-compatibility">Partial POSIX compatibility</a></h4>
 <p>Note that the POSIX '?' regular expression character for optional
 matching is not supported by the Find and Replace dialogs.</p>
 </div>
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id47" id="tags" name="tags">Tags</a></h2>
+<h2><a class="toc-backref" href="#id48" id="tags" name="tags">Tags</a></h2>
 <p>Geany has built-in functionality for generating tag information (aka
 "workspace tags") for supported filetypes when you open a file.  You
 can also have Geany automatically load external tag files (aka "global
@@ -1146,7 +1188,7 @@
 (but is incompatible with ctags). You use Geany to generate global
 tags files, as described below.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id48" id="workspace-tags" name="workspace-tags">Workspace tags</a></h3>
+<h3><a class="toc-backref" href="#id49" id="workspace-tags" name="workspace-tags">Workspace tags</a></h3>
 <p>Tags for each document are parsed whenever a file is loaded or
 saved. These are shown in the Symbol list in the Sidebar. These tags
 are also used for autocompletion of symbols and calltips for all documents
@@ -1155,7 +1197,7 @@
 <a class="reference" href="#go-to-tag-definition">Go to tag definition</a>.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id49" id="global-tags" name="global-tags">Global tags</a></h3>
+<h3><a class="toc-backref" href="#id50" id="global-tags" name="global-tags">Global tags</a></h3>
 <p>Global tags are used to provide autocompletion of symbols and calltips
 without having to open the corresponding source files. This is intended
 for library APIs, as the tags file only has to be updated when you upgrade
@@ -1175,7 +1217,7 @@
 with the tags. See the section called <a class="reference" href="#filetype-extensions">Filetype extensions</a> for
 more information.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id50" id="default-global-tags-files" name="default-global-tags-files">Default global tags files</a></h4>
+<h4><a class="toc-backref" href="#id51" id="default-global-tags-files" name="default-global-tags-files">Default global tags files</a></h4>
 <p>For some languages, a list of global tags is loaded when the
 corresponding filetype is first used. Currently these are for:</p>
 <ul class="simple">
@@ -1187,7 +1229,7 @@
 </ul>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id51" id="generating-a-global-tags-file" name="generating-a-global-tags-file">Generating a global tags file</a></h4>
+<h4><a class="toc-backref" href="#id52" id="generating-a-global-tags-file" name="generating-a-global-tags-file">Generating a global tags file</a></h4>
 <p><em>Filetypes support:</em></p>
 <p>Currently this is not yet supported for Pascal, PHP and LaTeX
 filetypes.</p>
@@ -1236,7 +1278,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id52" id="preferences" name="preferences">Preferences</a></h2>
+<h2><a class="toc-backref" href="#id53" id="preferences" name="preferences">Preferences</a></h2>
 <p>You may adjust Geany's settings using the Edit --> Preferences
 dialog. Any changes you make there can be applied by hitting either
 the Apply or the Ok button. These settings will persist between Geany
@@ -1254,12 +1296,12 @@
 (if present) comes after the screenshot of that tab.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id53" id="general-tab-in-preferences-dialog" name="general-tab-in-preferences-dialog">General tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id54" id="general-tab-in-preferences-dialog" name="general-tab-in-preferences-dialog">General tab in preferences dialog</a></h3>
 <p>General tab in preferences dialog</p>
 <img alt="./images/pref_dialog_gen.png" src="./images/pref_dialog_gen.png" />
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id54" id="interface-tab-in-preferences-dialog" name="interface-tab-in-preferences-dialog">Interface tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id55" id="interface-tab-in-preferences-dialog" name="interface-tab-in-preferences-dialog">Interface tab in preferences dialog</a></h3>
 <p>Interface tab in preferences dialog</p>
 <img alt="./images/pref_dialog_interface.png" src="./images/pref_dialog_interface.png" />
 <p>The documents list and the editor tabs are two different ways
@@ -1269,17 +1311,17 @@
 whether or not editor tabs are visible).</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id55" id="toolbar-tab-in-preferences-dialog" name="toolbar-tab-in-preferences-dialog">Toolbar tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id56" id="toolbar-tab-in-preferences-dialog" name="toolbar-tab-in-preferences-dialog">Toolbar tab in preferences dialog</a></h3>
 <p>Toolbar tab in preferences dialog</p>
 <img alt="./images/pref_dialog_toolbar.png" src="./images/pref_dialog_toolbar.png" />
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id56" id="display-tab-in-preferences-dialog" name="display-tab-in-preferences-dialog">Display tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id57" id="display-tab-in-preferences-dialog" name="display-tab-in-preferences-dialog">Display tab in preferences dialog</a></h3>
 <p>This is for visual elements displayed in the editor window.</p>
 <!-- Display tab in preferences dialog (TODO) -->
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id57" id="editor-tab-in-preferences-dialog" name="editor-tab-in-preferences-dialog">Editor tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id58" id="editor-tab-in-preferences-dialog" name="editor-tab-in-preferences-dialog">Editor tab in preferences dialog</a></h3>
 <p>Editor tab in preferences dialog</p>
 <img alt="./images/pref_dialog_edit.png" src="./images/pref_dialog_edit.png" />
 <p>Line wrapping refers to the display of the text in the
@@ -1287,22 +1329,22 @@
 insert newlines into your document while you type.)</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id58" id="files-tab-in-preferences-dialog" name="files-tab-in-preferences-dialog">Files tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id59" id="files-tab-in-preferences-dialog" name="files-tab-in-preferences-dialog">Files tab in preferences dialog</a></h3>
 <p>Files tab in preferences dialog</p>
 <img alt="./images/pref_dialog_files.png" src="./images/pref_dialog_files.png" />
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id59" id="tools-tab-in-preferences-dialog" name="tools-tab-in-preferences-dialog">Tools tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id60" id="tools-tab-in-preferences-dialog" name="tools-tab-in-preferences-dialog">Tools tab in preferences dialog</a></h3>
 <p>Tools tab in preferences dialog</p>
 <img alt="./images/pref_dialog_tools.png" src="./images/pref_dialog_tools.png" />
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id60" id="template-tab-in-preferences-dialog" name="template-tab-in-preferences-dialog">Template tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id61" id="template-tab-in-preferences-dialog" name="template-tab-in-preferences-dialog">Template tab in preferences dialog</a></h3>
 <p>Template tab in preferences dialog</p>
 <img alt="./images/pref_dialog_templ.png" src="./images/pref_dialog_templ.png" />
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id61" id="keybinding-tab-in-preferences-dialog" name="keybinding-tab-in-preferences-dialog">Keybinding tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id62" id="keybinding-tab-in-preferences-dialog" name="keybinding-tab-in-preferences-dialog">Keybinding tab in preferences dialog</a></h3>
 <p>Keybinding tab in preferences dialog</p>
 <img alt="./images/pref_dialog_keys.png" src="./images/pref_dialog_keys.png" />
 <p>There are some handy commands in here that are not, by default,
@@ -1313,13 +1355,13 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id62" id="vte-tab-in-preferences-dialog" name="vte-tab-in-preferences-dialog">VTE tab in preferences dialog</a></h3>
+<h3><a class="toc-backref" href="#id63" id="vte-tab-in-preferences-dialog" name="vte-tab-in-preferences-dialog">VTE tab in preferences dialog</a></h3>
 <p>VTE tab in preferences dialog</p>
 <img alt="./images/pref_dialog_vte.png" src="./images/pref_dialog_vte.png" />
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id63" id="project-management" name="project-management">Project Management</a></h2>
+<h2><a class="toc-backref" href="#id64" id="project-management" name="project-management">Project Management</a></h2>
 <p>Project Management is optional in Geany. Currently it can be used for:</p>
 <ul class="simple">
 <li>Running <em>Make</em> from the project's base directory.</li>
@@ -1332,7 +1374,7 @@
 Geany is shutdown. When restarting Geany, the previously opened project
 file that was in use at the end of the last session will be reopened.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id64" id="new-project" name="new-project">New Project</a></h3>
+<h3><a class="toc-backref" href="#id65" id="new-project" name="new-project">New Project</a></h3>
 <p>To create a new project, fill in the <em>Name</em> field. By default this
 will setup a new project file <tt class="docutils literal"><span class="pre">~/projects/name.geany</span></tt>. Usually it's
 best to store all your project files in the same directory (they are
@@ -1342,7 +1384,7 @@
 structure contained in it.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id65" id="project-properties" name="project-properties">Project Properties</a></h3>
+<h3><a class="toc-backref" href="#id66" id="project-properties" name="project-properties">Project Properties</a></h3>
 <p>You can set an optional description for the project, but it is not
 used elsewhere by Geany.</p>
 <p>The <em>Base path</em> field is used as the directory to run the Make and Make
@@ -1350,7 +1392,7 @@
 specific <em>Run command</em>.
 The specified path can be absolute or relative to the project's file name.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id66" id="run-command" name="run-command">Run command</a></h4>
+<h4><a class="toc-backref" href="#id67" id="run-command" name="run-command">Run command</a></h4>
 <p>The <em>Run command</em> overrides the default run command. You can set this
 to the executable or main script file for the project, and append
 any command-line arguments.</p>
@@ -1363,17 +1405,17 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id67" id="close-project" name="close-project">Close Project</a></h3>
+<h3><a class="toc-backref" href="#id68" id="close-project" name="close-project">Close Project</a></h3>
 <p>Project file settings are saved when the project is closed.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id68" id="open-project" name="open-project">Open Project</a></h3>
+<h3><a class="toc-backref" href="#id69" id="open-project" name="open-project">Open Project</a></h3>
 <p>The Open command displays a standard file chooser, starting in
 <tt class="docutils literal"><span class="pre">~/projects</span></tt>.</p>
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id69" id="build-system" name="build-system">Build system</a></h2>
+<h2><a class="toc-backref" href="#id70" id="build-system" name="build-system">Build system</a></h2>
 <p>Geany has an integrated build system. Firstly this means that the
 current source file will be saved before it is processed. This is
 for convenience so that you don't need to keep saving small changes
@@ -1397,7 +1439,7 @@
 <li>Set Includes and Arguments</li>
 </ul>
 <div class="section">
-<h3><a class="toc-backref" href="#id70" id="compile" name="compile">Compile</a></h3>
+<h3><a class="toc-backref" href="#id71" id="compile" name="compile">Compile</a></h3>
 <p>The Compile command has different uses for different kinds of files.</p>
 <p>For compilable languages such as C and C++, the Compile command is
 setup to compile the current source file into a binary object file.</p>
@@ -1407,7 +1449,7 @@
 will run the file in its language interpreter.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id71" id="build" name="build">Build</a></h3>
+<h3><a class="toc-backref" href="#id72" id="build" name="build">Build</a></h3>
 <p>For compilable languages such as C and C++, the Build command will link
 the current source file's equivalent object file into an executable. If
 the object file does not exist, the source will be compiled and linked
@@ -1415,7 +1457,7 @@
 <p>Interpreted languages do not use the Build command.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id72" id="make-all" name="make-all">Make all</a></h3>
+<h3><a class="toc-backref" href="#id73" id="make-all" name="make-all">Make all</a></h3>
 <p>This effectively runs "make all" in the same directory as the
 current file.</p>
 <div class="note">
@@ -1425,19 +1467,19 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id73" id="make-custom-target" name="make-custom-target">Make custom target</a></h3>
+<h3><a class="toc-backref" href="#id74" id="make-custom-target" name="make-custom-target">Make custom target</a></h3>
 <p>This is similar to running 'Make all' but you will be prompted for
 the make target name to be passed to the Make tool. For example,
 typing 'clean' in the dialog prompt will run "make clean".</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id74" id="make-object" name="make-object">Make object</a></h3>
+<h3><a class="toc-backref" href="#id75" id="make-object" name="make-object">Make object</a></h3>
 <p>Make object will run "make current_file.o" in the same directory as
 the current file, using its prefix for 'current_file'. It is useful
 for compiling just the current file without building the whole project.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id75" id="execute" name="execute">Execute</a></h3>
+<h3><a class="toc-backref" href="#id76" id="execute" name="execute">Execute</a></h3>
 <p>Execute will run the corresponding executable file, shell script or
 interpreted script in a terminal window. Note that the Terminal tool
 path must be correctly set in the Tools tab of the Preferences dialog -
@@ -1448,7 +1490,7 @@
 output from the program before the terminal window is closed.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id76" id="stopping-running-processes" name="stopping-running-processes">Stopping running processes</a></h3>
+<h3><a class="toc-backref" href="#id77" id="stopping-running-processes" name="stopping-running-processes">Stopping running processes</a></h3>
 <p>When there is a running program, the Run button in the toolbar
 becomes a stop button and you can stop the current action. This
 works by sending a signal to the process (and its child process(es))
@@ -1457,7 +1499,7 @@
 cannot be stopped. This can happen when the process creates more than
 one child process.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id77" id="terminal-emulators" name="terminal-emulators">Terminal emulators</a></h4>
+<h4><a class="toc-backref" href="#id78" id="terminal-emulators" name="terminal-emulators">Terminal emulators</a></h4>
 <p>Xterm is known to work properly. If you are using "Terminal"
 (the terminal program of Xfce), you should add the command line
 option <tt class="docutils literal"><span class="pre">--disable-server</span></tt> otherwise the started process cannot be
@@ -1466,7 +1508,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id78" id="set-includes-and-arguments" name="set-includes-and-arguments">Set Includes and Arguments</a></h3>
+<h3><a class="toc-backref" href="#id79" id="set-includes-and-arguments" name="set-includes-and-arguments">Set Includes and Arguments</a></h3>
 <p>By default the Compile and Build commands invoke the compiler and
 linker with only the basic arguments needed by all programs. Using
 Set Includes and Arguments you can add any include paths and compile
@@ -1483,14 +1525,14 @@
 different settings, then writing a Makefile and using the Make commands
 is recommended.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id79" id="one-step-compilation" name="one-step-compilation">One step compilation</a></h4>
+<h4><a class="toc-backref" href="#id80" id="one-step-compilation" name="one-step-compilation">One step compilation</a></h4>
 <p>If you are using the Build command to compile and link in one step,
 you will need to set both the compiler arguments and the linker
 arguments in the linker command setting.</p>
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id80" id="indicators" name="indicators">Indicators</a></h3>
+<h3><a class="toc-backref" href="#id81" id="indicators" name="indicators">Indicators</a></h3>
 <p>Indicators are red squiggly underlines which are used to highlight
 errors which occured while compiling the current file. So you can
 easily see where your code failed to compile. To remove the indicators,
@@ -1500,7 +1542,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id81" id="printing-support" name="printing-support">Printing support</a></h2>
+<h2><a class="toc-backref" href="#id82" id="printing-support" name="printing-support">Printing support</a></h2>
 <p>Since Geany 0.13 there is full printing support using GTK's printing API.
 The printed page(s) will look nearly the same as on your screen in Geany.
 Additionally, there are some options to modify the printed page(s). You
@@ -1548,7 +1590,7 @@
 gtklp or similar programs can be used.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id82" id="plugins" name="plugins">Plugins</a></h2>
+<h2><a class="toc-backref" href="#id83" id="plugins" name="plugins">Plugins</a></h2>
 <p>Plugins are loaded at startup, if the <em>Enable plugin support</em>
 general preference is set. There is also a command-line option,
 <tt class="docutils literal"><span class="pre">-p</span></tt>, which prevents plugins being loaded. Plugins are scanned in
@@ -1568,13 +1610,13 @@
 provides some.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id83" id="keybindings" name="keybindings">Keybindings</a></h2>
+<h2><a class="toc-backref" href="#id84" id="keybindings" name="keybindings">Keybindings</a></h2>
 <p>Geany supports the default keyboard shortcuts for the Scintilla
 editing widget. For a list of these commands, see <a class="reference" href="#scintilla-keyboard-commands">Scintilla
 keyboard commands</a>. The Scintilla keyboard shortcuts will be overridden
 by any custom keybindings with the same keyboard shortcut.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id84" id="switching-documents" name="switching-documents">Switching documents</a></h3>
+<h3><a class="toc-backref" href="#id85" id="switching-documents" name="switching-documents">Switching documents</a></h3>
 <p>There are a few non-configurable bindings to switch between documents,
 listed below. These can also be overridden by custom keybindings.</p>
 <table border="1" class="docutils">
@@ -1604,7 +1646,7 @@
 </table>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id85" id="configurable-keybindings" name="configurable-keybindings">Configurable keybindings</a></h3>
+<h3><a class="toc-backref" href="#id86" id="configurable-keybindings" name="configurable-keybindings">Configurable keybindings</a></h3>
 <p>For all actions listed below you can define your own keybindings. Open
 the Preferences dialog, select the desired action and click on
 change. In the opening dialog you can press any key combination you
@@ -1980,9 +2022,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id86" id="configuration-files" name="configuration-files">Configuration files</a></h1>
+<h1><a class="toc-backref" href="#id87" id="configuration-files" name="configuration-files">Configuration files</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id87" id="global-configuration-file" name="global-configuration-file">Global configuration file</a></h2>
+<h2><a class="toc-backref" href="#id88" id="global-configuration-file" name="global-configuration-file">Global configuration file</a></h2>
 <p>You can use a global configuration file for Geany which will be used if
 the user starts Geany for the first time and an user's configuration
 file was not yet created or in case an user deleted the configuration
@@ -2002,7 +2044,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id88" id="filetype-definition-files" name="filetype-definition-files">Filetype definition files</a></h2>
+<h2><a class="toc-backref" href="#id89" id="filetype-definition-files" name="filetype-definition-files">Filetype definition files</a></h2>
 <p>All colour definitions and other filetype specific settings are
 stored in the filetype definition files. Those settings are colours
 for syntax highlighting, general settings like comment characters or
@@ -2030,9 +2072,9 @@
 to change. All missing settings will be read from the corresponding
 global definition file in <tt class="docutils literal"><span class="pre">$prefix/share/geany</span></tt>.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id89" id="format" name="format">Format</a></h3>
+<h3><a class="toc-backref" href="#id90" id="format" name="format">Format</a></h3>
 <div class="section">
-<h4><a class="toc-backref" href="#id90" id="styling-section" name="styling-section">[styling] Section</a></h4>
+<h4><a class="toc-backref" href="#id91" id="styling-section" name="styling-section">[styling] Section</a></h4>
 <p>In this section the colours for syntax highlighting are defined. The
 format is always: key=forground_colour;background_colour;bold;italic</p>
 <p>Colours have to be specified as RGB hex values prefixed by
@@ -2042,7 +2084,7 @@
 value is something other than "true" or "false", "false" is assumed.</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id91" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
+<h4><a class="toc-backref" href="#id92" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
 <p>This section contains keys for different keyword lists specific to
 the filetype. Some filetypes do not support keywords, so adding a
 new key will not work. You can only add or remove keywords to/from
@@ -2053,7 +2095,7 @@
 </div>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id92" id="settings-section" name="settings-section">[settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id93" id="settings-section" name="settings-section">[settings] Section</a></h4>
 <dl class="docutils">
 <dt>extension</dt>
 <dd><p class="first">This is the default file extension used when saving files, not
@@ -2114,7 +2156,7 @@
 </dl>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id93" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id94" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
 <dl class="docutils">
 <dt>compiler</dt>
 <dd><p class="first">This item specifies the command to compile source code files. But
@@ -2147,7 +2189,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id94" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
+<h3><a class="toc-backref" href="#id95" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
 <p>There is a special filetype definition file called
 filetypes.common. This file defines some general non-filetype-specific
 settings.</p>
@@ -2257,7 +2299,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id95" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
+<h2><a class="toc-backref" href="#id96" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
 <p>To change the default filetype extension used when saving a new file,
 see <a class="reference" href="#filetype-definition-files">Filetype definition files</a>.</p>
 <p>You can override the list of file extensions that Geany uses for each
@@ -2283,7 +2325,7 @@
 </pre>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id96" id="templates" name="templates">Templates</a></h2>
+<h2><a class="toc-backref" href="#id97" id="templates" name="templates">Templates</a></h2>
 <p>Geany supports the following templates:</p>
 <ul class="simple">
 <li>ChangeLog entry</li>
@@ -2302,10 +2344,11 @@
 of the function, so that the function name can be determined
 automatically. The description will be positioned correctly one line
 above the function, just check it out. If the cursor is not inside
-of a function or the function name cannot be determined, you cannot
-insert a function description.</p>
+of a function or the function name cannot be determined, the inserted
+function description won't contain the correct function name but "unknown"
+instead.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id97" id="template-metadata" name="template-metadata">Template metadata</a></h3>
+<h3><a class="toc-backref" href="#id98" id="template-metadata" name="template-metadata">Template metadata</a></h3>
 <p>Metadata can be used with all templates, but by default user set
 metadata is only used for the ChangeLog and File header templates.</p>
 <p>In the configuration dialog you can find a tab "Templates" (see
@@ -2315,7 +2358,7 @@
 at startup.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id98" id="filetype-templates" name="filetype-templates">Filetype templates</a></h3>
+<h3><a class="toc-backref" href="#id99" id="filetype-templates" name="filetype-templates">Filetype templates</a></h3>
 <p>Filetype templates are templates used as the basis of a new file. To
 use them, choose the <em>New (with Template)</em> menu item from the <em>File</em>
 menu.</p>
@@ -2336,7 +2379,7 @@
 the New command is used without a filetype. This is empty by default.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id99" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
+<h3><a class="toc-backref" href="#id100" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
 <p>Each template can be customized to your needs. The templates are
 stored in the <tt class="docutils literal"><span class="pre">~/.geany/templates/</span></tt> directory (see the section called
 <a class="reference" href="#command-line-options">Command line options</a> for further information about the configuration
@@ -2344,7 +2387,7 @@
 Geany ;-) ) and edit the template to your needs. There are some
 wildcards which will be automatically replaced by Geany at startup.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id100" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
+<h4><a class="toc-backref" href="#id101" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
 <p>All wildcards must be enclosed by "{" and "}", e.g. {date}.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -2453,7 +2496,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id101" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
+<h1><a class="toc-backref" href="#id102" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
 <p>This document (<tt class="docutils literal"><span class="pre">geany.txt</span></tt>) is written in <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
 (or "reST"). The source file for it is located in Geany's <tt class="docutils literal"><span class="pre">doc</span></tt>
 subdirectory.  If you intend on making changes, you should grab the
@@ -2473,7 +2516,7 @@
 and Fedora systems.</p>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id102" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
+<h1><a class="toc-backref" href="#id103" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
 <p>Copyright © 1998, 2006 Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>This appendix is distributed under the terms of the License for
 Scintilla and SciTE. A copy of this license can be found in the file
@@ -2482,7 +2525,7 @@
 Scintilla and SciTE</a>.</p>
 <p>20 June 2006</p>
 <div class="section">
-<h2><a class="toc-backref" href="#id103" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
+<h2><a class="toc-backref" href="#id104" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
 <p>Keyboard commands for Scintilla mostly follow common Windows and GTK+
 conventions. All move keys (arrows, page up/down, home and end)
 allows to extend or reduce the stream selection when holding the
@@ -2582,7 +2625,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id104" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
+<h1><a class="toc-backref" href="#id105" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
 <p>There are some uncommon preferences that are not shown in the Preferences
 dialog. These can be set by editing <tt class="docutils literal"><span class="pre">~/.geany/geany.conf</span></tt>, then
 restarting Geany. Search for the key name, then edit the value. Example:</p>
@@ -2653,7 +2696,7 @@
 </table>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id105" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
+<h1><a class="toc-backref" href="#id106" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
 <p>There are some options which can only be changed at compile time. To
 change these options, edit the file src/geany.h. Look for a block of
 lines starting with <tt class="docutils literal"><span class="pre">#define</span> <span class="pre">GEANY_*</span></tt>. Any definitions which are
@@ -2691,6 +2734,11 @@
 the auto completion list.</td>
 <td>10</td>
 </tr>
+<tr><td>GEANY_MIN_SYMBOLLIST_CHARS</td>
+<td>How many characters you need to type to
+trigger the auto completion list.</td>
+<td>4</td>
+</tr>
 <tr><td>GEANY_PROJECT_EXT</td>
 <td>The default filename extension for Geany
 project files. It is used when creating new
@@ -2798,7 +2846,7 @@
 </table>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id106" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
+<h1><a class="toc-backref" href="#id107" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
 <pre class="literal-block">
             GNU GENERAL PUBLIC LICENSE
                Version 2, June 1991
@@ -3143,7 +3191,7 @@
 </pre>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id107" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
+<h1><a class="toc-backref" href="#id108" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
 <p>Copyright 1998-2003 by Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>All Rights Reserved</p>
 <p>Permission to use, copy, modify, and distribute this software and
@@ -3163,7 +3211,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2007-11-29 17:49 UTC.
+Generated on: 2007-12-07 14:10 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/doc/geany.txt	2007-12-07 14:13:05 UTC (rev 2093)
@@ -375,8 +375,8 @@
 Only text files are supported, i.e. opening files which contain
 NUL-bytes may fail. Geany will try to open the file anyway but it is
 likely that the file will be truncated because it can only opened up
-to the first occurrence of the first NUL-byte. All characters after
-this position are lost and are not written when you save the file.
+to the first occurrence of a NUL-byte. All characters after this
+position are lost and are not written when you save the file.
 
 Geany tries to detect the encoding of a file while opening it. It
 might be that the encoding of a file cannot be detected correctly so
@@ -409,7 +409,49 @@
   the current file unless you save it. It is useful when you want to
   change the encoding of the file.
 
+* Specifying the encoding in the file itself
+  As mentioned above, auto detecting the encoding of a file may fail on
+  some encodings. If you know that Geany doesn't open a certain file,
+  you can add a special line to the beginning of the file to force an
+  encoding when opening the file (for details see below).
 
+
+In-file encoding specification
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Geany detects meta tags of HTML files which contain charset information
+like::
+
+    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15" />
+
+and the found charset is used when opening the file. This is useful if the
+encoding of the file cannot be detected properly.
+For non-HTML files you can also define a line like::
+
+    /* geany_encoding=ISO-8859-15 */
+
+or::
+
+    # geany_encoding=ISO-8859-15 #
+
+to force an encoding to be used. The used #, /\* and \*/ are only examples
+for filetype-specific comment characters. It doesn't matter which
+characters are around the string " geany_encoding=ISO-8859-15 " as long
+as there is at least one whitespace character before and after this
+string. Whitespace characters are in this case a space or tab character.
+"geany_encoding" must be in lower-case, the charset string is
+case-independent. There must **not** be any whitespace between
+"geany_encoding", the "=" sign and the charset.
+An example to use this could be you have a file with ISO-8859-15
+encoding but Geany constantly detects the file encoding as ISO-8859-1.
+Then you simply add such a line to the file and Geany will open it
+correctly the next time.
+
+.. note::
+    These specifications must be in the first 512 bytes of the file.
+    Anything after the first 512 bytes will not be recognised.
+
+
 Special encoding "None"
 ^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -466,10 +508,11 @@
 
 The folding behaviour can be changed with the "Fold/Unfold all children of
 a fold point" option in the preference dialog. If activated, Geany will
-unfold all nested(child) fold points below the current one if they are
-already folded (when clicking on a [+] symbol).
-When clicking on a [-] symbol, Geany will fold all nested(child) fold
-points below the current one if they are unfolded.
+unfold all nested fold points below the current one if they are already
+folded (when clicking on a [+] symbol).
+When clicking on a [-] symbol, Geany will fold all nested fold points
+below the current one if they are unfolded.
+
 The usage of this option can be instantly inverted by pressing the Shift
 key while clicking on a fold symbol. That means, if the "Fold/Unfold all
 children of a fold point" option is enabled, pressing Shift will disable
@@ -2146,8 +2189,9 @@
 of the function, so that the function name can be determined
 automatically. The description will be positioned correctly one line
 above the function, just check it out. If the cursor is not inside
-of a function or the function name cannot be determined, you cannot
-insert a function description.
+of a function or the function name cannot be determined, the inserted
+function description won't contain the correct function name but "unknown"
+instead.
 
 
 Template metadata
@@ -2412,6 +2456,8 @@
                                 Geany provide.
 GEANY_MAX_AUTOCOMPLETE_HEIGHT   How many suggestions should be visible in     10
                                 the auto completion list.
+GEANY_MIN_SYMBOLLIST_CHARS      How many characters you need to type to       4
+                                trigger the auto completion list.
 GEANY_PROJECT_EXT               The default filename extension for Geany      geany
                                 project files. It is used when creating new
                                 projects and as filter mask for the project

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/callbacks.c	2007-12-07 14:13:05 UTC (rev 2093)
@@ -1005,9 +1005,8 @@
 	if (! app->ignore_callback)
 	{
 		gint idx = document_get_cur_idx();
-		if (idx == -1 || ! doc_list[idx].is_valid) return;
-		doc_list[idx].line_wrapping = ! doc_list[idx].line_wrapping;
-		sci_set_lines_wrapped(doc_list[idx].sci, doc_list[idx].line_wrapping);
+		if (! DOC_IDX_VALID(idx)) return;
+		document_set_line_wrapping(idx, ! doc_list[idx].line_wrapping);
 	}
 }
 
@@ -1019,7 +1018,7 @@
 	if (! app->ignore_callback)
 	{
 		gint idx = document_get_cur_idx();
-		if (idx == -1 || ! doc_list[idx].is_valid) return;
+		if (! DOC_IDX_VALID(idx)) return;
 		doc_list[idx].readonly = ! doc_list[idx].readonly;
 		sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly);
 		ui_update_tab_status(idx);
@@ -1035,7 +1034,7 @@
 	if (! app->ignore_callback)
 	{
 		gint idx = document_get_cur_idx();
-		if (idx == -1 || ! doc_list[idx].is_valid) return;
+		if (! DOC_IDX_VALID(idx)) return;
 		doc_list[idx].auto_indent = ! doc_list[idx].auto_indent;
 	}
 }

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/document.c	2007-12-07 14:13:05 UTC (rev 2093)
@@ -263,6 +263,17 @@
 }
 
 
+void document_set_line_wrapping(gint idx, gboolean wrap)
+{
+	document *doc = &doc_list[idx];
+
+	g_return_if_fail(DOC_IDX_VALID(idx));
+
+	doc->line_wrapping = wrap;
+	sci_set_lines_wrapped(doc->sci, wrap);
+}
+
+
 // Apply just the prefs that can change in the Preferences dialog
 void document_apply_update_prefs(gint idx)
 {

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/document.h	2007-12-07 14:13:05 UTC (rev 2093)
@@ -241,4 +241,6 @@
 
 void document_set_use_tabs(gint idx, gboolean use_tabs);
 
+void document_set_line_wrapping(gint idx, gboolean wrap);
+
 #endif

Modified: trunk/src/encodings.c
===================================================================
--- trunk/src/encodings.c	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/encodings.c	2007-12-07 14:13:05 UTC (rev 2093)
@@ -42,7 +42,17 @@
 #include "callbacks.h"
 
 
+#ifdef HAVE_REGCOMP
+# include <regex.h>
+// <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+# define PATTERN_HTMLMETA "<meta[ \t\n\r\f]http-equiv[ \t\n\r\f]*=[ \t\n\r\f]*\"content-type\"[ \t\n\r\f]+content[ \t\n\r\f]*=[ \t\n\r\f]*\"text/x?html;[ \t\n\r\f]*charset=([a-z0-9_-]+)\"[ \t\n\r\f]*/?>"
+// " geany_encoding=utf-8 "
+# define PATTERN_GEANY "[\t ]geany_encoding=([a-z0-9-]+)[\t ]"
+// precompiled regexps
+static regex_t pregs[2];
+#endif
 
+
 #define fill(Order, Group, Idx, Charset, Name) \
 		encodings[Idx].idx = Idx; \
 		encodings[Idx].order = Order; \
@@ -123,6 +133,24 @@
 }
 
 
+GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset)
+{
+	gint i;
+
+	if (charset == NULL) return GEANY_ENCODING_UTF_8;
+
+	i = 0;
+	while (i < GEANY_ENCODINGS_MAX)
+	{
+		if (strcmp(charset, encodings[i].charset) == 0)
+			return i;
+
+		++i;
+	}
+	return GEANY_ENCODING_UTF_8;
+}
+
+
 const GeanyEncoding *encodings_get_from_charset(const gchar *charset)
 {
 	gint i;
@@ -190,6 +218,68 @@
 }
 
 
+#ifdef HAVE_REGCOMP
+/* Regexp detection of file enconding declared in the file itself.
+ * Idea and parts of code taken from Bluefish, thanks.
+ * regex_compile() is used to compile regular expressions on program init and keep it in memory
+ * for faster access when opening a file. Pre-compiled regexps will be freed on program exit.
+ */
+static void regex_compile(regex_t *preg, const gchar *pattern)
+{
+	gint retval = regcomp(preg, pattern, REG_EXTENDED | REG_ICASE);
+	if (retval != 0)
+	{
+		gchar errmsg[512];
+		regerror(retval, preg, errmsg, 512);
+		geany_debug("regcomp() failed (%s)", errmsg);
+		regfree(preg);
+		return;
+	}
+}
+
+
+static gchar *regex_match(regex_t *preg, const gchar *buffer, gsize size)
+{
+	gint retval;
+	gchar *tmp_buf = NULL;
+	gchar *encoding = NULL;
+	regmatch_t pmatch[10];
+
+	if (buffer == NULL || preg->buffer == NULL)
+		return NULL;
+
+	if (size > 512)
+		tmp_buf = g_strndup(buffer, 512); // scan only the first 512 characters in the buffer
+
+	retval = regexec(preg, (tmp_buf != NULL) ? tmp_buf : buffer, 10, pmatch, 0);
+	if (retval == 0 && pmatch[0].rm_so != -1 && pmatch[1].rm_so != -1)
+	{
+		encoding = g_strndup(&buffer[pmatch[1].rm_so], pmatch[1].rm_eo-pmatch[1].rm_so);
+		geany_debug("Detected encoding by regex search: %s", encoding);
+
+		setptr(encoding, g_utf8_strup(encoding, -1));
+	}
+	g_free(tmp_buf);
+	return encoding;
+}
+#endif
+
+
+void encodings_finalize(void)
+{
+#ifdef HAVE_REGCOMP
+	guint i;
+	for (i = 0; i < G_N_ELEMENTS(pregs); i++)
+	{
+		if (pregs[i].buffer == NULL)
+		{
+			regfree(&pregs[i]);
+		}
+	}
+#endif
+}
+
+
 void encodings_init(void)
 {
 	GtkWidget *item, *menu[2], *submenu, *menu_westeuro, *menu_easteuro, *menu_eastasian, *menu_asian,
@@ -203,6 +293,11 @@
 
 	init_encodings();
 
+#ifdef HAVE_REGCOMP
+	regex_compile(&pregs[0], PATTERN_HTMLMETA);
+	regex_compile(&pregs[1], PATTERN_GEANY);
+#endif
+
 	// create encodings submenu in document menu
 	menu[0] = lookup_widget(app->window, "set_encoding1_menu");
 	menu[1] = lookup_widget(app->window, "menu_reload_as1_menu");
@@ -340,27 +435,49 @@
 gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_encoding)
 {
 	gchar *locale_charset = NULL;
+	gchar *regex_charset = NULL;
+	gchar *charset;
 	gchar *utf8_content;
-	gchar *charset;
-	gboolean check_current = FALSE;
+	gboolean check_regex = FALSE;
+	gboolean check_locale = FALSE;
 	guint i;
 
+#ifdef HAVE_REGCOMP
+	// first try to read the encoding from the file content
+	for (i = 0; i < G_N_ELEMENTS(pregs) && ! check_regex; i++)
+	{
+		if ((regex_charset = regex_match(&pregs[i], buffer, size)) != NULL)
+			check_regex = TRUE;
+	}
+#endif
+
 	// current locale is not UTF-8, we have to check this charset
-	check_current = ! g_get_charset((const gchar**)&locale_charset);
+	check_locale = ! g_get_charset((const gchar**) &charset);
 
 	for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
 	{
-		if (i == (guint) encodings[GEANY_ENCODING_NONE].idx) continue;
+		if (i == (guint) encodings[GEANY_ENCODING_NONE].idx || i == (guint) -1)
+			continue;
 
-		if (check_current)
+		if (check_regex)
 		{
-			check_current = FALSE;
+			check_regex = FALSE;
+			charset = regex_charset;
+			i = -1;
+		}
+		else if (check_locale)
+		{
+			check_locale = FALSE;
 			charset = locale_charset;
 			i = -1;
 		}
 		else
 			charset = encodings[i].charset;
 
+
+		if (charset == NULL)
+			continue;
+
 		geany_debug("Trying to convert %d bytes of data from %s into UTF-8.", size, charset);
 		utf8_content = encodings_convert_to_utf8_from_charset(buffer, size, charset, FALSE);
 
@@ -370,14 +487,16 @@
 			{
 				if (*used_encoding != NULL)
 				{
+					geany_debug("%s:%d", __FILE__, __LINE__);
 					g_free(*used_encoding);
-					geany_debug("%s:%d", __FILE__, __LINE__);
 				}
 				*used_encoding = g_strdup(charset);
 			}
+			g_free(regex_charset);
 			return utf8_content;
 		}
 	}
+	g_free(regex_charset);
 
 	return NULL;
 }

Modified: trunk/src/encodings.h
===================================================================
--- trunk/src/encodings.h	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/encodings.h	2007-12-07 14:13:05 UTC (rev 2093)
@@ -57,7 +57,6 @@
 } GeanyEncoding;
 
 
-
 const GeanyEncoding* encodings_get_from_charset(const gchar *charset);
 const GeanyEncoding* encodings_get_from_index(gint idx);
 
@@ -67,6 +66,7 @@
 void encodings_select_radio_item(const gchar *charset);
 
 void encodings_init(void);
+void encodings_finalize(void);
 
 gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_encoding);
 
@@ -167,4 +167,6 @@
 
 GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, guint *bom_len);
 
+GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
+
 #endif

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/keyfile.c	2007-12-07 14:13:05 UTC (rev 2093)
@@ -25,6 +25,11 @@
  * geany.conf preferences file loading and saving.
  */
 
+/*
+ * Session file format:
+ * filename_xx=pos;filetype UID;read only;encoding idx;use_tabs;auto_indent;line_wrapping;filename
+ */
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -115,8 +120,15 @@
 			if (ft == NULL)	// can happen when saving a new file when quitting
 				ft = filetypes[GEANY_FILETYPES_ALL];
 			g_snprintf(entry, 13, "FILE_NAME_%d", j);
-			fname = g_strdup_printf("%d:%d:%s", sci_get_current_position(doc_list[idx].sci),
-				ft->uid, doc_list[idx].file_name);
+			fname = g_strdup_printf("%d;%d;%d;%d;%d;%d;%d;%s;",
+				sci_get_current_position(doc_list[idx].sci),
+				ft->uid,
+				doc_list[idx].readonly,
+				encodings_get_idx_from_charset(doc_list[idx].encoding),
+				doc_list[idx].use_tabs,
+				doc_list[idx].auto_indent,
+				doc_list[idx].line_wrapping,
+				doc_list[idx].file_name);
 			g_key_file_set_string(config, "files", entry, fname);
 			g_free(fname);
 			j++;
@@ -403,7 +415,7 @@
 	gsize len = 0;
 	gboolean have_session_files;
 	gchar entry[14];
-	gchar *tmp_string;
+	gchar **tmp_array;
 	GError *error = NULL;
 
 	session_notebook_page = utils_get_setting_integer(config, "files", "current_page", -1);
@@ -429,14 +441,14 @@
 	while (have_session_files)
 	{
 		g_snprintf(entry, 13, "FILE_NAME_%d", i);
-		tmp_string = g_key_file_get_string(config, "files", entry, &error);
-		if (! tmp_string || error)
+		tmp_array = g_key_file_get_string_list(config, "files", entry, NULL, &error);
+		if (! tmp_array || error)
 		{
 			g_error_free(error);
 			error = NULL;
 			have_session_files = FALSE;
 		}
-		g_ptr_array_add(session_files, tmp_string);
+		g_ptr_array_add(session_files, tmp_array);
 		i++;
 	}
 }
@@ -798,7 +810,7 @@
 gboolean configuration_open_files()
 {
 	gint i;
-	guint x, pos, y, len;
+	guint pos;
 	gboolean ret = FALSE, failure = FALSE;
 
 	document_delay_colourise();
@@ -806,51 +818,45 @@
 	i = prefs.tab_order_ltr ? 0 : (session_files->len - 1);
 	while (TRUE)
 	{
-		gchar *tmp = g_ptr_array_index(session_files, i);
+		gchar **tmp = g_ptr_array_index(session_files, i);
 
-		if (tmp && *tmp)
+		if (tmp != NULL && g_strv_length(tmp) == 8)
 		{
-			const gchar *file;
-			gchar *locale_filename, **array;
-			gint uid = -1;
-			x = 0;
-			y = 0;
+			gchar *locale_filename;
+			gint ft_uid, enc_idx;
+			gboolean ro, use_tabs, auto_indent, line_wrapping;
 
-			// yes it is :, it should be a ;, but now it is too late to change it
-			array = g_strsplit(tmp, ":", 3);
-			len = g_strv_length(array);
+			pos = atoi(tmp[0]);
+			ft_uid = atoi(tmp[1]);
+			ro = atoi(tmp[2]);
+			enc_idx = atoi(tmp[3]);
+			use_tabs = atoi(tmp[4]);
+			auto_indent = atoi(tmp[5]);
+			line_wrapping = atoi(tmp[6]);
+			// try to get the locale equivalent for the filename
+			locale_filename = utils_get_locale_from_utf8(tmp[7]);
 
-			// read position
-			if (len > 0 && array[0]) pos = atoi(array[0]);
-			else pos = 0;
-
-			// read filetype (only if there are more than two fields, otherwise we have the old format)
-			if (len > 2 && array[1])
-			{
-				uid = atoi(array[1]);
-				file = array[2];
-			}
-			else file = array[1];
-
-			// try to get the locale equivalent for the filename, fallback to filename if error
-			locale_filename = utils_get_locale_from_utf8(file);
-
 			if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
 			{
-				filetype *ft = filetypes_get_from_uid(uid);
-				document_open_file_full(-1, locale_filename, pos, FALSE, ft, NULL);
+				filetype *ft = filetypes_get_from_uid(ft_uid);
+				gint new_idx = document_open_file_full(
+					-1, locale_filename, pos, ro, ft,
+					(enc_idx >= 0 && enc_idx < GEANY_ENCODINGS_MAX) ?
+						encodings[enc_idx].charset : NULL);
+				document_set_use_tabs(new_idx, use_tabs);
+				doc_list[new_idx].auto_indent = auto_indent;
+				document_set_line_wrapping(new_idx, line_wrapping);
 				ret = TRUE;
 			}
 			else
 			{
 				failure = TRUE;
-				geany_debug("Could not find file '%s'.", file);
+				geany_debug("Could not find file '%s'.", tmp[4]);
 			}
 
-			g_strfreev(array);
 			g_free(locale_filename);
 		}
-		g_free(tmp);
+		g_strfreev(tmp);
 
 		if (prefs.tab_order_ltr)
 		{
@@ -875,6 +881,8 @@
 		// exlicitly allow notebook switch page callback to be called for window title,
 		// encoding settings and so other things
 		main_status.opening_session_files = FALSE;
+		/// TODO if session_notebook_page is equal to the current notebook tab(the last opened)
+		/// the notebook switch page callback isn't triggered and e.g. menu items are not updated
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), session_notebook_page);
 		// reset status to leave in any case with the same state as when entering
 		main_status.opening_session_files = TRUE;

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-12-06 16:38:13 UTC (rev 2092)
+++ trunk/src/main.c	2007-12-07 14:13:05 UTC (rev 2093)
@@ -815,6 +815,7 @@
 	document_finalize();
 	symbols_finalize();
 	editor_finalize();
+	encodings_finalize();
 
 	tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));
 	g_free(app->configdir);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list