0
|
1 ;;; case-table.el --- code to extend the character set and support case tables.
|
159
|
2
|
|
3 ;; Copyright (C) 1988, 1993, 1997 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: Howard Gayle
|
|
6 ;; Maintainer: XEmacs Development Team
|
0
|
7 ;; Keywords: i18n
|
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; 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 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
16
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
22
|
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
16
|
24 ;; Boston, MA 02111-1307, USA.
|
0
|
25
|
|
26 ;;; Synched up with: Not synched with FSF.
|
|
27
|
159
|
28 ;;; Commentary:
|
|
29
|
0
|
30 ;; Written by:
|
|
31 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard
|
|
32 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65
|
|
33 ;; Ericsson Telecom Telex: 14910 ERIC S
|
|
34 ;; S-126 25 Stockholm FAX : +46 8 719 64 82
|
|
35 ;; Sweden
|
|
36
|
159
|
37 ;;; Code:
|
|
38
|
0
|
39 ;;;###autoload
|
|
40 (defun describe-buffer-case-table ()
|
|
41 "Describe the case table of the current buffer."
|
|
42 (interactive)
|
22
|
43 (let ((ch 0))
|
0
|
44 (with-displaying-help-buffer
|
22
|
45 (lambda ()
|
|
46 (set-buffer standard-output)
|
|
47 (while (< ch 256)
|
|
48 (cond ((/= ch (downcase ch))
|
|
49 (insert (text-char-description ch))
|
|
50 (indent-to 16)
|
|
51 (insert "uppercase, matches "
|
|
52 (text-char-description (downcase ch))
|
|
53 "\n"))
|
|
54 ((/= ch (upcase ch))
|
|
55 (insert (text-char-description ch))
|
|
56 (indent-to 16)
|
|
57 (insert "lowercase, matches "
|
|
58 (text-char-description (upcase ch))
|
|
59 "\n"))
|
0
|
60 ;; (t
|
|
61 ;; (insert (text-char-description ch))
|
|
62 ;; (indent-to 16)
|
|
63 ;; (insert "case-invariant\n"))
|
|
64 )
|
22
|
65 (setq ch (1+ ch)))))))
|
0
|
66
|
|
67 (defun invert-case (count)
|
|
68 "Change the case of the character just after point and move over it.
|
|
69 With arg, applies to that many chars.
|
|
70 Negative arg inverts characters before point but does not move."
|
|
71 (interactive "p")
|
|
72 (if (< count 0)
|
|
73 (progn (setq count (min (1- (point)) (- count)))
|
|
74 (forward-char (- count))))
|
|
75 (while (> count 0)
|
159
|
76 (let ((ch (char-after)))
|
0
|
77 (cond ((/= (upcase ch) ch)
|
|
78 (insert (upcase ch))
|
|
79 (delete-char 1))
|
|
80 ((/= (downcase ch) ch)
|
|
81 (insert (downcase ch))
|
|
82 (delete-char 1))
|
|
83 (t
|
|
84 (forward-char 1))))
|
|
85 (setq count (1- count))))
|
|
86
|
|
87 (defun set-case-syntax-delims (l r table)
|
|
88 "Make characters L and R a matching pair of non-case-converting delimiters.
|
|
89 Sets the entries for L and R in standard-case-table,
|
|
90 standard-syntax-table, and text-mode-syntax-table to indicate
|
|
91 left and right delimiters."
|
|
92 (aset (car table) l l)
|
|
93 (aset (car table) r r)
|
|
94 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
|
|
95 (standard-syntax-table))
|
|
96 (modify-syntax-entry l (concat "(" (char-to-string r) " ")
|
|
97 text-mode-syntax-table)
|
|
98 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
|
|
99 (standard-syntax-table))
|
|
100 (modify-syntax-entry r (concat ")" (char-to-string l) " ")
|
|
101 text-mode-syntax-table))
|
|
102
|
|
103 (defun set-case-syntax-pair (uc lc table)
|
|
104 "Make characters UC and LC a pair of inter-case-converting letters.
|
|
105 Sets the entries for characters UC and LC in
|
|
106 standard-case-table, standard-syntax-table, and
|
|
107 text-mode-syntax-table to indicate an (uppercase, lowercase)
|
|
108 pair of letters."
|
|
109 (aset (car table) uc lc)
|
|
110 (modify-syntax-entry lc "w " (standard-syntax-table))
|
|
111 (modify-syntax-entry lc "w " text-mode-syntax-table)
|
|
112 (modify-syntax-entry uc "w " (standard-syntax-table))
|
|
113 (modify-syntax-entry uc "w " text-mode-syntax-table))
|
|
114
|
|
115 (defun set-case-syntax (c syntax table)
|
|
116 "Make characters C case-invariant with syntax SYNTAX.
|
|
117 Sets the entries for character C in standard-case-table,
|
|
118 standard-syntax-table, and text-mode-syntax-table to indicate this.
|
|
119 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
|
|
120 (aset (car table) c c)
|
|
121 (modify-syntax-entry c syntax (standard-syntax-table))
|
|
122 (modify-syntax-entry c syntax text-mode-syntax-table))
|
|
123
|
|
124 (provide 'case-table)
|
159
|
125
|
|
126 ;;; case-table.el ends here
|