annotate lisp/case-table.el @ 2543:9a1b00513968

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Fri, 16 Apr 1993 23:43:57 +0000
parents ded35864afbe
children d4b85bbedee8
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
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
3 ;; Copyright (C) 1988 Free Software Foundation, Inc.
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
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: i14n
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
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
25 ;;; Commentary:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
27 ;; Written by:
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30 ;; Ericsson Telecom Telex: 14910 ERIC S
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
31 ;; S-126 25 Stockholm FAX : +46 8 719 64 82
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 ;; Sweden
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
34 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
35
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
36 ;;;###autoload
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)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 (let ((vector (make-vector 256 nil))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 (case-table (current-case-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 (i 0))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 (while (< i 256)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 (aset vector i
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 (cond ((/= ch (downcase ch))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (concat "uppercase, matches "
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47 (text-char-description (downcase ch))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 ((/= ch (upcase ch))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 (concat "lowercase, matches "
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50 (text-char-description (upcase ch))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 (t "case-invariant")))
860
08045dee5b71 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
52 (setq i (1+ i)))
08045dee5b71 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
53 (with-output-to-temp-buffer "*Help*"
08045dee5b71 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
54 (describe-vector vector))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
56 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
57 (defun set-case-syntax-delims (l r table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58 "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
59 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
60 that will be used as the downcase part of a case table.
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
61 It also modifies `standard-syntax-table', and `text-mode-syntax-table' to
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
62 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
63 (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
64 (aset table r r)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
67 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 text-mode-syntax-table)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
69 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
74 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
75 (defun set-case-syntax-pair (uc lc table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76 "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
77 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
78 that will be used as the downcase part of a case table.
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
79 It also modifies `standard-syntax-table' and `text-mode-syntax-table'
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
80 to indicate an (uppercase, lowercase) pair of letters."
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
81 (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
82 (aset table lc lc)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 (modify-syntax-entry lc "w " (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 (modify-syntax-entry lc "w " text-mode-syntax-table)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85 (modify-syntax-entry uc "w " (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
86 (modify-syntax-entry uc "w " text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
87
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
88 ;;;###autoload
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
89 (defun set-case-syntax (c syntax table)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90 "Make characters C case-invariant with syntax SYNTAX.
2386
ded35864afbe (set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents: 2385
diff changeset
91 This sets the entries for character C 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
92 that will be used as the downcase part of a case table.
2385
416abb820252 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 2229
diff changeset
93 It also modifies `standard-syntax-table' and `text-mode-syntax-table'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 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
95 (aset table c c)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
96 (modify-syntax-entry c syntax (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
97 (modify-syntax-entry c syntax text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 (provide 'case-table)
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
100
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
101 ;;; case-table.el ends here