qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs bufed.c buffer.c dired.c html.c qe.c qe.h


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs bufed.c buffer.c dired.c html.c qe.c qe.h
Date: Sun, 30 Mar 2008 16:10:16 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        08/03/30 16:10:16

Modified files:
        .              : bufed.c buffer.c dired.c html.c qe.c qe.h 

Log message:
        added flag BF_UTF8 so set buffer charset to uft-8 at creation time
        set utf8 charset for buffers:
          *bufed*, *dired*, *xml-error*, *messages, *errors*, *minibuf*, *Help*
        remove BF_SYSTEM bit from buffers *messages*, *error*
        added syntax for messages not stored in *messages*: start message with ~

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/bufed.c?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/qemacs/dired.c?cvsroot=qemacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/qemacs/html.c?cvsroot=qemacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.70&r2=1.71

Patches:
Index: bufed.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/bufed.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- bufed.c     28 Mar 2008 12:23:00 -0000      1.17
+++ bufed.c     30 Mar 2008 16:10:15 -0000      1.18
@@ -173,7 +173,7 @@
 
     /* XXX: must close this buffer when destroying window: add a
        special buffer flag to tell this */
-    b = eb_scratch("*bufed*", BF_READONLY | BF_SYSTEM);
+    b = eb_scratch("*bufed*", BF_READONLY | BF_SYSTEM | BF_UTF8);
 
     width = qs->width / 5;
     e = insert_window_left(b, width, WF_MODELINE);

Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- buffer.c    30 Mar 2008 11:00:07 -0000      1.36
+++ buffer.c    30 Mar 2008 16:10:15 -0000      1.37
@@ -484,8 +484,12 @@
     b->next = *pb;
     *pb = b;
 
+    if (flags & BF_UTF8) {
+        eb_set_charset(b, &charset_utf8);
+    } else {
     /* CG: default charset should be selectable */
     eb_set_charset(b, &charset_8859_1);
+    }
 
     /* add mark move callback */
     eb_add_callback(b, eb_offset_callback, &b->mark);
@@ -890,6 +894,9 @@
         charset_decode_close(&b->charset_state);
     }
     b->charset = charset;
+    b->flags &= ~BF_UTF8;
+    if (charset == &charset_utf8)
+        b->flags |= BF_UTF8;
     charset_decode_init(&b->charset_state, charset);
 }
 

Index: dired.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/dired.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- dired.c     28 Mar 2008 12:26:23 -0000      1.23
+++ dired.c     30 Mar 2008 16:10:15 -0000      1.24
@@ -532,7 +532,7 @@
      */
 
     /* Should reuse previous dired buffer for same filespec */
-    b = eb_scratch("*dired*", BF_READONLY | BF_SYSTEM);
+    b = eb_scratch("*dired*", BF_READONLY | BF_SYSTEM | BF_UTF8);
 
     /* Remember target as current current buffer filename */
     pstrcpy(target, sizeof(target), s->b->filename);

Index: html.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/html.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- html.c      4 Jan 2008 23:04:11 -0000       1.15
+++ html.c      30 Mar 2008 16:10:15 -0000      1.16
@@ -100,7 +100,7 @@
 {
     EditBuffer *b;
 
-    b = eb_find_new(HTML_ERROR_BUFFER, BF_READONLY);
+    b = eb_find_new(HTML_ERROR_BUFFER, BF_READONLY | BF_UTF8);
     if (!b)
         return;
     b->flags &= ~BF_READONLY;

Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- qe.c        30 Mar 2008 12:02:01 -0000      1.73
+++ qe.c        30 Mar 2008 16:10:16 -0000      1.74
@@ -1447,7 +1447,7 @@
         }
     }
     snprintf(bufname, sizeof(bufname), "*kill-%d*", qs->yank_current + 1);
-    b = eb_new(bufname, BF_SYSTEM);
+    b = eb_new(bufname, 0);
     qs->yank_buffers[qs->yank_current] = b;
     return b;
 }
