]> code.delx.au - gnu-emacs/blob - lisp/case-table.el
Add autoloads.
[gnu-emacs] / lisp / case-table.el
1 ;;; case-table.el --- code to extend the character set and support case tables.
2
3 ;; Copyright (C) 1988 Free Software Foundation, Inc.
4
5 ;; Author: Howard Gayle
6 ;; Maintainer: FSF
7 ;; Keywords: i14n
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
13 ;; the Free Software Foundation; either version 2, or (at your option)
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
25 ;;; Commentary:
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
34 ;;; Code:
35
36 ;;;###autoload
37 (defun describe-buffer-case-table ()
38 "Describe the case table of the current buffer."
39 (interactive)
40 (let ((vector (make-vector 256 nil))
41 (case-table (current-case-table))
42 (i 0))
43 (while (< i 256)
44 (aset vector i
45 (cond ((/= ch (downcase ch))
46 (concat "uppercase, matches "
47 (text-char-description (downcase ch))))
48 ((/= ch (upcase ch))
49 (concat "lowercase, matches "
50 (text-char-description (upcase ch))))
51 (t "case-invariant")))
52 (setq i (1+ i)))
53 (with-output-to-temp-buffer "*Help*"
54 (describe-vector vector))))
55
56 ;;;###autoload
57 (defun set-case-syntax-delims (l r)
58 "Make characters L and R a matching pair of non-case-converting delimiters.
59 This sets the entries for L and R in the standard case table.
60 It also modifies `standard-syntax-table', and `text-mode-syntax-table' to
61 indicate left and right delimiters."
62 (aset (car (cdr (standard-case-table))) l l)
63 (aset (car (cdr (standard-case-table))) r r)
64 ;; Recompute the equivalence and canonicalize tables.
65 (set-standard-case-table (list (car (standard-case-table))
66 (nth 1 (standard-case-table))
67 nil nil))
68 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
69 (standard-syntax-table))
70 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
71 text-mode-syntax-table)
72 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
73 (standard-syntax-table))
74 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
75 text-mode-syntax-table))
76
77 ;;;###autoload
78 (defun set-case-syntax-pair (uc lc)
79 "Make characters UC and LC a pair of inter-case-converting letters.
80 This sets the entries for characters UC and LC in the standard case table.
81 It also modifies `standard-syntax-table' and `text-mode-syntax-table'
82 to indicate an (uppercase, lowercase) pair of letters."
83 (aset (car (cdr (standard-case-table))) lc uc)
84 (aset (car (cdr (standard-case-table))) uc uc)
85 (aset (car (standard-case-table)) uc lc)
86 (aset (car (standard-case-table)) lc lc)
87 ;; Recompute the equivalence and canonicalize tables.
88 (set-standard-case-table (list (car (standard-case-table))
89 (nth 1 (standard-case-table))
90 nil nil))
91 (modify-syntax-entry lc "w " (standard-syntax-table))
92 (modify-syntax-entry lc "w " text-mode-syntax-table)
93 (modify-syntax-entry uc "w " (standard-syntax-table))
94 (modify-syntax-entry uc "w " text-mode-syntax-table))
95
96 ;;;###autoload
97 (defun set-case-syntax (c syntax)
98 "Make characters C case-invariant with syntax SYNTAX.
99 This sets the entries for character C in the standard case table.
100 It also modifies `standard-syntax-table' and `text-mode-syntax-table'.
101 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
102 (aset (car (cdr (standard-case-table))) c c)
103 (aset (car (standard-case-table)) c c)
104 ;; Recompute the equivalence and canonicalize tables.
105 (set-standard-case-table (list (car (standard-case-table))
106 (nth 1 (standard-case-table))
107 nil nil))
108 (modify-syntax-entry c syntax (standard-syntax-table))
109 (modify-syntax-entry c syntax text-mode-syntax-table))
110
111 (provide 'case-table)
112
113 ;;; case-table.el ends here