diff lisp/derived.el @ 13268:6d2b9a2c1ca4

(derived-mode-init-mode-variables): Make proper syntax-table. (derived-mode-merge-syntax-tables): Rewrite using map-char-table.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 Oct 1995 05:20:37 +0000
parents 04c737b6b30e
children 83f275dcd93a
line wrap: on
line diff
--- a/lisp/derived.el	Sat Oct 21 23:17:06 1995 +0000
+++ b/lisp/derived.el	Sun Oct 22 05:20:37 1995 +0000
@@ -221,7 +221,10 @@
   (if (boundp (derived-mode-syntax-table-name mode))
       t
     (eval (` (defvar (, (derived-mode-syntax-table-name mode))
-	       (make-vector 256 nil)
+	       ;; Make a syntax table which doesn't specify anything
+	       ;; for any char.  Valid data will be merged in by
+	       ;; derived-mode-merge-syntax-tables.
+	       (make-char-table 'syntax-table nil)
 	       (, (format "Syntax table for %s." mode)))))
     (put (derived-mode-syntax-table-name mode) 'derived-mode-unmerged t))
 
@@ -327,12 +330,11 @@
 (defun derived-mode-merge-syntax-tables (old new)
   "Merge an old syntax table into a new one.
 Where the new table already has an entry, nothing is copied from the old one."
-  (let ((idx 0)
-	(end (min (length new) (length old))))
-    (while (< idx end)
-      (if (not (aref new idx))
-	  (aset new idx (aref old idx)))
-      (setq idx (1+ idx)))))
+  (map-char-table
+   (function (lambda (key value)
+	       (or (char-table-range new key)
+		   (set-char-table-range new key value))))
+   old))
 
 ;; Merge an old abbrev table into a new one.
 ;; This function requires internal knowledge of how abbrev tables work,