Commits

kupfer  committed 3d64816 Merge

Aidan Kehoe's patch to define and use {get,put}-display-table
("Abstract out a display-table-specific API (2)",
<18288.3344.67997.394271@parhasard.net>).

  • Participants
  • Parent commits abf1a87, 6b08236

Comments (0)

Files changed (3)

+2007-12-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* lisp/gnus-sum.el:
+	* lisp/gnus-sum.el (put-display-table): New.
+	* lisp/gnus-sum.el (get-display-table): New.
+	Provide with #'defun-when-void, so as to not override the 21.5
+	implementation. 
+	* lisp/gnus-sum.el (gnus-summary-set-display-table):
+	* lisp/gnus-xmas.el (gnus-xmas-summary-set-display-table):
+	Use #'put-display-table, not #'aref, to deal with the case where
+	the display table is a char table and not a vector. 
+
 2007-03-06  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.91 released.

File lisp/gnus-sum.el

 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
 
+(defun-when-void put-display-table (range value display-table)
+  "Set the value for char RANGE to VALUE in DISPLAY-TABLE.  "
+  (ecase (type-of display-table)
+    (vector
+     (aset display-table range value))
+    (char-table
+     (put-char-table range value display-table))))
+
+(defun-when-void get-display-table (character display-table)
+  "Find value for CHARACTER in DISPLAY-TABLE.  "
+  (ecase (type-of display-table)
+    (vector
+     (aref display-table character))
+    (char-table
+     (get-char-table character display-table))))
+
 (defcustom gnus-kill-summary-on-exit t
   "*If non-nil, kill the summary buffer when you exit from it.
 If nil, the summary will become a \"*Dead Summary*\" buffer, and
 	(i 32))
     ;; Nix out all the control chars...
     (while (>= (setq i (1- i)) 0)
-      (aset table i [??]))
+      (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)
+    (put-display-table ?\n nil table)
+    (put-display-table ?\r nil table)
     ;; We keep TAB as well.
-    (aset table ?\t nil)
+    (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))
 	       256)))
       (while (>= (setq i (1- i)) 127)
 	;; Only modify if the entry is nil.
-	(unless (aref table i)
-	  (aset table i [??]))))
+	(unless (get-display-table i table)
+	  (put-display-table i [??] table))))
     (setq buffer-display-table table)))
 
 (defun gnus-summary-set-article-display-arrow (pos)

File lisp/gnus-xmas.el

 	(i 32))
     ;; Nix out all the control chars...
     (while (>= (setq i (1- i)) 0)
-      (aset table i [??]))
+      (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)
+    (put-display-table ?\n nil table)
+    (put-display-table ?\r nil table)
     ;; We keep TAB as well.
-    (aset table ?\t nil)
+    (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 (get-display-table i table)
+	  (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)))