annotate lisp/case-table.el @ 696:904853a03d9a

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Jun 1992 04:20:03 +0000
parents 8a533acedb77
children 4f28bd14272c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; case-table.el --- functions for extending the character set and dealing with case tables.
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1988 Free Software Foundation, Inc.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
4
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
6
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 1, or (at your option)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 ;; any later version.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 ;; Written by:
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25 ;; Ericsson Telecom Telex: 14910 ERIC S
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26 ;; S-126 25 Stockholm FAX : +46 8 719 64 82
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
27 ;; Sweden
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 (defun describe-buffer-case-table ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30 "Describe the case table of the current buffer."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
31 (interactive)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 (let ((vector (make-vector 256 nil))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33 (case-table (current-case-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34 (i 0))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35 (while (< i 256)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36 (aset vector i
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 (cond ((/= ch (downcase ch))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 (concat "uppercase, matches "
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 (text-char-description (downcase ch))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 ((/= ch (upcase ch))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 (concat "lowercase, matches "
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 (text-char-description (upcase ch))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 (t "case-invariant")))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 (setq i (1+ i))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 (with-output-to-temp-buffer "*Help*"
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (describe-vector vector)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
48 (defun set-case-syntax-delims (l r string)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 "Make characters L and R a matching pair of non-case-converting delimiters.
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
50 Sets the entries for L and R in STRING, which is a downcasing table.
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
51 Also modifies `standard-syntax-table', and `text-mode-syntax-table' to
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
52 indicate left and right delimiters."
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
53 (aset string l l)
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
54 (aset string r r)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
57 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58 text-mode-syntax-table)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60 (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
64 (defun set-case-syntax-pair (uc lc string)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 "Make characters UC and LC a pair of inter-case-converting letters.
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
66 Sets the entries for characters UC and LC in STRING, which is a downcasing table.
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
67 Also modify `standard-syntax-table' and `text-mode-syntax-table' to indicate an
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
68 (uppercase, lowercase) pair of letters."
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
69 (aset string uc lc)
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
70 (aset (car (cdr (standard-case-table))) lc uc)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 (modify-syntax-entry lc "w " (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 (modify-syntax-entry lc "w " text-mode-syntax-table)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73 (modify-syntax-entry uc "w " (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
74 (modify-syntax-entry uc "w " text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
76 (defun set-case-syntax (c syntax string)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77 "Make characters C case-invariant with syntax SYNTAX.
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
78 Sets the entries for character C in STRING, which is the downcasing table.
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
79 Also modify `standard-syntax-table' and `text-mode-syntax-table'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
80 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
81 (aset string c c)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
82 (modify-syntax-entry c syntax (standard-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 (modify-syntax-entry c syntax text-mode-syntax-table))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85 (provide 'case-table)
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
86
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
87 ;;; case-table.el ends here