comparison src/casefiddle.c @ 91803:78fbdbd37286

(casify_region): Only call after-change and composition functions on the part of the region that was changed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Feb 2008 21:25:45 +0000
parents 606f2d163a64
children 139d0b227fdc
comparison
equal deleted inserted replaced
91802:3a35316b344f 91803:78fbdbd37286
177 Lisp_Object b, e; 177 Lisp_Object b, e;
178 { 178 {
179 register int c; 179 register int c;
180 register int inword = flag == CASE_DOWN; 180 register int inword = flag == CASE_DOWN;
181 register int multibyte = !NILP (current_buffer->enable_multibyte_characters); 181 register int multibyte = !NILP (current_buffer->enable_multibyte_characters);
182 int start, end; 182 EMACS_INT start, end;
183 int start_byte, end_byte; 183 EMACS_INT start_byte, end_byte;
184 int changed = 0; 184 EMACS_INT first = -1, last; /* Position of first and last changes. */
185 int opoint = PT; 185 EMACS_INT opoint = PT;
186 int opoint_byte = PT_BYTE; 186 EMACS_INT opoint_byte = PT_BYTE;
187 187
188 if (EQ (b, e)) 188 if (EQ (b, e))
189 /* Not modifying because nothing marked */ 189 /* Not modifying because nothing marked */
190 return; 190 return;
191 191
224 c = UPCASE1 (c); 224 c = UPCASE1 (c);
225 if ((int) flag >= (int) CASE_CAPITALIZE) 225 if ((int) flag >= (int) CASE_CAPITALIZE)
226 inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c))); 226 inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c)));
227 if (c != c2) 227 if (c != c2)
228 { 228 {
229 changed = 1; 229 last = start;
230 if (first < 0)
231 first = start;
232
230 if (! multibyte) 233 if (! multibyte)
231 { 234 {
232 MAKE_CHAR_UNIBYTE (c); 235 MAKE_CHAR_UNIBYTE (c);
233 FETCH_BYTE (start_byte) = c; 236 FETCH_BYTE (start_byte) = c;
234 } 237 }
264 } 267 }
265 268
266 if (PT != opoint) 269 if (PT != opoint)
267 TEMP_SET_PT_BOTH (opoint, opoint_byte); 270 TEMP_SET_PT_BOTH (opoint, opoint_byte);
268 271
269 if (changed) 272 if (first >= 0)
270 { 273 {
271 start = XFASTINT (b); 274 signal_after_change (first, last + 1 - first, last + 1 - first);
272 signal_after_change (start, end - start, end - start); 275 update_compositions (first, last + 1, CHECK_ALL);
273 update_compositions (start, end, CHECK_ALL);
274 } 276 }
275 } 277 }
276 278
277 DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r", 279 DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r",
278 doc: /* Convert the region to upper case. In programs, wants two arguments. 280 doc: /* Convert the region to upper case. In programs, wants two arguments.