[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs latex-mode.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs latex-mode.c |
Date: |
Sun, 05 Apr 2015 18:29:00 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 15/04/05 18:29:00
Modified files:
. : latex-mode.c
Log message:
added simplistic TeXinfo colorizer
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/latex-mode.c?cvsroot=qemacs&r1=1.50&r2=1.51
Patches:
Index: latex-mode.c
===================================================================
RCS file: /sources/qemacs/qemacs/latex-mode.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- latex-mode.c 30 May 2014 17:18:15 -0000 1.50
+++ latex-mode.c 5 Apr 2015 18:29:00 -0000 1.51
@@ -23,6 +23,12 @@
#include "qe.h"
enum {
+ TEX_TEX,
+ TEX_LATEX,
+ TEX_TEXINFO,
+};
+
+enum {
LATEX_STYLE_COMMENT = QE_STYLE_COMMENT,
LATEX_STYLE_STRING = QE_STYLE_STRING,
LATEX_STYLE_FUNCTION = QE_STYLE_FUNCTION,
@@ -39,7 +45,7 @@
int i = 0, start, c;
int state = cp->colorize_state;
- for (;;) {
+ for (i = 0; i < n;) {
start = i;
c = str[i++];
switch (c) {
@@ -65,6 +71,15 @@
SET_COLOR(str, start, i, LATEX_STYLE_STRING);
}
break;
+ case '@':
+ if (syn->colorize_flags != TEX_TEXINFO)
+ break;
+ if (str[i] == 'c' && !qe_isalnum_(str[i + 1])) {
+ i = n;
+ SET_COLOR(str, start, i, LATEX_STYLE_COMMENT);
+ break;
+ }
+ /* fall thru */
case '\\':
/* \function[keyword]{variable} */
if (str[i] == '\'' || str[i] == '\"' || str[i] == '~'
@@ -330,11 +345,20 @@
.extensions = "tex|but",
.mode_probe = latex_mode_probe,
.colorize_func = latex_colorize_line,
+ .colorize_flags = TEX_LATEX,
+};
+
+static ModeDef texinfo_mode = {
+ .name = "TeXinfo",
+ .extensions = "texi",
+ .colorize_func = latex_colorize_line,
+ .colorize_flags = TEX_TEXINFO,
};
static int latex_init(void)
{
qe_register_mode(&latex_mode, MODEF_SYNTAX);
+ qe_register_mode(&texinfo_mode, MODEF_SYNTAX);
qe_register_cmd_table(latex_commands, &latex_mode);
register_completion("latex", latex_completion);
- [Qemacs-commit] qemacs latex-mode.c,
Charlie Gordon <=