@@ -1813,7 +1813,8 @@
     if (!charset)
         return;
 
-    b1 = eb_new("*tmp*", BF_SYSTEM);
+    b1 = eb_new("*tmp*", 0);
+    eb_set_charset(b1, charset);
 
     /* well, not very fast, but simple */
     b = s->b;
@@ -1823,12 +1824,12 @@
         eb_write(b1, b1->total_size, buf, len);
     }
 
-    /* replace current buffer with convertion */
+    /* replace current buffer with conversion */
     eb_delete(b, 0, b->total_size);
+    eb_set_charset(b, charset);
     eb_insert_buffer(b, 0, b1, 0, b1->total_size);
 
     eb_free(b1);
-    eb_set_charset(b, charset);
 }
 
 void do_toggle_bidir(EditState *s)
@@ -4227,7 +4228,7 @@
             c->buf[len-1] = ' ';
         pstrcat(c->buf, sizeof(c->buf), buf1);
         pstrcat(c->buf, sizeof(c->buf), "-");
-        put_status(s, "%s", c->buf);
+        put_status(s, "~%s", c->buf);
         dpy_flush(&global_screen);
     }
 }
@@ -4278,7 +4279,7 @@
                  qs->ec.function);
         len = strlen(header);
     }
-    eb = eb_find_new(bufname, BF_SYSTEM);
+    eb = eb_find_new(bufname, BF_UTF8);
     if (eb) {
         eb_printf(eb, "%s%s\n", header, message);
     } else {
@@ -4312,18 +4313,21 @@
     vsnprintf(buf, sizeof(buf), fmt, ap);
     va_end(ap);
 
+    p = buf;
+    if (*p == '~')
+        p++;
+
     if (!qs->screen->dpy.dpy_probe) {
-        eb_format_message(qs, "*errors*", buf);
+        eb_format_message(qs, "*errors*", p);
     } else {
-        if (!strequal(buf, qs->status_shadow)) {
+        if (!strequal(p, qs->status_shadow)) {
             print_at_byte(qs->screen,
                           0, qs->screen->height - qs->status_height,
                           qs->screen->width, qs->status_height,
-                          buf, QE_STYLE_STATUS);
-            strcpy(qs->status_shadow, buf);
-            p = buf;
+                          p, QE_STYLE_STATUS);
+            strcpy(qs->status_shadow, p);
             skip_spaces(&p);
-            if (*p)
+            if (*p && *buf != '~')
                 eb_format_message(qs, "*messages*", buf);
         }
     }
@@ -4939,7 +4943,7 @@
     minibuffer_cb = cb;
     minibuffer_opaque = opaque;
 
-    b = eb_new("*minibuf*", BF_SYSTEM | BF_SAVELOG);
+    b = eb_new("*minibuf*", BF_SYSTEM | BF_SAVELOG | BF_UTF8);
 
     s = edit_new(b, 0, qs->screen->height - qs->status_height,
                  qs->screen->width, qs->status_height, 0);
@@ -6456,7 +6460,7 @@
     if (b) {
         eb_delete(b, 0, b->total_size);
     } else {
-        b = eb_new("*Help*", BF_SYSTEM);
+        b = eb_new("*Help*", BF_UTF8);
         *show_ptr = 1;
     }
     return b;

Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- qe.h        30 Mar 2008 12:02:01 -0000      1.70
+++ qe.h        30 Mar 2008 16:10:16 -0000      1.71
@@ -681,6 +681,8 @@
 #define BF_LOADING   0x0010  /* buffer is being loaded */
 #define BF_SAVING    0x0020  /* buffer is being saved */
 #define BF_DIRED     0x0100  /* buffer is interactive dired */
+#define BF_UTF8      0x0200  /* buffer charset is utf-8 */
+#define BF_RAW       0x0400  /* buffer charset is raw (same as latin1) */
 
 struct EditBuffer {
     Page *page_table;




reply via email to

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