annotate lisp/case-table.el @ 110236:6c9f59d296d3

Merge changes from emacs-23 branch.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 06 Sep 2010 12:38:03 -0400
parents 280c8ae2476d
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 19247
diff changeset
1 ;;; case-table.el --- code to extend the character set and support case tables
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
2
74439
ddcbd2c1b70d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
3 ;; Copyright (C) 1988, 1994, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 103946
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
5
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
6 ;; Author: Howard Gayle
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
7 ;; Maintainer: FSF
3012
d4b85bbedee8 Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents: 2386
diff changeset
8 ;; Keywords: i18n
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
9 ;; Package: emacs
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
26 ;;; Commentary:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
27
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28 ;; Written by:
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
31 ;; Ericsson Telecom Telex: 14910 ERIC S
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 ;; S-126 25 Stockholm FAX : +46 8 719 64 82
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33 ;; Sweden
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
35 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
36
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 (defun describe-buffer-case-table ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 "Describe the case table of the current buffer."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 (interactive)
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
40 (let ((description (make-char-table 'case-table)))
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
41 (map-char-table
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
42 (function (lambda (key value)
103946
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
43 (if (not (natnump value))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
44 (if (consp key)
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
45 (set-char-table-range description key "case-invariant")
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
46 (aset description key "case-invariant"))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
47 (let (from to)
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
48 (if (consp key)
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
49 (setq from (car key) to (cdr key))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
50 (setq from (setq to key)))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
51 (while (<= from to)
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
52 (aset
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
53 description from
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
54 (cond ((/= from (downcase from))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
55 (concat "uppercase, matches "
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
56 (char-to-string (downcase from))))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
57 ((/= from (upcase from))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
58 (concat "lowercase, matches "
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
59 (char-to-string (upcase from))))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
60 (t "case-invariant")))
774187433685 (describe-buffer-case-table): Fix for the case that KEY is a cons.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
61 (setq from (1+ from)))))))
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
62 (current-case-table))
3550
0d8c66f2e25e (describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents: 3012
diff changeset
63 (save-excursion
0d8c66f2e25e (describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents: 3012
diff changeset
64 (with-output-to-temp-buffer "*Help*"
0d8c66f2e25e (describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents: 3012
diff changeset
65 (set-buffer standard-output)
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
66 (describe-vector description)
9858
0e4831555b2c (describe-buffer-case-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 7300
diff changeset
67 (help-mode)))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
69 (defun get-upcase-table (case-table)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
70 "Return the upcase table of CASE-TABLE."
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
71 (or (char-table-extra-slot case-table 0)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
72 ;; Setup all extra slots of CASE-TABLE by temporarily selecting
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
73 ;; it as the standard case table.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
74 (let ((old (standard-case-table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
75 (unwind-protect
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
76 (progn
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
77 (set-standard-case-table case-table)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
78 (char-table-extra-slot case-table 0))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
79 (or (eq case-table old)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
80 (set-standard-case-table old))))))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
81
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
82 (defun copy-case-table (case-table)
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
83 (let ((copy (copy-sequence case-table))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
84 (up (char-table-extra-slot case-table 0)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
85 ;; Clear out the extra slots (except for upcase table) so that
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
86 ;; they will be recomputed from the main (downcase) table.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
87 (if up
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
88 (set-char-table-extra-slot copy 0 (copy-sequence up)))
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
89 (set-char-table-extra-slot copy 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
90 (set-char-table-extra-slot copy 2 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
91 copy))
17313
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
92
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
93 (defun set-case-syntax-delims (l r table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 "Make characters L and R a matching pair of non-case-converting delimiters.
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
95 This sets the entries for L and R in TABLE, which is a string
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
96 that will be used as the downcase part of a case table.
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
97 It also modifies `standard-syntax-table' to
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
98 indicate left and right delimiters."
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
99 (aset table l l)
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
100 (aset table r r)
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
101 (let ((up (get-upcase-table table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
102 (aset up l l)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
103 (aset up r r))
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
104 ;; Clear out the extra slots so that they will be
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
105 ;; recomputed from the main (downcase) table and upcase table.
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
106 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
107 (set-char-table-extra-slot table 2 nil)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
108 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
109 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
111 (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
112
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
113 (defun set-case-syntax-pair (uc lc table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114 "Make characters UC and LC a pair of inter-case-converting letters.
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
115 This sets the entries for characters UC and LC in TABLE, which is a string
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
116 that will be used as the downcase part of a case table.
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
117 It also modifies `standard-syntax-table' to give them the syntax of
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
118 word constituents."
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
119 (aset table uc lc)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
120 (aset table lc lc)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
121 (let ((up (get-upcase-table table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
122 (aset up uc uc)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
123 (aset up lc uc))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
124 ;; Clear out the extra slots so that they will be
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
125 ;; recomputed from the main (downcase) table and upcase table.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
126 (set-char-table-extra-slot table 1 nil)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
127 (set-char-table-extra-slot table 2 nil)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
128 (modify-syntax-entry lc "w " (standard-syntax-table))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
129 (modify-syntax-entry uc "w " (standard-syntax-table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
130
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
131 (defun set-upcase-syntax (uc lc table)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
132 "Make character UC an upcase of character LC.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
133 It also modifies `standard-syntax-table' to give them the syntax of
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
134 word constituents."
59860
f4eeaf4ca800 (set-upcase-syntax, set-downcase-syntax): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 59855
diff changeset
135 (aset table lc lc)
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
136 (let ((up (get-upcase-table table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
137 (aset up uc uc)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
138 (aset up lc uc))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
139 ;; Clear out the extra slots so that they will be
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
140 ;; recomputed from the main (downcase) table and upcase table.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
141 (set-char-table-extra-slot table 1 nil)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
142 (set-char-table-extra-slot table 2 nil)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
143 (modify-syntax-entry lc "w " (standard-syntax-table))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
144 (modify-syntax-entry uc "w " (standard-syntax-table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
145
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
146 (defun set-downcase-syntax (uc lc table)
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
147 "Make character LC a downcase of character UC.
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
148 It also modifies `standard-syntax-table' to give them the syntax of
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
149 word constituents."
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
150 (aset table uc lc)
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
151 (aset table lc lc)
59860
f4eeaf4ca800 (set-upcase-syntax, set-downcase-syntax): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 59855
diff changeset
152 (let ((up (get-upcase-table table)))
f4eeaf4ca800 (set-upcase-syntax, set-downcase-syntax): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 59855
diff changeset
153 (aset up uc uc))
59659
030542bf12bf Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
154 ;; Clear out the extra slots so that they will be
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
155 ;; recomputed from the main (downcase) table and upcase table.
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
156 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
157 (set-char-table-extra-slot table 2 nil)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (modify-syntax-entry lc "w " (standard-syntax-table))
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
159 (modify-syntax-entry uc "w " (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
161 (defun set-case-syntax (c syntax table)
17313
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
162 "Make character C case-invariant with syntax SYNTAX.
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
163 This sets the entry for character C in TABLE, which is a string
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
164 that will be used as the downcase part of a case table.
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
165 It also modifies `standard-syntax-table'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
167 (aset table c c)
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
168 (let ((up (get-upcase-table table)))
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
169 (aset up c c))
59659
030542bf12bf Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
170 ;; Clear out the extra slots so that they will be
59855
e1f57074406e (get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents: 59659
diff changeset
171 ;; recomputed from the main (downcase) table and upcase table.
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
172 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
173 (set-char-table-extra-slot table 2 nil)
7156
4d86978056b1 (describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents: 3550
diff changeset
174 (modify-syntax-entry c syntax (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 (provide 'case-table)
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
177
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91327
diff changeset
178 ;; arch-tag: 3c2cf885-2c9a-449a-9972-2e269191896d
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
179 ;;; case-table.el ends here