qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs html.c htmlsrc.c xml.c docbook.c unihex.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs html.c htmlsrc.c xml.c docbook.c unihex.c
Date: Mon, 10 Feb 2014 03:24:35 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/02/10 03:24:35

Modified files:
        .              : html.c htmlsrc.c xml.c docbook.c unihex.c 

Log message:
        Fix mode priority for xml formats
        
        * set priority order to html > htmlsrc > docbook > xml > text > binary
        * make unihex a very low priority (1)
        * fix unihex display bug on last line

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/html.c?cvsroot=qemacs&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/qemacs/htmlsrc.c?cvsroot=qemacs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/qemacs/xml.c?cvsroot=qemacs&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/qemacs/docbook.c?cvsroot=qemacs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/qemacs/unihex.c?cvsroot=qemacs&r1=1.21&r2=1.22

Patches:
Index: html.c
===================================================================
RCS file: /sources/qemacs/qemacs/html.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- html.c      23 Jan 2014 12:56:22 -0000      1.28
+++ html.c      10 Feb 2014 03:24:34 -0000      1.29
@@ -783,14 +783,14 @@
 
     /* XXX: should register callbacks for s->offset and s->top_offset? */
 
-    if (!saved_data) {
+    if (saved_data) {
+        memcpy(s, saved_data->generic_data, SAVED_DATA_SIZE);
+    } else {
         memset(s, 0, SAVED_DATA_SIZE);
         s->insert = 1;
         s->indent_size = 4;
         s->default_style = QE_STYLE_DEFAULT;
         s->wrap = WRAP_LINE;
-    } else {
-        memcpy(s, saved_data->generic_data, SAVED_DATA_SIZE);
     }
 
     eb_add_callback(s->b, html_callback, s, 0);

Index: htmlsrc.c
===================================================================
RCS file: /sources/qemacs/qemacs/htmlsrc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- htmlsrc.c   6 Feb 2014 00:22:18 -0000       1.8
+++ htmlsrc.c   10 Feb 2014 03:24:35 -0000      1.9
@@ -253,7 +253,7 @@
 
     /* first check file extension */
     if (match_extension(p->filename, mode->extensions))
-        return 80;
+        return 90;
 
     /* then try buffer contents */
     if (p->buf_size >= 5 &&
@@ -261,7 +261,7 @@
          !html_tagcmp(buf, "<SCRIPT") ||
          !html_tagcmp(buf, "<?XML") ||
          !html_tagcmp(buf, "<!DOCTYPE"))) {
-        return 80;
+        return 90;
     }
 
     return 1;

Index: xml.c
===================================================================
RCS file: /sources/qemacs/qemacs/xml.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- xml.c       20 Jan 2014 18:04:00 -0000      1.14
+++ xml.c       10 Feb 2014 03:24:35 -0000      1.15
@@ -182,7 +182,7 @@
     p++;
     if (*p != '!' && *p != '?' && !qe_isalpha(*p))
         return 0;
-    return 90; /* leave some room for more specific XML parser */
+    return 80; /* leave some room for more specific XML parser */
 }
 
 ModeDef xml_mode;

Index: docbook.c
===================================================================
RCS file: /sources/qemacs/qemacs/docbook.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- docbook.c   5 Jan 2014 23:42:54 -0000       1.8
+++ docbook.c   10 Feb 2014 03:24:35 -0000      1.9
@@ -28,7 +28,7 @@
 
     /* well, very crude, but it may work OK */
     if (strstr(cs8(p1->buf), "DocBook"))
-        return 100;
+        return 85;
     return 0;
 }
 

Index: unihex.c
===================================================================
RCS file: /sources/qemacs/qemacs/unihex.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- unihex.c    5 Feb 2014 00:56:50 -0000       1.21
+++ unihex.c    10 Feb 2014 03:24:35 -0000      1.22
@@ -114,7 +114,7 @@
                 offset2 = offset1 = -1;
             }
             ds->cur_hex_mode = s->hex_mode;
-            display_printf(ds, offset1, offset2, "    ");
+            display_printf(ds, offset1, offset2, "%*c", s->unihex_mode, ' ');
             ds->cur_hex_mode = 0;
         }
         if ((j & 7) == 7)
@@ -207,10 +207,16 @@
     buf_printf(out, "--%d%%", compute_percent(s->offset, s->b->total_size));
 }
 
+static int unihex_mode_probe(ModeDef *mode, ModeProbeData *p)
+{
+    /* XXX: should check for non 8 bit characters */
+    return 1;
+}
+
 static ModeDef unihex_mode = {
     .name = "unihex",
     .instance_size = 0,
-    .mode_probe = NULL,
+    .mode_probe = unihex_mode_probe,
     .mode_init = unihex_mode_init,
     .mode_close = text_mode_close,
     .text_display = unihex_display,



reply via email to

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