annotate lisp/case-table.el @ 17973:52395fdffffe

(webjump-adult-p): Function deleted.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 May 1997 16:20:16 +0000
parents 79911e7f54fe
children 43fa316b0eca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2229
bd3c525fa6fc Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 860
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
7300
cc7cd83ccf3f Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 7156
diff changeset
3 ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
5 ;; Author: Howard Gayle
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
6 ;; Maintainer: FSF
3012
d4b85bbedee8 Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents: 2386
diff changeset
7 ;; Keywords: i18n
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
8
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 ;; 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
13 ;; the Free Software Foundation; either version 2, or (at your option)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 ;; any later version.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13516
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13516
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13516
diff changeset
24 ;; Boston, MA 02111-1307, USA.
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
17860
99adb4d59379 (set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17313
diff changeset
37 (defvar set-case-syntax-offset 0)
99adb4d59379 (set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17313
diff changeset
38
17972
79911e7f54fe (set-case-syntax-set-multibyte): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17934
diff changeset
39 (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
40
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
41 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 (defun describe-buffer-case-table ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 "Describe the case table of the current buffer."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
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)
13516
0731fc07cd8b (describe-buffer-case-table): Use set-char-table-range.
Richard M. Stallman <rms@gnu.org>
parents: 13269
diff changeset
48 (set-char-table-range
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
49 description key
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
50 (cond ((null key)
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
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
66 ;;;###autoload
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
67 (defun copy-case-table (case-table)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
68 (let ((copy (copy-sequence case-table)))
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
69 ;; Clear out the extra slots so that they will be
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
70 ;; recomputed from the main (downcase) table.
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
71 (set-char-table-extra-slot copy 0 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
72 (set-char-table-extra-slot copy 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
73 (set-char-table-extra-slot copy 2 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
74 copy))
17313
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
75
17934
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
76 (defsubst set-case-syntax-1 (char)
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
77 "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
78 (if (and (>= char 128) (< char 256))
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
79 (+ char set-case-syntax-offset)
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
80 char))
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
81
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
82 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
83 (defun set-case-syntax-delims (l r table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 "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
85 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
86 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
87 It also modifies `standard-syntax-table' to
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
88 indicate left and right delimiters."
17934
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
89 (setq l (set-case-syntax-1 l))
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
90 (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
91 (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
92 (aset table r r)
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
93 ;; Clear out the extra slots so that they will be
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
94 ;; recomputed from the main (downcase) table.
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
95 (set-char-table-extra-slot table 0 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
96 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
97 (set-char-table-extra-slot table 2 nil)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
100 (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
101 (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
103 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
104 (defun set-case-syntax-pair (uc lc table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
105 "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
106 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
107 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
108 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
109 word constituents."
17934
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
110 (setq uc (set-case-syntax-1 uc))
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
111 (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
112 (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
113 (aset table lc lc)
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
114 (set-char-table-extra-slot table 0 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
115 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
116 (set-char-table-extra-slot table 2 nil)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
117 (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
118 (modify-syntax-entry uc "w " (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
119
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
120 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
121 (defun set-case-syntax (c syntax table)
17313
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
122 "Make character C case-invariant with syntax SYNTAX.
249fdb84dd26 (set-case-syntax): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
123 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
124 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
125 It also modifies `standard-syntax-table'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
126 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
17934
b091b787e3e4 (set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17860
diff changeset
127 (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
128 (aset table c c)
13269
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
129 (set-char-table-extra-slot table 0 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
130 (set-char-table-extra-slot table 1 nil)
5db7fb75222a (copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9858
diff changeset
131 (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
132 (modify-syntax-entry c syntax (standard-syntax-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
134 (provide 'case-table)
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
135
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
136 ;;; case-table.el ends here