emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103944: Allow glyphless-char-display


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103944: Allow glyphless-char-display to distinguish between X and text terminals.
Date: Mon, 18 Apr 2011 19:21:31 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 103944
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Mon 2011-04-18 19:21:31 -0400
message:
  Allow glyphless-char-display to distinguish between X and text terminals.
  Use this for Tabulated List mode.
  
  * lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Use a custom
  glyphless-char-display table.
  (tabulated-list-glyphless-char-display): New var.
  
  * src/term.c (produce_glyphless_glyph): Handle cons cell entry in
  glyphless-char-display.
  
  * src/xdisp.c (lookup_glyphless_char_display)
  (produce_glyphless_glyph): Handle cons cell entry in
  glyphless-char-display.
  (Vglyphless_char_display): Document it.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/emacs-lisp/tabulated-list.el
  src/ChangeLog
  src/term.c
  src/xdisp.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-04-12 03:55:07 +0000
+++ b/etc/NEWS  2011-04-18 23:21:31 +0000
@@ -779,6 +779,9 @@
 
 * Lisp changes in Emacs 24.1
 
+** `glyphless-char-table' can now distinguish between graphical and
+text terminal display, via a char-table entry that is a cons cell.
+
 ** `open-network-stream' can now be used to open an encrypted stream.
 It now accepts an optional `:type' parameter for initiating a TLS
 connection, directly or via STARTTLS.  To do STARTTLS, additional

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-18 20:35:18 +0000
+++ b/lisp/ChangeLog    2011-04-18 23:21:31 +0000
@@ -1,3 +1,9 @@
+2011-04-18  Chong Yidong  <address@hidden>
+
+       * emacs-lisp/tabulated-list.el (tabulated-list-mode): Use a custom
+       glyphless-char-display table.
+       (tabulated-list-glyphless-char-display): New var.
+
 2011-04-18  Sam Steingold  <address@hidden>
 
        * vc/add-log.el (change-log-font-lock-keywords): Add "Thanks to"

=== modified file 'lisp/emacs-lisp/tabulated-list.el'
--- a/lisp/emacs-lisp/tabulated-list.el 2011-04-10 14:21:26 +0000
+++ b/lisp/emacs-lisp/tabulated-list.el 2011-04-18 23:21:31 +0000
@@ -143,6 +143,15 @@
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
 
+(defvar tabulated-list-glyphless-char-display
+  (let ((table (make-char-table 'glyphless-char-display nil)))
+    (set-char-table-parent table glyphless-char-display)
+    ;; Some text terminals can't display the unicode arrows; be safe.
+    (aset table 9650 (cons nil "^"))
+    (aset table 9660 (cons nil "v"))
+    table)
+  "The `glyphless-char-display' table in Tabulated List buffers.")
+
 (defun tabulated-list-init-header ()
   "Set up header line for the Tabulated List buffer."
   (let ((x tabulated-list-padding)
@@ -341,7 +350,9 @@
   (setq truncate-lines t)
   (setq buffer-read-only t)
   (set (make-local-variable 'revert-buffer-function)
-       'tabulated-list-revert))
+       'tabulated-list-revert)
+  (set (make-local-variable 'glyphless-char-display)
+       tabulated-list-glyphless-char-display))
 
 (put 'tabulated-list-mode 'mode-class 'special)
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-04-17 18:40:55 +0000
+++ b/src/ChangeLog     2011-04-18 23:21:31 +0000
@@ -1,3 +1,13 @@
+2011-04-18  Chong Yidong  <address@hidden>
+
+       * xdisp.c (lookup_glyphless_char_display)
+       (produce_glyphless_glyph): Handle cons cell entry in
+       glyphless-char-display.
+       (Vglyphless_char_display): Document it.
+
+       * term.c (produce_glyphless_glyph): Handle cons cell entry in
+       glyphless-char-display.
+
 2011-04-17  Chong Yidong  <address@hidden>
 
        * xdisp.c (get_next_display_element): Remove unnecessary ifdefs.

=== modified file 'src/term.c'
--- a/src/term.c        2011-04-14 05:04:02 +0000
+++ b/src/term.c        2011-04-18 23:21:31 +0000
@@ -1936,6 +1936,8 @@
        {
          if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
            acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
+         if (CONSP (acronym))
+           acronym = XCDR (acronym);
          buf[0] = '[';
          str = STRINGP (acronym) ? SSDATA (acronym) : "";
          for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-04-17 18:40:55 +0000
+++ b/src/xdisp.c       2011-04-18 23:21:31 +0000
@@ -5540,9 +5540,19 @@
 
   if (CHAR_TABLE_P (Vglyphless_char_display)
       && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
-    glyphless_method = (c >= 0
-                       ? CHAR_TABLE_REF (Vglyphless_char_display, c)
-                       : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
+    {
+      if (c >= 0)
+       {
+         glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c);
+         if (CONSP (glyphless_method))
+           glyphless_method = FRAME_WINDOW_P (it->f)
+             ? XCAR (glyphless_method)
+             : XCDR (glyphless_method);
+       }
+      else
+       glyphless_method = XCHAR_TABLE (Vglyphless_char_display)->extras[0];
+    }
+
  retry:
   if (NILP (glyphless_method))
     {
@@ -22315,6 +22325,8 @@
        {
          if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
            acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
+         if (CONSP (acronym))
+           acronym = XCAR (acronym);
          str = STRINGP (acronym) ? SSDATA (acronym) : "";
        }
       else
@@ -26950,17 +26962,21 @@
   Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1));
 
   DEFVAR_LISP ("glyphless-char-display", Vglyphless_char_display,
-              doc: /* Char-table to control displaying of glyphless characters.
-Each element, if non-nil, is an ASCII acronym string (displayed in a box)
-or one of these symbols:
-  hex-code:   display the hexadecimal code of a character in a box
-  empty-box:  display as an empty box
-  thin-space: display as 1-pixel width space
-  zero-width: don't display
+              doc: /* Char-table defining glyphless characters.
+Each element, if non-nil, should be one of the following:
+  an ASCII acronym string: display this string in a box
+  `hex-code':   display the hexadecimal code of a character in a box
+  `empty-box':  display as an empty box
+  `thin-space': display as 1-pixel width space
+  `zero-width': don't display
+An element may also be a cons cell (GRAPHICAL . TEXT), which specifies the
+display method for graphical terminals and text terminals respectively.
+GRAPHICAL and TEXT should each have one of the values listed above.
 
-It has one extra slot to control the display of a character for which
-no font is found.  The value of the slot is `hex-code' or `empty-box'.
-The default is `empty-box'.  */);
+The char-table has one extra slot to control the display of a character for
+which no font is found.  This slot only takes effect on graphical terminals.
+Its value should be an ASCII acronym string, `hex-code', `empty-box', or
+`thin-space'.  The default is `empty-box'.  */);
   Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
   Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
                              Qempty_box);


reply via email to

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