qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs rlang.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs rlang.c
Date: Tue, 28 Jul 2015 19:00:28 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/07/28 19:00:28

Modified files:
        .              : rlang.c 

Log message:
        make r_lang probe more restrictive, fixed small issues

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/rlang.c?cvsroot=qemacs&r1=1.1&r2=1.2

Patches:
Index: rlang.c
===================================================================
RCS file: /sources/qemacs/qemacs/rlang.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- rlang.c     24 Jun 2015 12:42:36 -0000      1.1
+++ rlang.c     28 Jul 2015 19:00:28 -0000      1.2
@@ -93,7 +93,7 @@
         case '%':
             for (j = i; qe_isalpha(str[j]); j++)
                 continue;
-            if (str[j] == '%') {
+            if (j > i && str[j] == '%') {
                 i = j + 1;
                 style = R_STYLE_KEYWORD;
                 break;
@@ -161,7 +161,7 @@
                     style = R_STYLE_ARGDEF;
                     break;
                 }
-                if (str[j] == '=') {
+                if (str[j] == '=' && str[j + 1] != '=') {
                     style = R_STYLE_ARGNAME;
                     break;
                 }
@@ -185,11 +185,22 @@
     cp->colorize_state = colstate;
 }
 
+static int r_mode_probe(ModeDef *mode, ModeProbeData *p)
+{
+    /* check file name or extension */
+    if (match_extension(p->filename, mode->extensions)
+    &&  !(p->buf[0] == '/' && p->buf[1] == '*'))
+        return 80;
+
+    return 1;
+}
+
 static ModeDef r_mode = {
     .name = "R",
     .extensions = "R",
     .keywords = r_keywords,
     .types = r_types,
+    .mode_probe = r_mode_probe,
     .colorize_func = r_colorize_line,
 };
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]