1 ;;; case-table.el --- code to extend the character set and support case tables.
3 ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
5 ;; Author: Howard Gayle
9 ;; This file is part of GNU Emacs.
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)
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.
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.
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
37 (defun describe-buffer-case-table ()
38 "Describe the case table of the current buffer."
40 (let ((description (make-char-table 'case-table
)))
42 (function (lambda (key value
)
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")))))
56 (with-output-to-temp-buffer "*Help*"
57 (set-buffer standard-output
)
58 (describe-vector description
)
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
)
72 (defun set-case-syntax-delims (l r table
)
73 "Make characters L and R a matching pair of non-case-converting delimiters.
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.
76 It also modifies `standard-syntax-table' to
77 indicate left and right delimiters."
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
)
85 (modify-syntax-entry l
(concat "(" (char-to-string r
) " ")
86 (standard-syntax-table))
87 (modify-syntax-entry r
(concat ")" (char-to-string l
) " ")
88 (standard-syntax-table)))
91 (defun set-case-syntax-pair (uc lc table
)
92 "Make characters UC and LC a pair of inter-case-converting letters.
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.
95 It also modifies `standard-syntax-table' to give them the syntax of
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
)
102 (modify-syntax-entry lc
"w " (standard-syntax-table))
103 (modify-syntax-entry uc
"w " (standard-syntax-table)))
106 (defun set-case-syntax (c syntax table
)
107 "Make characters C case-invariant with syntax SYNTAX.
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.
110 It also modifies `standard-syntax-table'.
111 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
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
)
116 (modify-syntax-entry c syntax
(standard-syntax-table)))
118 (provide 'case-table
)
120 ;;; case-table.el ends here