*** empty log message ***
[bpt/emacs.git] / lisp / case-table.el
CommitLineData
e5167999
ER
1;;; case-table.el ---code to extend the character set and support case tables.
2
3a801d0c
ER
3;; Copyright (C) 1988 Free Software Foundation, Inc.
4
e5167999
ER
5;; Author: Howard Gayle
6;; Maintainer: FSF
3a801d0c 7;; Keywords: i14n
a2535589
JA
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
e5167999 13;; the Free Software Foundation; either version 2, or (at your option)
a2535589
JA
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to
23;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
e5167999 25;;; Commentary:
a2535589
JA
26
27;; Written by:
28;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard
29;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65
30;; Ericsson Telecom Telex: 14910 ERIC S
31;; S-126 25 Stockholm FAX : +46 8 719 64 82
32;; Sweden
33
e5167999
ER
34;;; Code:
35
a2535589
JA
36(defun describe-buffer-case-table ()
37 "Describe the case table of the current buffer."
38 (interactive)
39 (let ((vector (make-vector 256 nil))
40 (case-table (current-case-table))
41 (i 0))
42 (while (< i 256)
43 (aset vector i
44 (cond ((/= ch (downcase ch))
45 (concat "uppercase, matches "
46 (text-char-description (downcase ch))))
47 ((/= ch (upcase ch))
48 (concat "lowercase, matches "
49 (text-char-description (upcase ch))))
50 (t "case-invariant")))
51 (setq i (1+ i))))
52 (with-output-to-temp-buffer "*Help*"
53 (describe-vector vector)))
54
03131799 55(defun set-case-syntax-delims (l r string)
a2535589 56 "Make characters L and R a matching pair of non-case-converting delimiters.
03131799
RS
57Sets the entries for L and R in STRING, which is a downcasing table.
58Also modifies `standard-syntax-table', and `text-mode-syntax-table' to
59indicate left and right delimiters."
60 (aset string l l)
61 (aset string r r)
a2535589
JA
62 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
63 (standard-syntax-table))
64 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
65 text-mode-syntax-table)
66 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
67 (standard-syntax-table))
68 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
69 text-mode-syntax-table))
70
03131799 71(defun set-case-syntax-pair (uc lc string)
a2535589 72 "Make characters UC and LC a pair of inter-case-converting letters.
03131799
RS
73Sets the entries for characters UC and LC in STRING, which is a downcasing table.
74Also modify `standard-syntax-table' and `text-mode-syntax-table' to indicate an
49116ac0 75(uppercase, lowercase) pair of letters."
03131799
RS
76 (aset string uc lc)
77 (aset (car (cdr (standard-case-table))) lc uc)
a2535589
JA
78 (modify-syntax-entry lc "w " (standard-syntax-table))
79 (modify-syntax-entry lc "w " text-mode-syntax-table)
80 (modify-syntax-entry uc "w " (standard-syntax-table))
81 (modify-syntax-entry uc "w " text-mode-syntax-table))
82
03131799 83(defun set-case-syntax (c syntax string)
a2535589 84 "Make characters C case-invariant with syntax SYNTAX.
03131799
RS
85Sets the entries for character C in STRING, which is the downcasing table.
86Also modify `standard-syntax-table' and `text-mode-syntax-table'.
a2535589 87SYNTAX should be \" \", \"w\", \".\" or \"_\"."
03131799 88 (aset string c c)
a2535589
JA
89 (modify-syntax-entry c syntax (standard-syntax-table))
90 (modify-syntax-entry c syntax text-mode-syntax-table))
91
92(provide 'case-table)
c0274f38
ER
93
94;;; case-table.el ends here