Commit | Line | Data |
---|---|---|
c8472948 | 1 | ;;; case-table.el --- code to extend the character set and support case tables. |
e5167999 | 2 | |
8f1204db | 3 | ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc. |
3a801d0c | 4 | |
e5167999 ER |
5 | ;; Author: Howard Gayle |
6 | ;; Maintainer: FSF | |
a1d15b3e | 7 | ;; Keywords: i18n |
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 | ||
3f5ed7e4 | 36 | ;;;###autoload |
a2535589 JA |
37 | (defun describe-buffer-case-table () |
38 | "Describe the case table of the current buffer." | |
39 | (interactive) | |
e6905346 RS |
40 | (let ((description (make-char-table 'case-table))) |
41 | (map-char-table | |
42 | (function (lambda (key value) | |
0c7fb3ab | 43 | (set-char-table-range |
e6905346 RS |
44 | description key |
45 | (cond ((null key) | |
46 | "case-invariant") | |
47 | ((/= key (downcase key)) | |
48 | (concat "uppercase, matches " | |
49 | (char-to-string (downcase key)))) | |
50 | ((/= key (upcase key)) | |
51 | (concat "lowercase, matches " | |
52 | (char-to-string (upcase key)))) | |
53 | (t "case-invariant"))))) | |
54 | (current-case-table)) | |
4536d484 RS |
55 | (save-excursion |
56 | (with-output-to-temp-buffer "*Help*" | |
57 | (set-buffer standard-output) | |
e6905346 | 58 | (describe-vector description) |
383669af | 59 | (help-mode))))) |
a2535589 | 60 | |
e6905346 RS |
61 | ;;;###autoload |
62 | (defun copy-case-table (case-table) | |
63 | (let ((copy (copy-sequence case-table))) | |
64 | ;; Clear out the extra slots so that they will be | |
65 | ;; recomputed from the main (downcase) table. | |
66 | (set-char-table-extra-slot copy 0 nil) | |
67 | (set-char-table-extra-slot copy 1 nil) | |
68 | (set-char-table-extra-slot copy 2 nil) | |
69 | copy)) | |
70 | ||
3f5ed7e4 | 71 | ;;;###autoload |
8db3f421 | 72 | (defun set-case-syntax-delims (l r table) |
a2535589 | 73 | "Make characters L and R a matching pair of non-case-converting delimiters. |
8db3f421 RS |
74 | This sets the entries for L and R in TABLE, which is a string |
75 | that will be used as the downcase part of a case table. | |
f46efdf9 | 76 | It also modifies `standard-syntax-table' to |
03131799 | 77 | indicate left and right delimiters." |
8db3f421 RS |
78 | (aset table l l) |
79 | (aset table r r) | |
e6905346 RS |
80 | ;; Clear out the extra slots so that they will be |
81 | ;; recomputed from the main (downcase) table. | |
82 | (set-char-table-extra-slot table 0 nil) | |
83 | (set-char-table-extra-slot table 1 nil) | |
84 | (set-char-table-extra-slot table 2 nil) | |
a2535589 JA |
85 | (modify-syntax-entry l (concat "(" (char-to-string r) " ") |
86 | (standard-syntax-table)) | |
a2535589 | 87 | (modify-syntax-entry r (concat ")" (char-to-string l) " ") |
f46efdf9 | 88 | (standard-syntax-table))) |
a2535589 | 89 | |
3f5ed7e4 | 90 | ;;;###autoload |
8db3f421 | 91 | (defun set-case-syntax-pair (uc lc table) |
a2535589 | 92 | "Make characters UC and LC a pair of inter-case-converting letters. |
8db3f421 RS |
93 | This sets the entries for characters UC and LC in TABLE, which is a string |
94 | that will be used as the downcase part of a case table. | |
f46efdf9 RS |
95 | It also modifies `standard-syntax-table' to give them the syntax of |
96 | word constituents." | |
8db3f421 RS |
97 | (aset table uc lc) |
98 | (aset table lc lc) | |
e6905346 RS |
99 | (set-char-table-extra-slot table 0 nil) |
100 | (set-char-table-extra-slot table 1 nil) | |
101 | (set-char-table-extra-slot table 2 nil) | |
a2535589 | 102 | (modify-syntax-entry lc "w " (standard-syntax-table)) |
f46efdf9 | 103 | (modify-syntax-entry uc "w " (standard-syntax-table))) |
a2535589 | 104 | |
3f5ed7e4 | 105 | ;;;###autoload |
8db3f421 | 106 | (defun set-case-syntax (c syntax table) |
a2535589 | 107 | "Make characters C case-invariant with syntax SYNTAX. |
8db3f421 RS |
108 | This sets the entries for character C in TABLE, which is a string |
109 | that will be used as the downcase part of a case table. | |
f46efdf9 | 110 | It also modifies `standard-syntax-table'. |
a2535589 | 111 | SYNTAX should be \" \", \"w\", \".\" or \"_\"." |
8db3f421 | 112 | (aset table c c) |
e6905346 RS |
113 | (set-char-table-extra-slot table 0 nil) |
114 | (set-char-table-extra-slot table 1 nil) | |
115 | (set-char-table-extra-slot table 2 nil) | |
f46efdf9 | 116 | (modify-syntax-entry c syntax (standard-syntax-table))) |
a2535589 JA |
117 | |
118 | (provide 'case-table) | |
c0274f38 ER |
119 | |
120 | ;;; case-table.el ends here |