Gnus development mailing list
 help / color / mirror / Atom feed
From: Aidan Kehoe <kehoea@parhasard.net>
To: ding@gnus.org
Cc: xemacs-patches@xemacs.org
Subject: [PATCH] Support opaque display-table objects on XEmacs
Date: Thu, 22 May 2008 00:57:07 +0200	[thread overview]
Message-ID: <18484.43203.462970.885072@parhasard.net> (raw)


Hi, 

This patch adds support for the non-sequence display tables of XEmacs 21.5,
without any run-time overhead on GNU. A patch that’s equivalent in
functionality for that version has been integrated into the XEmacs package
repository; this conflicts with that, though--sorry Mike!--and is more
compatible with GNU. I’ve tested this (somewhat superficially) with XEmacs
21.5, 21.4 and GNU.

Please advise me if this is the wrong list to submit this to. I have papers
on file with the FSF for Gnus and for GNU Emacs as a whole, so that
shouldn’t be an issue.

Bye, 

Aidan

ChangeLog addition: 

2008-05-22  Aidan Kehoe  <kehoea@parhasard.net>

	* gnus-util.el (gnus-put-display-table): New.
	(gnus-get-display-table): New. 
	Macros that expand to an #'aset call under GNU, and to a runtime choice
	under XEmacs. 
	* gnus-sum.el (gnus-summary-set-display-table): 
	Use #'gnus-{put,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,get}-display-table, gnus-set-display-table for the
	display table.


Index: lisp/gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 7.226
diff -u -r7.226 gnus-sum.el
--- lisp/gnus-sum.el	19 May 2008 08:47:42 -0000	7.226
+++ lisp/gnus-sum.el	21 May 2008 22:54:32 -0000
@@ -3417,13 +3417,13 @@
 	(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))
@@ -3431,8 +3431,8 @@
 	       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)
Index: lisp/gnus-util.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-util.el,v
retrieving revision 7.80
diff -u -r7.80 gnus-util.el
--- lisp/gnus-util.el	19 May 2008 08:47:42 -0000	7.80
+++ lisp/gnus-util.el	21 May 2008 22:54:32 -0000
@@ -1798,6 +1798,27 @@
 	     ;; that intends to handle the quit signal next time.
 	     (eval '(ignore nil))))))
 
+(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 ,char-table)))
+
 (provide 'gnus-util)
 
 ;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49
Index: lisp/gnus-xmas.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-xmas.el,v
retrieving revision 7.25
diff -u -r7.25 gnus-xmas.el
--- lisp/gnus-xmas.el	10 Mar 2008 00:53:11 -0000	7.25
+++ lisp/gnus-xmas.el	21 May 2008 22:54:32 -0000
@@ -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 @@
 	(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)))

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?

             reply	other threads:[~2008-05-21 22:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 22:57 Aidan Kehoe [this message]
2008-05-22  3:31 ` Miles Bader
2008-05-27 20:34   ` Reiner Steib
2008-05-27 21:02     ` Aidan Kehoe
2008-05-27 21:21       ` Reiner Steib
2008-06-09 20:03       ` [PATCH] Support opaque display-table objects on XEmacs (revised) Aidan Kehoe
2008-06-14 15:48         ` Reiner Steib

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18484.43203.462970.885072@parhasard.net \
    --to=kehoea@parhasard.net \
    --cc=ding@gnus.org \
    --cc=xemacs-patches@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).