* gnus-util.el (gnus-put-display-table, gnus-get-display-table): New
authorReiner Steib <Reiner.Steib@gmx.de>
Sat, 14 Jun 2008 15:45:03 +0000 (15:45 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Sat, 14 Jun 2008 15:45:03 +0000 (15:45 +0000)
macros that expand to an `aset'/`aref' call under Emacs, and to a
runtime choice under XEmacs.

* gnus-sum.el (gnus-summary-set-display-table): Use
`gnus-put-display-table', `gnus-get-display-table',
`gnus-set-display-table' for the display table, instead of `aset'.

* gnus-xmas.el (gnus-xmas-summary-set-display-table): Use
`gnus-put-display-table', `gnus-get-display-table',
`gnus-set-display-table' for the display table.

lisp/ChangeLog
lisp/gnus-sum.el
lisp/gnus-util.el
lisp/gnus-xmas.el

index 18b2b71..5832f79 100644 (file)
@@ -1,3 +1,17 @@
+2008-06-14  Aidan Kehoe  <kehoea@parhasard.net>
+
+       * gnus-util.el (gnus-put-display-table, gnus-get-display-table): New
+       macros that expand to an `aset'/`aref' call under Emacs, and to a
+       runtime choice under XEmacs.
+
+       * gnus-sum.el (gnus-summary-set-display-table): Use
+       `gnus-put-display-table', `gnus-get-display-table',
+       `gnus-set-display-table' for the display table, instead of `aset'.
+
+       * gnus-xmas.el (gnus-xmas-summary-set-display-table): Use
+       `gnus-put-display-table', `gnus-get-display-table',
+       `gnus-set-display-table' for the display table.
+
 2008-06-14  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * nnmairix.el: Add autoloads.
index 276b205..ba29ba6 100644 (file)
@@ -3420,13 +3420,13 @@ display only a single character."
        (i 32))
     ;; Nix out all the control chars...
     (while (>= (setq i (1- i)) 0)
-      (aset table i [??]))
+      (gnus-put-display-table i [??] table))
    ;; ... but not newline and cr, of course.  (cr is necessary for the
     ;; selective display).
-    (aset table ?\n nil)
-    (aset table ?\r nil)
+    (gnus-put-display-table ?\n nil table)
+    (gnus-put-display-table ?\r nil table)
     ;; We keep TAB as well.
-    (aset table ?\t nil)
+    (gnus-put-display-table ?\t nil table)
     ;; We nix out any glyphs 127 through 255, or 127 through 159 in
     ;; Emacs 23 (unicode), that are not set already.
     (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
@@ -3434,8 +3434,8 @@ display only a single character."
               256)))
       (while (>= (setq i (1- i)) 127)
        ;; Only modify if the entry is nil.
-       (unless (aref table i)
-         (aset table i [??]))))
+       (unless (gnus-get-display-table i table)
+         (gnus-put-display-table i [??] table))))
     (setq buffer-display-table table)))
 
 (defun gnus-summary-set-article-display-arrow (pos)
index 110e2e0..8d86c36 100644 (file)
@@ -1801,6 +1801,27 @@ is allowed once again.  (Immediately, if `inhibit-quit' is nil.)"
 (defalias 'gnus-read-shell-command
   (if (fboundp 'read-shell-command) 'read-shell-command 'read-string))
 
+(defmacro gnus-put-display-table (range value display-table)
+  "Set the value for char RANGE to VALUE in DISPLAY-TABLE.  "
+  (if (featurep 'xemacs)
+      (progn
+        `(if (fboundp 'put-display-table)
+          (put-display-table ,range ,value ,display-table)
+          (if (sequencep ,display-table)
+              (aset ,display-table ,range ,value)
+            (put-char-table ,range ,value ,display-table))))
+    `(aset ,display-table ,range ,value)))
+
+(defmacro gnus-get-display-table (character display-table)
+  "Find value for CHARACTER in DISPLAY-TABLE.  "
+  (if (featurep 'xemacs)
+      `(if (fboundp 'get-display-table)
+          (get-display-table ,character ,display-table)
+          (if (sequencep ,display-table)
+              (aref ,display-table ,character)
+            (get-char-table ,character ,display-table)))
+    `(aref ,display-table ,character)))
+
 (provide 'gnus-util)
 
 ;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49
index 1f60441..2389ea4 100644 (file)
@@ -39,6 +39,7 @@
 (defvar menu-bar-mode (featurep 'menubar))
 (require 'messagexmas)
 (require 'wid-edit)
+(require 'gnus-util)
 
 (defgroup gnus-xmas nil
   "XEmacsoid support for Gnus"
@@ -173,18 +174,18 @@ displayed, no centering will be performed."
        (i 32))
     ;; Nix out all the control chars...
     (while (>= (setq i (1- i)) 0)
-      (aset table i [??]))
+      (gnus-put-display-table i [??] table))
     ;; ... but not newline and cr, of course.  (cr is necessary for the
     ;; selective display).
-    (aset table ?\n nil)
-    (aset table ?\r nil)
+    (gnus-put-display-table ?\n nil table)
+    (gnus-put-display-table ?\r nil table)
     ;; We keep TAB as well.
-    (aset table ?\t nil)
+    (gnus-put-display-table ?\t nil table)
     ;; We nix out any glyphs over 126 below ctl-arrow.
     (let ((i (if (integerp ctl-arrow) ctl-arrow 160)))
       (while (>= (setq i (1- i)) 127)
-       (unless (aref table i)
-         (aset table i [??]))))
+       (unless (gnus-get-display-table i table)
+         (gnus-put-display-table i [??] table))))
     ;; Can't use `set-specifier' because of a bug in 19.14 and earlier
     (add-spec-to-specifier current-display-table table (current-buffer) nil)))