- (let ((vector (make-vector 256 nil))
- (case-table (current-case-table))
- (i 0))
- (while (< i 256)
- (aset vector i
- (cond ((/= ch (downcase ch))
- (concat "uppercase, matches "
- (text-char-description (downcase ch))))
- ((/= ch (upcase ch))
- (concat "lowercase, matches "
- (text-char-description (upcase ch))))
- (t "case-invariant")))
- (setq i (1+ i))))
- (with-output-to-temp-buffer "*Help*"
- (describe-vector vector)))
-
-(defun set-case-syntax-delims (l r string)
+ (let ((description (make-char-table 'case-table)))
+ (map-char-table
+ (function (lambda (key value)
+ (aset
+ description key
+ (cond ((not (natnump value))
+ "case-invariant")
+ ((/= key (downcase key))
+ (concat "uppercase, matches "
+ (char-to-string (downcase key))))
+ ((/= key (upcase key))
+ (concat "lowercase, matches "
+ (char-to-string (upcase key))))
+ (t "case-invariant")))))
+ (current-case-table))
+ (save-excursion
+ (with-output-to-temp-buffer "*Help*"
+ (set-buffer standard-output)
+ (describe-vector description)
+ (help-mode)))))
+
+(defun copy-case-table (case-table)
+ (let ((copy (copy-sequence case-table)))
+ ;; Clear out the extra slots so that they will be
+ ;; recomputed from the main (downcase) table.
+ (set-char-table-extra-slot copy 0 nil)
+ (set-char-table-extra-slot copy 1 nil)
+ (set-char-table-extra-slot copy 2 nil)
+ copy))
+
+(defsubst set-case-syntax-1 (char)
+ "Offset CHAR by `set-case-syntax-offset' if CHAR is a non-ASCII 8-bit char."
+ (if (and (>= char 128) (< char 256))
+ (+ char set-case-syntax-offset)
+ char))
+
+(defun set-case-syntax-delims (l r table)