changeset 3067:2f31c7aa4e96

[xemacs-hg @ 2005-11-13 10:57:59 by ben] create describe-char-table syntax.el: Convert describe-syntax-table to more general describe-char-table. (Will also be used by display tables.) Create new describe-syntax-table, compatible with old function, that uses describe-char-table. diagnose.el: Conditionalize `sort-numeric-fields' on when-fboundp.
author ben
date Sun, 13 Nov 2005 10:58:00 +0000
parents a88e6130a523
children 6887e5c9a474
files lisp/ChangeLog lisp/syntax.el
diffstat 2 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 13 10:56:09 2005 +0000
+++ b/lisp/ChangeLog	Sun Nov 13 10:58:00 2005 +0000
@@ -1,3 +1,12 @@
+2005-11-13  Ben Wing  <ben@xemacs.org>
+
+	* syntax.el:
+	* syntax.el (describe-syntax-table): Removed.
+	* syntax.el (describe-char-table): New.
+	Convert describe-syntax-table to more general describe-char-table.
+	(Will also be used by display tables.) Create new describe-syntax-table,
+	compatible with old function, that uses describe-char-table.
+
 2005-11-13  Ben Wing  <ben@xemacs.org>
 
 	* diagnose.el (show-memory-usage):
--- a/lisp/syntax.el	Sun Nov 13 10:56:09 2005 +0000
+++ b/lisp/syntax.el	Sun Nov 13 10:58:00 2005 +0000
@@ -2,6 +2,7 @@
 
 ;; Copyright (C) 1993, 1997 Free Software Foundation, Inc.
 ;; Copyright (C) 1995 Sun Microsystems.
+;; Copyright (C) 2005 Ben Wing.
 
 ;; This file is part of XEmacs.
 
@@ -238,7 +239,11 @@
 ;                           spec (aref o ?a) (aref n ?a))))))))
 
 
-(defun describe-syntax-table (table stream)
+(defun describe-char-table (table mapper describe-value stream)
+"Describe char-table TABLE, outputting to STREAM.
+MAPPER maps over the table and should be `map-char-table' or
+`map-syntax-table'.  DESCRIBE-VALUE is a function of two arguments,
+VALUE and STREAM, and should output a description of VALUE."
   (let (first-char
 	last-char
 	prev-val
@@ -272,7 +277,7 @@
 					 (text-char-description first)
 					 (text-char-description last))
 				 stream))))
-		 (describe-syntax-code value stream))
+		 (funcall describe-value value stream))
 	   #'(lambda (first last value stream)
 	       (let* ((tem (text-char-description first))
 		      (pos (length tem))
@@ -290,8 +295,8 @@
 		 (while (progn (write-char ?\  stream)
 			       (setq pos (1+ pos))
 			       (< pos 16))))
-	       (describe-syntax-code value stream)))))
-    (map-syntax-table
+	       (funcall describe-value value stream)))))
+    (funcall mapper
      #'(lambda (range value)
 	 (cond
 	  ((not first-char)
@@ -321,6 +326,10 @@
     (if first-char
 	(funcall describe-one first-char last-char prev-val stream))))
 
+(defun describe-syntax-table (table stream)
+  "Output a description of TABLE (a syntax table) to STREAM."
+  (describe-char-table table 'map-syntax-table 'describe-syntax-code stream))
+
 (defun describe-syntax-code (code stream)
   (let ((match (and (consp code) (cdr code)))
 	(invalid (gettext "**invalid**")) ;(empty "") ;constants