Mercurial > emacs
annotate src/casefiddle.c @ 14637:89952d6af6c2
(derived-mode-merge-syntax-tables): Use inheritance.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 21 Feb 1996 21:33:12 +0000 |
parents | ee40177f6c68 |
children | 0d698228e98c |
rev | line source |
---|---|
118 | 1 /* GNU Emacs case conversion functions. |
7307 | 2 Copyright (C) 1985, 1994 Free Software Foundation, Inc. |
118 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
12244 | 8 the Free Software Foundation; either version 2, or (at your option) |
118 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14063
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14063
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
118 | 20 |
21 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
2822
diff
changeset
|
22 #include <config.h> |
118 | 23 #include "lisp.h" |
24 #include "buffer.h" | |
25 #include "commands.h" | |
26 #include "syntax.h" | |
27 | |
28 enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP}; | |
29 | |
30 Lisp_Object | |
31 casify_object (flag, obj) | |
32 enum case_action flag; | |
33 Lisp_Object obj; | |
34 { | |
35 register int i, c, len; | |
36 register int inword = flag == CASE_DOWN; | |
37 | |
38 while (1) | |
39 { | |
9137
412e94c1dbf2
(casify_object): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9053
diff
changeset
|
40 if (INTEGERP (obj)) |
118 | 41 { |
42 c = XINT (obj); | |
43 if (c >= 0 && c <= 0400) | |
44 { | |
45 if (inword) | |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
46 XSETFASTINT (obj, DOWNCASE (c)); |
118 | 47 else if (!UPPERCASEP (c)) |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
48 XSETFASTINT (obj, UPCASE1 (c)); |
118 | 49 } |
50 return obj; | |
51 } | |
9137
412e94c1dbf2
(casify_object): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9053
diff
changeset
|
52 if (STRINGP (obj)) |
118 | 53 { |
54 obj = Fcopy_sequence (obj); | |
55 len = XSTRING (obj)->size; | |
56 for (i = 0; i < len; i++) | |
57 { | |
58 c = XSTRING (obj)->data[i]; | |
9052
6de22822cf72
(upcase_initials): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
59 if (inword && flag != CASE_CAPITALIZE_UP) |
118 | 60 c = DOWNCASE (c); |
9052
6de22822cf72
(upcase_initials): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
61 else if (!UPPERCASEP (c) |
6de22822cf72
(upcase_initials): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
62 && (!inword || flag != CASE_CAPITALIZE_UP)) |
118 | 63 c = UPCASE1 (c); |
64 XSTRING (obj)->data[i] = c; | |
9052
6de22822cf72
(upcase_initials): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
65 if ((int) flag >= (int) CASE_CAPITALIZE) |
118 | 66 inword = SYNTAX (c) == Sword; |
67 } | |
68 return obj; | |
69 } | |
1926
952f2a18f83d
* callint.c (Fcall_interactively): Pass the correct number of
Jim Blandy <jimb@redhat.com>
parents:
1505
diff
changeset
|
70 obj = wrong_type_argument (Qchar_or_string_p, obj); |
118 | 71 } |
72 } | |
73 | |
74 DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0, | |
75 "Convert argument to upper case and return that.\n\ | |
76 The argument may be a character or string. The result has the same type.\n\ | |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
77 The argument object is not altered--the value is a copy.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
78 See also `capitalize', `downcase' and `upcase-initials'.") |
118 | 79 (obj) |
80 Lisp_Object obj; | |
81 { | |
82 return casify_object (CASE_UP, obj); | |
83 } | |
84 | |
85 DEFUN ("downcase", Fdowncase, Sdowncase, 1, 1, 0, | |
86 "Convert argument to lower case and return that.\n\ | |
87 The argument may be a character or string. The result has the same type.\n\ | |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
88 The argument object is not altered--the value is a copy.") |
118 | 89 (obj) |
90 Lisp_Object obj; | |
91 { | |
92 return casify_object (CASE_DOWN, obj); | |
93 } | |
94 | |
95 DEFUN ("capitalize", Fcapitalize, Scapitalize, 1, 1, 0, | |
96 "Convert argument to capitalized form and return that.\n\ | |
97 This means that each word's first character is upper case\n\ | |
98 and the rest is lower case.\n\ | |
99 The argument may be a character or string. The result has the same type.\n\ | |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
100 The argument object is not altered--the value is a copy.") |
118 | 101 (obj) |
102 Lisp_Object obj; | |
103 { | |
104 return casify_object (CASE_CAPITALIZE, obj); | |
105 } | |
9052
6de22822cf72
(upcase_initials): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
106 |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
107 /* Like Fcapitalize but change only the initials. */ |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
108 |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
109 DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0, |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
110 "Convert the initial of each word in the argument to upper case.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
111 Do not change the other letters of each word.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
112 The argument may be a character or string. The result has the same type.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
113 The argument object is not altered--the value is a copy.") |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
114 (obj) |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
115 Lisp_Object obj; |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
116 { |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
117 return casify_object (CASE_CAPITALIZE_UP, obj); |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
118 } |
118 | 119 |
120 /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. | |
121 b and e specify range of buffer to operate on. */ | |
122 | |
123 casify_region (flag, b, e) | |
124 enum case_action flag; | |
125 Lisp_Object b, e; | |
126 { | |
127 register int i; | |
128 register int c; | |
129 register int inword = flag == CASE_DOWN; | |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
130 int start, end; |
118 | 131 |
132 if (EQ (b, e)) | |
133 /* Not modifying because nothing marked */ | |
134 return; | |
135 | |
136 validate_region (&b, &e); | |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
137 start = XFASTINT (b); |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
138 end = XFASTINT (e); |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
139 modify_region (current_buffer, start, end); |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
140 record_change (start, end - start); |
118 | 141 |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
142 for (i = start; i < end; i++) |
118 | 143 { |
144 c = FETCH_CHAR (i); | |
145 if (inword && flag != CASE_CAPITALIZE_UP) | |
146 c = DOWNCASE (c); | |
147 else if (!UPPERCASEP (c) | |
148 && (!inword || flag != CASE_CAPITALIZE_UP)) | |
149 c = UPCASE1 (c); | |
150 FETCH_CHAR (i) = c; | |
151 if ((int) flag >= (int) CASE_CAPITALIZE) | |
152 inword = SYNTAX (c) == Sword; | |
153 } | |
154 | |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
155 signal_after_change (start, end - start, end - start); |
118 | 156 } |
157 | |
158 DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r", | |
159 "Convert the region to upper case. In programs, wants two arguments.\n\ | |
160 These arguments specify the starting and ending character numbers of\n\ | |
161 the region to operate on. When used as a command, the text between\n\ | |
162 point and the mark is operated on.\n\ | |
163 See also `capitalize-region'.") | |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
164 (beg, end) |
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
165 Lisp_Object beg, end; |
118 | 166 { |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
167 casify_region (CASE_UP, beg, end); |
118 | 168 return Qnil; |
169 } | |
170 | |
171 DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r", | |
172 "Convert the region to lower case. In programs, wants two arguments.\n\ | |
173 These arguments specify the starting and ending character numbers of\n\ | |
174 the region to operate on. When used as a command, the text between\n\ | |
175 point and the mark is operated on.") | |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
176 (beg, end) |
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
177 Lisp_Object beg, end; |
118 | 178 { |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
179 casify_region (CASE_DOWN, beg, end); |
118 | 180 return Qnil; |
181 } | |
182 | |
183 DEFUN ("capitalize-region", Fcapitalize_region, Scapitalize_region, 2, 2, "r", | |
184 "Convert the region to capitalized form.\n\ | |
185 Capitalized form means each word's first character is upper case\n\ | |
186 and the rest of it is lower case.\n\ | |
187 In programs, give two arguments, the starting and ending\n\ | |
188 character positions to operate on.") | |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
189 (beg, end) |
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
190 Lisp_Object beg, end; |
118 | 191 { |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
192 casify_region (CASE_CAPITALIZE, beg, end); |
118 | 193 return Qnil; |
194 } | |
195 | |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
196 /* Like Fcapitalize_region but change only the initials. */ |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
197 |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
198 DEFUN ("upcase-initials-region", Fupcase_initials_region, |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
199 Supcase_initials_region, 2, 2, "r", |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
200 "Upcase the initial of each word in the region.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
201 Subsequent letters of each word are not changed.\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
202 In programs, give two arguments, the starting and ending\n\ |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
203 character positions to operate on.") |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
204 (beg, end) |
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
205 Lisp_Object beg, end; |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
206 { |
14063
ef7d4117c601
(Fupcase_region, Fdowncase_region, Fcapitalize_region,
Erik Naggum <erik@naggum.no>
parents:
12244
diff
changeset
|
207 casify_region (CASE_CAPITALIZE_UP, beg, end); |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
208 return Qnil; |
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
209 } |
118 | 210 |
211 Lisp_Object | |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
212 operate_on_word (arg, newpoint) |
118 | 213 Lisp_Object arg; |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
214 int *newpoint; |
118 | 215 { |
1505
4f138b03e5ab
* casefiddle.c (operate_on_word): Declare end to be an int, not a
Jim Blandy <jimb@redhat.com>
parents:
484
diff
changeset
|
216 Lisp_Object val; |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
217 int farend; |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
218 int iarg; |
118 | 219 |
220 CHECK_NUMBER (arg, 0); | |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
221 iarg = XINT (arg); |
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
222 farend = scan_words (point, iarg); |
118 | 223 if (!farend) |
12089
f7cb17ca1815
(casify_region): Use explicit local vars for start
Karl Heuer <kwzh@gnu.org>
parents:
9299
diff
changeset
|
224 farend = iarg > 0 ? ZV : BEGV; |
118 | 225 |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
226 *newpoint = point > farend ? point : farend; |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
227 XSETFASTINT (val, farend); |
118 | 228 |
229 return val; | |
230 } | |
231 | |
232 DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p", | |
233 "Convert following word (or ARG words) to upper case, moving over.\n\ | |
234 With negative argument, convert previous words but do not move.\n\ | |
235 See also `capitalize-word'.") | |
236 (arg) | |
237 Lisp_Object arg; | |
238 { | |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
239 Lisp_Object beg, end; |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
240 int newpoint; |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
241 XSETFASTINT (beg, point); |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
242 end = operate_on_word (arg, &newpoint); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
243 casify_region (CASE_UP, beg, end); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
244 SET_PT (newpoint); |
118 | 245 return Qnil; |
246 } | |
247 | |
248 DEFUN ("downcase-word", Fdowncase_word, Sdowncase_word, 1, 1, "p", | |
249 "Convert following word (or ARG words) to lower case, moving over.\n\ | |
250 With negative argument, convert previous words but do not move.") | |
251 (arg) | |
252 Lisp_Object arg; | |
253 { | |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
254 Lisp_Object beg, end; |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
255 int newpoint; |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
256 XSETFASTINT (beg, point); |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
257 end = operate_on_word (arg, &newpoint); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
258 casify_region (CASE_DOWN, beg, end); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
259 SET_PT (newpoint); |
118 | 260 return Qnil; |
261 } | |
262 | |
263 DEFUN ("capitalize-word", Fcapitalize_word, Scapitalize_word, 1, 1, "p", | |
264 "Capitalize the following word (or ARG words), moving over.\n\ | |
265 This gives the word(s) a first character in upper case\n\ | |
266 and the rest lower case.\n\ | |
267 With negative argument, capitalize previous words but do not move.") | |
268 (arg) | |
269 Lisp_Object arg; | |
270 { | |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
271 Lisp_Object beg, end; |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
272 int newpoint; |
9299
e8c880f2723e
(casify_object, operate_on_word, Fupcase_word, Fdowncase_word,
Karl Heuer <kwzh@gnu.org>
parents:
9137
diff
changeset
|
273 XSETFASTINT (beg, point); |
6221
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
274 end = operate_on_word (arg, &newpoint); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
275 casify_region (CASE_CAPITALIZE, beg, end); |
c2d29681d218
(operate_on_word): Don't move point; store in *NEWPOINT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
276 SET_PT (newpoint); |
118 | 277 return Qnil; |
278 } | |
279 | |
280 syms_of_casefiddle () | |
281 { | |
282 defsubr (&Supcase); | |
283 defsubr (&Sdowncase); | |
284 defsubr (&Scapitalize); | |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
285 defsubr (&Supcase_initials); |
118 | 286 defsubr (&Supcase_region); |
287 defsubr (&Sdowncase_region); | |
288 defsubr (&Scapitalize_region); | |
9053
4887fc1a2dda
(Fupcase_initials_region): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9052
diff
changeset
|
289 defsubr (&Supcase_initials_region); |
118 | 290 defsubr (&Supcase_word); |
291 defsubr (&Sdowncase_word); | |
292 defsubr (&Scapitalize_word); | |
293 } | |
294 | |
295 keys_of_casefiddle () | |
296 { | |
297 initial_define_key (control_x_map, Ctl('U'), "upcase-region"); | |
484 | 298 Fput (intern ("upcase-region"), Qdisabled, Qt); |
118 | 299 initial_define_key (control_x_map, Ctl('L'), "downcase-region"); |
484 | 300 Fput (intern ("downcase-region"), Qdisabled, Qt); |
301 | |
118 | 302 initial_define_key (meta_map, 'u', "upcase-word"); |
303 initial_define_key (meta_map, 'l', "downcase-word"); | |
304 initial_define_key (meta_map, 'c', "capitalize-word"); | |
305 } |