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