SF.net SVN: geany:[4340] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Oct 19 14:58:52 UTC 2009
Revision: 4340
http://geany.svn.sourceforge.net/geany/?rev=4340&view=rev
Author: ntrel
Date: 2009-10-19 14:58:51 +0000 (Mon, 19 Oct 2009)
Log Message:
-----------
Add filetype "lexer_filetype" key so custom filetypes can use an
existing lexer.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/filetypes.c
trunk/src/filetypes.h
trunk/src/highlighting.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/ChangeLog 2009-10-19 14:58:51 UTC (rev 4340)
@@ -8,6 +8,10 @@
Add filetype "tag_parser" key so custom filetypes can use an existing
tag parser.
Add tm_source_file_get_named_lang().
+ * src/highlighting.c, src/filetypes.c, src/filetypes.h, doc/geany.txt,
+ doc/geany.html:
+ Add filetype "lexer_filetype" key so custom filetypes can use an
+ existing lexer.
2009-10-19 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/doc/geany.html 2009-10-19 14:58:51 UTC (rev 4340)
@@ -3967,13 +3967,22 @@
the '<tt class="docutils literal"><span class="pre">*</span></tt>' wildcard.</p>
<p>Custom filetypes are not as powerful as built-in filetypes. The following
have been implemented:</p>
-<ul class="simple">
-<li>Recognizing and setting the filetype (after the user has manually edited
-<tt class="docutils literal"><span class="pre">filetype_extensions.conf</span></tt>).</li>
-<li>Filetype settings in the [settings] section (see <a class="reference" href="#format">Format</a>).</li>
-<li>Build commands.</li>
-<li>Tag parsing (<tt class="docutils literal"><span class="pre">tag_parser</span></tt> key).</li>
+<ul>
+<li><p class="first">Recognizing and setting the filetype (after the user has manually edited
+<tt class="docutils literal"><span class="pre">filetype_extensions.conf</span></tt>).</p>
+</li>
+<li><dl class="first docutils">
+<dt>Filetype settings in the [settings] section (see <a class="reference" href="#format">Format</a>).</dt>
+<dd><ul class="first last simple">
+<li>Using existing tag parsing (<tt class="docutils literal"><span class="pre">tag_parser</span></tt> key).</li>
+<li>Using existing syntax highlighting (<tt class="docutils literal"><span class="pre">lexer_filetype</span></tt> key).</li>
</ul>
+</dd>
+</dl>
+</li>
+<li><p class="first">Build commands.</p>
+</li>
+</ul>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id174" id="system-files" name="system-files">System files</a></h3>
@@ -4119,6 +4128,8 @@
</dd>
<dt>tag_parser</dt>
<dd>The TagManager language name, e.g. "C".</dd>
+<dt>lexer_filetype</dt>
+<dd>A filetype name to setup syntax highlighting from another filetype.</dd>
</dl>
</div>
<div class="section">
@@ -5753,7 +5764,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2009-10-19 14:14 UTC.
+Generated on: 2009-10-19 14:50 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 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/doc/geany.txt 2009-10-19 14:58:51 UTC (rev 4340)
@@ -3334,8 +3334,9 @@
* Recognizing and setting the filetype (after the user has manually edited
``filetype_extensions.conf``).
* Filetype settings in the [settings] section (see `Format`_).
+ * Using existing tag parsing (``tag_parser`` key).
+ * Using existing syntax highlighting (``lexer_filetype`` key).
* Build commands.
-* Tag parsing (``tag_parser`` key).
System files
^^^^^^^^^^^^
@@ -3506,7 +3507,10 @@
tag_parser
The TagManager language name, e.g. "C".
+lexer_filetype
+ A filetype name to setup syntax highlighting from another filetype.
+
[build_settings] Section
````````````````````````
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/src/filetypes.c 2009-10-19 14:58:51 UTC (rev 4340)
@@ -1244,6 +1244,15 @@
g_free(result);
}
+ result = utils_get_setting_string(configh, "settings", "lexer_filetype", NULL);
+ if (!result)
+ result = utils_get_setting_string(config, "settings", "lexer_filetype", NULL);
+ if (result)
+ {
+ ft->lexer_filetype = filetypes_lookup_by_name(result);
+ g_free(result);
+ }
+
/* read build settings */
build_load_menu(config, GEANY_BCS_FT, (gpointer)ft);
build_load_menu(configh, GEANY_BCS_HOME_FT, (gpointer)ft);
Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/src/filetypes.h 2009-10-19 14:58:51 UTC (rev 4340)
@@ -119,6 +119,7 @@
gboolean comment_use_indent;
GeanyFiletypeGroupID group;
gchar *error_regex_string;
+ GeanyFiletype *lexer_filetype;
struct GeanyFiletypePrivate *priv; /* must be last, append fields before this item */
#ifdef GEANY_PRIVATE
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2009-10-19 14:24:40 UTC (rev 4339)
+++ trunk/src/highlighting.c 2009-10-19 14:58:51 UTC (rev 4340)
@@ -3243,6 +3243,13 @@
{
filetypes_load_config(ft->id, FALSE); /* load filetypes.ext */
+ /* now settings are loaded, check lexer_filetype */
+ if (ft->lexer_filetype)
+ {
+ highlighting_set_styles(sci, ft->lexer_filetype);
+ return;
+ }
+
/* load tags files (some lexers highlight global typenames) */
if (ft->id != GEANY_FILETYPES_NONE)
symbols_global_tags_loaded(ft->id);
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