Mercurial > emacs
annotate lisp/case-table.el @ 75351:d97f8034c795
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 21 Jan 2007 09:07:59 +0000 |
parents | e3694f1cb928 |
children | 9355f9b7bbff 95d0cdf160ea |
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 | 3 ;; Copyright (C) 1988, 1994, 2001, 2002, 2003, 2004, |
75347 | 4 ;; 2005, 2006, 2007 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 |
36 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
36 | 26 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
27 ;;; Commentary: |
36 | 28 |
29 ;; Written by: | |
30 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard | |
31 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65 | |
32 ;; Ericsson Telecom Telex: 14910 ERIC S | |
33 ;; S-126 25 Stockholm FAX : +46 8 719 64 82 | |
34 ;; Sweden | |
35 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
36 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
37 |
17860
99adb4d59379
(set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17313
diff
changeset
|
38 (defvar set-case-syntax-offset 0) |
99adb4d59379
(set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17313
diff
changeset
|
39 |
17972
79911e7f54fe
(set-case-syntax-set-multibyte): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17934
diff
changeset
|
40 (defvar set-case-syntax-set-multibyte nil) |
79911e7f54fe
(set-case-syntax-set-multibyte): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17934
diff
changeset
|
41 |
36 | 42 (defun describe-buffer-case-table () |
43 "Describe the case table of the current buffer." | |
44 (interactive) | |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
45 (let ((description (make-char-table 'case-table))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
46 (map-char-table |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
47 (function (lambda (key value) |
17986
43fa316b0eca
(describe-buffer-case-table): Use aref instead of
Kenichi Handa <handa@m17n.org>
parents:
17972
diff
changeset
|
48 (aset |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
49 description key |
17986
43fa316b0eca
(describe-buffer-case-table): Use aref instead of
Kenichi Handa <handa@m17n.org>
parents:
17972
diff
changeset
|
50 (cond ((not (natnump value)) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
51 "case-invariant") |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
52 ((/= key (downcase key)) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
53 (concat "uppercase, matches " |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
54 (char-to-string (downcase key)))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
55 ((/= key (upcase key)) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
56 (concat "lowercase, matches " |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
57 (char-to-string (upcase key)))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
58 (t "case-invariant"))))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
59 (current-case-table)) |
3550
0d8c66f2e25e
(describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents:
3012
diff
changeset
|
60 (save-excursion |
0d8c66f2e25e
(describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents:
3012
diff
changeset
|
61 (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
|
62 (set-buffer standard-output) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
63 (describe-vector description) |
9858
0e4831555b2c
(describe-buffer-case-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
64 (help-mode))))) |
36 | 65 |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
66 (defun get-upcase-table (case-table) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
67 "Return the upcase table of CASE-TABLE." |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
68 (or (char-table-extra-slot case-table 0) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
69 ;; 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
|
70 ;; it as the standard case table. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
71 (let ((old (standard-case-table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
72 (unwind-protect |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
73 (progn |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
74 (set-standard-case-table case-table) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
75 (char-table-extra-slot case-table 0)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
76 (or (eq case-table old) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
77 (set-standard-case-table old)))))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
78 |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
79 (defun copy-case-table (case-table) |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
80 (let ((copy (copy-sequence case-table)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
81 (up (char-table-extra-slot case-table 0))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
82 ;; 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
|
83 ;; they will be recomputed from the main (downcase) table. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
84 (if up |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
85 (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
|
86 (set-char-table-extra-slot copy 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
87 (set-char-table-extra-slot copy 2 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
88 copy)) |
17313 | 89 |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
90 (defsubst set-case-syntax-1 (char) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
91 "Offset CHAR by `set-case-syntax-offset' if CHAR is a non-ASCII 8-bit char." |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
92 (if (and (>= char 128) (< char 256)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
93 (+ char set-case-syntax-offset) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
94 char)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
95 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
96 (defun set-case-syntax-delims (l r table) |
36 | 97 "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
|
98 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
|
99 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
|
100 It also modifies `standard-syntax-table' to |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
101 indicate left and right delimiters." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
102 (setq l (set-case-syntax-1 l)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
103 (setq r (set-case-syntax-1 r)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
104 (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
|
105 (aset table r r) |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
106 (let ((up (get-upcase-table table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
107 (aset up l l) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
108 (aset up r r)) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
109 ;; 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
|
110 ;; 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
|
111 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
112 (set-char-table-extra-slot table 2 nil) |
36 | 113 (modify-syntax-entry l (concat "(" (char-to-string r) " ") |
114 (standard-syntax-table)) | |
115 (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
|
116 (standard-syntax-table))) |
36 | 117 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
118 (defun set-case-syntax-pair (uc lc table) |
36 | 119 "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
|
120 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
|
121 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
|
122 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
|
123 word constituents." |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
124 (setq uc (set-case-syntax-1 uc)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
125 (setq lc (set-case-syntax-1 lc)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
126 (aset table uc lc) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
127 (aset table lc lc) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
128 (let ((up (get-upcase-table table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
129 (aset up uc uc) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
130 (aset up lc uc)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
131 ;; 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
|
132 ;; recomputed from the main (downcase) table and upcase table. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
133 (set-char-table-extra-slot table 1 nil) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
134 (set-char-table-extra-slot table 2 nil) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
135 (modify-syntax-entry lc "w " (standard-syntax-table)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
136 (modify-syntax-entry uc "w " (standard-syntax-table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
137 |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
138 (defun set-upcase-syntax (uc lc table) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
139 "Make character UC an upcase of character LC. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
140 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
|
141 word constituents." |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
142 (setq uc (set-case-syntax-1 uc)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
143 (setq lc (set-case-syntax-1 lc)) |
59860
f4eeaf4ca800
(set-upcase-syntax, set-downcase-syntax): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
59855
diff
changeset
|
144 (aset table lc lc) |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
145 (let ((up (get-upcase-table table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
146 (aset up uc uc) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
147 (aset up lc uc)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
148 ;; 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
|
149 ;; recomputed from the main (downcase) table and upcase table. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
150 (set-char-table-extra-slot table 1 nil) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
151 (set-char-table-extra-slot table 2 nil) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
152 (modify-syntax-entry lc "w " (standard-syntax-table)) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
153 (modify-syntax-entry uc "w " (standard-syntax-table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
154 |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
155 (defun set-downcase-syntax (uc lc table) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
156 "Make character LC a downcase of character UC. |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
157 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
|
158 word constituents." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
159 (setq uc (set-case-syntax-1 uc)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
160 (setq lc (set-case-syntax-1 lc)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
161 (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
|
162 (aset table lc lc) |
59860
f4eeaf4ca800
(set-upcase-syntax, set-downcase-syntax): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
59855
diff
changeset
|
163 (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
|
164 (aset up uc uc)) |
59659 | 165 ;; 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
|
166 ;; 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
|
167 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
168 (set-char-table-extra-slot table 2 nil) |
36 | 169 (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
|
170 (modify-syntax-entry uc "w " (standard-syntax-table))) |
36 | 171 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
172 (defun set-case-syntax (c syntax table) |
17313 | 173 "Make character C case-invariant with syntax SYNTAX. |
174 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
|
175 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
|
176 It also modifies `standard-syntax-table'. |
36 | 177 SYNTAX should be \" \", \"w\", \".\" or \"_\"." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
178 (setq c (set-case-syntax-1 c)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
179 (aset table c c) |
59855
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
180 (let ((up (get-upcase-table table))) |
e1f57074406e
(get-upcase-table): New function.
Kenichi Handa <handa@m17n.org>
parents:
59659
diff
changeset
|
181 (aset up c c)) |
59659 | 182 ;; 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
|
183 ;; 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
|
184 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
185 (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
|
186 (modify-syntax-entry c syntax (standard-syntax-table))) |
36 | 187 |
188 (provide 'case-table) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
189 |
52401 | 190 ;;; arch-tag: 3c2cf885-2c9a-449a-9972-2e269191896d |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
191 ;;; case-table.el ends here |