Mercurial > hg > xemacs-beta
comparison lisp/prim/case-table.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; case-table.el --- code to extend the character set and support case tables. | |
2 ;; Keywords: i18n | |
3 | |
4 ;; Copyright (C) 1988, 1993 Free Software Foundation, Inc. | |
5 | |
6 ;; This file is part of XEmacs. | |
7 | |
8 ;; XEmacs is free software; you can redistribute it and/or modify it | |
9 ;; under the terms of the GNU General Public License as published by | |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 | |
13 ;; XEmacs is distributed in the hope that it will be useful, but | |
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 ;; General Public License for more details. | |
17 | |
18 ;; You should have received a copy of the GNU General Public License | |
19 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
20 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | |
22 ;;; Synched up with: Not synched with FSF. | |
23 | |
24 ;; Written by: | |
25 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard | |
26 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65 | |
27 ;; Ericsson Telecom Telex: 14910 ERIC S | |
28 ;; S-126 25 Stockholm FAX : +46 8 719 64 82 | |
29 ;; Sweden | |
30 | |
31 ;;;###autoload | |
32 (defun describe-buffer-case-table () | |
33 "Describe the case table of the current buffer." | |
34 (interactive) | |
35 (let ((vector (make-vector 256 nil)) | |
36 (case-table (current-case-table)) | |
37 (ch 0)) | |
38 (with-displaying-help-buffer | |
39 (set-buffer standard-output) | |
40 (while (< ch 256) | |
41 (cond ((/= ch (downcase ch)) | |
42 (insert (text-char-description ch)) | |
43 (indent-to 16) | |
44 (insert "uppercase, matches " | |
45 (text-char-description (downcase ch)) | |
46 "\n")) | |
47 ((/= ch (upcase ch)) | |
48 (insert (text-char-description ch)) | |
49 (indent-to 16) | |
50 (insert "lowercase, matches " | |
51 (text-char-description (upcase ch)) | |
52 "\n")) | |
53 ;; (t | |
54 ;; (insert (text-char-description ch)) | |
55 ;; (indent-to 16) | |
56 ;; (insert "case-invariant\n")) | |
57 ) | |
58 (setq ch (1+ ch)))))) | |
59 | |
60 (defun invert-case (count) | |
61 "Change the case of the character just after point and move over it. | |
62 With arg, applies to that many chars. | |
63 Negative arg inverts characters before point but does not move." | |
64 (interactive "p") | |
65 (if (< count 0) | |
66 (progn (setq count (min (1- (point)) (- count))) | |
67 (forward-char (- count)))) | |
68 (while (> count 0) | |
69 (let ((ch (following-char))) | |
70 (cond ((/= (upcase ch) ch) | |
71 (insert (upcase ch)) | |
72 (delete-char 1)) | |
73 ((/= (downcase ch) ch) | |
74 (insert (downcase ch)) | |
75 (delete-char 1)) | |
76 (t | |
77 (forward-char 1)))) | |
78 (setq count (1- count)))) | |
79 | |
80 (defun set-case-syntax-delims (l r table) | |
81 "Make characters L and R a matching pair of non-case-converting delimiters. | |
82 Sets the entries for L and R in standard-case-table, | |
83 standard-syntax-table, and text-mode-syntax-table to indicate | |
84 left and right delimiters." | |
85 (aset (car table) l l) | |
86 (aset (car table) r r) | |
87 (modify-syntax-entry l (concat "(" (char-to-string r) " ") | |
88 (standard-syntax-table)) | |
89 (modify-syntax-entry l (concat "(" (char-to-string r) " ") | |
90 text-mode-syntax-table) | |
91 (modify-syntax-entry r (concat ")" (char-to-string l) " ") | |
92 (standard-syntax-table)) | |
93 (modify-syntax-entry r (concat ")" (char-to-string l) " ") | |
94 text-mode-syntax-table)) | |
95 | |
96 (defun set-case-syntax-pair (uc lc table) | |
97 "Make characters UC and LC a pair of inter-case-converting letters. | |
98 Sets the entries for characters UC and LC in | |
99 standard-case-table, standard-syntax-table, and | |
100 text-mode-syntax-table to indicate an (uppercase, lowercase) | |
101 pair of letters." | |
102 (aset (car table) uc lc) | |
103 (modify-syntax-entry lc "w " (standard-syntax-table)) | |
104 (modify-syntax-entry lc "w " text-mode-syntax-table) | |
105 (modify-syntax-entry uc "w " (standard-syntax-table)) | |
106 (modify-syntax-entry uc "w " text-mode-syntax-table)) | |
107 | |
108 (defun set-case-syntax (c syntax table) | |
109 "Make characters C case-invariant with syntax SYNTAX. | |
110 Sets the entries for character C in standard-case-table, | |
111 standard-syntax-table, and text-mode-syntax-table to indicate this. | |
112 SYNTAX should be \" \", \"w\", \".\" or \"_\"." | |
113 (aset (car table) c c) | |
114 (modify-syntax-entry c syntax (standard-syntax-table)) | |
115 (modify-syntax-entry c syntax text-mode-syntax-table)) | |
116 | |
117 (provide 'case-table) |