Mercurial > emacs
annotate lisp/case-table.el @ 22293:0544aa57ff27
(cperl-style-alist): New variable, since `c-mode'
is no longer loaded.
- (Somebody who uses the styles should check that they work OK!)
- (a lot of work is needed, especially with new
`cperl-fix-line-spacing').
Old value of style is memorized when choosing a new style, may be
restored from the same menu.
(cperl-perldoc, cperl-pod-to-manpage): New commands; thanks to
Anthony Foiani <afoiani@uswest.com> and Nick Roberts
<Nick.Roberts@src.bae.co.uk>.
(`Perl doc', `Regexp'): New submenus (latter to allow short displays).
(cperl-clobber-lisp-bindings): New cfg variable.
(cperl-find-pods-heres): $a->y() is not y///.
(cperl-after-block-p): Add save-excursion.
(cperl-init-faces): Was failing.
Init faces when loading `ps-print'.
(cperl-toggle-autohelp): New command.
(cperl-electric-paren): `while SPACE LESS' was buggy.
(cperl-init-faces): `-text' in `[-text => 1]' was not highlighted.
(cperl-after-block-p): was FALSE after `sub f {}'.
(cperl-electric-keyword): `foreachmy', `formy' expanded too,
Expands `=pod-directive'.
(cperl-linefeed): behaves reasonable in POD-directive lines.
(cperl-message-electric-keyword): new cfg variable.
(cperl-electric-keyword): print a message, governed by
`cperl-message-electric-keyword'.
(cperl-electric-paren): Typing `}' was not checking for being
block or not.
(cperl-beautify-regexp-piece): Did not know about lookbehind;
finding *which* level to work with was not intuitive.
(cperl-beautify-levels): New command.
(cperl-electric-keyword): Allow here-docs contain `=head1'
and friends for keyword expansion.
Fix for broken `font-lock-unfontify-region-function'. Should
preserve `syntax-table' properties even with `lazy-lock'.
(cperl-indent-region-fix-else): New command.
(cperl-fix-line-spacing): New command.
(cperl-invert-if-unless): New command (C-c C-t and in Menu).
(cperl-hints): mention 20.2's goods/bads.
(cperl-extra-newline-before-brace-multiline): Started to use it.
(cperl-break-one-line-blocks-when-indent): New cfg variable.
(cperl-fix-hanging-brace-when-indent): New cfg variable.
(cperl-merge-trailing-else): New cfg variable.
Workaround for another `font-lock's `syntax-table' text-property bug.
`zerop' could be applied to nil.
At last, may work with `font-lock' without setting `cperl-font-lock'.
(cperl-indent-region-fix-constructs): Renamed from
`cperl-indent-region-fix-constructs'.
(cperl-fix-line-spacing): could be triggered inside strings, would not
know what to do with BLOCKs of map/printf/etc.
(cperl-merge-trailing-else): Handle `continue' too.
(cperl-fix-line-spacing): Likewise.
(cperl-calculate-indent): Knows about map/printf/etc before {BLOCK};
treat after-comma lines as continuation lines.
(cperl-mode): `continue' made electric.
(cperl-electric-keyword): Electric `do' inserts `do/while'.
(cperl-fontify-syntaxically): New function.
(cperl-syntaxify-by-font-lock): New cfg variable.
Make syntaxification to be autoredone via `font-lock',
switched on by `cperl-syntaxify-by-font-lock', off by default so far.
Remove some commented out chunks.
(cperl-set-style-back): Old value of style is memorized when
choosing a new style, may be restored from the same menu.
Mode-documentation added to micro-docs.
(cperl-praise): updated.
(cperl-toggle-construct-fix): New command. Added on C-c C-w and menu.
(auto-fill-mode): added on C-c C-f and menu.
(cperl-style-alist): `PerlStyle' style added.
(cperl-find-pods-heres): Message for termination of scan corrected.
(cperl-speed): New variable with hints.
(cperl-electric-else): Make backspace electric after
expansion of `else/continue' too.
Fixed customization to honor cperl-hairy.
Created customization groups.
All the compile-time warnings fixed.
(cperl-syntaxify-by-font-lock): Interaction with `font-lock-hot-pass'
fixed.
(cperl-after-block-and-statement-beg): It is BLOCK if we reach lim
when backup sexp.
(cperl-after-block-p, cperl-after-expr-p): Likewise.
(cperl-indent-region): Make a marker for END - text added/removed.
(cperl-style-alist): Include `cperl-merge-trailing-else'
where the value is clear.
(cperl-styles-entries): Likewise.
(cperl-tips, cperl-problems): Improvements to docs.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 30 May 1998 15:43:16 +0000 |
parents | 90c5343cf243 |
children | 253f761ad37b |
rev | line source |
---|---|
2229
bd3c525fa6fc
Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
860
diff
changeset
|
1 ;;; case-table.el --- code to extend the character set and support case tables. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
2 |
7300 | 3 ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
5 ;; Author: Howard Gayle |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
6 ;; Maintainer: FSF |
3012
d4b85bbedee8
Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents:
2386
diff
changeset
|
7 ;; Keywords: i18n |
36 | 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 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 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 | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
36 | 25 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
26 ;;; Commentary: |
36 | 27 |
28 ;; Written by: | |
29 ;; TN/ETX/TX/UMG Howard Gayle UUCP : seismo!enea!erix!howard | |
30 ;; Telefonaktiebolaget L M Ericsson Phone: +46 8 719 55 65 | |
31 ;; Ericsson Telecom Telex: 14910 ERIC S | |
32 ;; S-126 25 Stockholm FAX : +46 8 719 64 82 | |
33 ;; Sweden | |
34 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
35 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
36 |
17860
99adb4d59379
(set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17313
diff
changeset
|
37 (defvar set-case-syntax-offset 0) |
99adb4d59379
(set-case-syntax-offset): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17313
diff
changeset
|
38 |
17972
79911e7f54fe
(set-case-syntax-set-multibyte): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17934
diff
changeset
|
39 (defvar set-case-syntax-set-multibyte nil) |
79911e7f54fe
(set-case-syntax-set-multibyte): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17934
diff
changeset
|
40 |
36 | 41 (defun describe-buffer-case-table () |
42 "Describe the case table of the current buffer." | |
43 (interactive) | |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
44 (let ((description (make-char-table 'case-table))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
45 (map-char-table |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
46 (function (lambda (key value) |
17986
43fa316b0eca
(describe-buffer-case-table): Use aref instead of
Kenichi Handa <handa@m17n.org>
parents:
17972
diff
changeset
|
47 (aset |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
48 description key |
17986
43fa316b0eca
(describe-buffer-case-table): Use aref instead of
Kenichi Handa <handa@m17n.org>
parents:
17972
diff
changeset
|
49 (cond ((not (natnump value)) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
50 "case-invariant") |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
51 ((/= key (downcase key)) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
52 (concat "uppercase, matches " |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
53 (char-to-string (downcase key)))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
54 ((/= key (upcase key)) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
55 (concat "lowercase, matches " |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
56 (char-to-string (upcase key)))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
57 (t "case-invariant"))))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
58 (current-case-table)) |
3550
0d8c66f2e25e
(describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents:
3012
diff
changeset
|
59 (save-excursion |
0d8c66f2e25e
(describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents:
3012
diff
changeset
|
60 (with-output-to-temp-buffer "*Help*" |
0d8c66f2e25e
(describe-buffer-case-table): Merge locals i and ch.
Richard M. Stallman <rms@gnu.org>
parents:
3012
diff
changeset
|
61 (set-buffer standard-output) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
62 (describe-vector description) |
9858
0e4831555b2c
(describe-buffer-case-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
63 (help-mode))))) |
36 | 64 |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
65 (defun copy-case-table (case-table) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
66 (let ((copy (copy-sequence case-table))) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
67 ;; Clear out the extra slots so that they will be |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
68 ;; recomputed from the main (downcase) table. |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
69 (set-char-table-extra-slot copy 0 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
70 (set-char-table-extra-slot copy 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
71 (set-char-table-extra-slot copy 2 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
72 copy)) |
17313 | 73 |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
74 (defsubst set-case-syntax-1 (char) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
75 "Offset CHAR by `set-case-syntax-offset' if CHAR is a non-ASCII 8-bit char." |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
76 (if (and (>= char 128) (< char 256)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
77 (+ char set-case-syntax-offset) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
78 char)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
79 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
80 (defun set-case-syntax-delims (l r table) |
36 | 81 "Make characters L and R a matching pair of non-case-converting delimiters. |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
82 This sets the entries for L and R in TABLE, which is a string |
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
83 that will be used as the downcase part of a case table. |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
84 It also modifies `standard-syntax-table' to |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
85 indicate left and right delimiters." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
86 (setq l (set-case-syntax-1 l)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
87 (setq r (set-case-syntax-1 r)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
88 (aset table l l) |
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
89 (aset table r r) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
90 ;; Clear out the extra slots so that they will be |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
91 ;; recomputed from the main (downcase) table. |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
92 (set-char-table-extra-slot table 0 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
93 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
94 (set-char-table-extra-slot table 2 nil) |
36 | 95 (modify-syntax-entry l (concat "(" (char-to-string r) " ") |
96 (standard-syntax-table)) | |
97 (modify-syntax-entry r (concat ")" (char-to-string l) " ") | |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
98 (standard-syntax-table))) |
36 | 99 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
100 (defun set-case-syntax-pair (uc lc table) |
36 | 101 "Make characters UC and LC a pair of inter-case-converting letters. |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
102 This sets the entries for characters UC and LC in TABLE, which is a string |
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
103 that will be used as the downcase part of a case table. |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
104 It also modifies `standard-syntax-table' to give them the syntax of |
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
105 word constituents." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
106 (setq uc (set-case-syntax-1 uc)) |
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
107 (setq lc (set-case-syntax-1 lc)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
108 (aset table uc lc) |
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
109 (aset table lc lc) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
110 (set-char-table-extra-slot table 0 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
111 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
112 (set-char-table-extra-slot table 2 nil) |
36 | 113 (modify-syntax-entry lc "w " (standard-syntax-table)) |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
114 (modify-syntax-entry uc "w " (standard-syntax-table))) |
36 | 115 |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
116 (defun set-case-syntax (c syntax table) |
17313 | 117 "Make character C case-invariant with syntax SYNTAX. |
118 This sets the entry for character C in TABLE, which is a string | |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
119 that will be used as the downcase part of a case table. |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
120 It also modifies `standard-syntax-table'. |
36 | 121 SYNTAX should be \" \", \"w\", \".\" or \"_\"." |
17934
b091b787e3e4
(set-case-syntax-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17860
diff
changeset
|
122 (setq c (set-case-syntax-1 c)) |
2386
ded35864afbe
(set-case-syntax-delims, set-case-syntax-pair, set-case-syntax):
Richard M. Stallman <rms@gnu.org>
parents:
2385
diff
changeset
|
123 (aset table c c) |
13269
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
124 (set-char-table-extra-slot table 0 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
125 (set-char-table-extra-slot table 1 nil) |
5db7fb75222a
(copy-case-table): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9858
diff
changeset
|
126 (set-char-table-extra-slot table 2 nil) |
7156
4d86978056b1
(describe-buffer-case-table): Don't use text-char-description.
Richard M. Stallman <rms@gnu.org>
parents:
3550
diff
changeset
|
127 (modify-syntax-entry c syntax (standard-syntax-table))) |
36 | 128 |
129 (provide 'case-table) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
130 |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
131 ;;; case-table.el ends here |