diff options
Diffstat (limited to 'src/casefiddle.c')
-rw-r--r-- | src/casefiddle.c | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c index d508deb5d60..467ffa976f2 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -1,5 +1,5 @@ /* GNU Emacs case conversion functions. - Copyright (C) 1985 Free Software Foundation, Inc. + Copyright (C) 1985, 1990 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -70,9 +70,7 @@ casify_object (flag, obj) } DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0, - "Convert argument to upper case and return that.\n\ -The argument may be a character or string. The result has the same type.\n\ -The argument object is not altered. See also `capitalize'.") + "One arg, a character or string. Convert it to upper case and return that.") (obj) Lisp_Object obj; { @@ -80,9 +78,7 @@ The argument object is not altered. See also `capitalize'.") } DEFUN ("downcase", Fdowncase, Sdowncase, 1, 1, 0, - "Convert argument to lower case and return that.\n\ -The argument may be a character or string. The result has the same type.\n\ -The argument object is not altered.") + "One arg, a character or string. Convert it to lower case and return that.") (obj) Lisp_Object obj; { @@ -90,11 +86,8 @@ The argument object is not altered.") } DEFUN ("capitalize", Fcapitalize, Scapitalize, 1, 1, 0, - "Convert argument to capitalized form and return that.\n\ -This means that each word's first character is upper case\n\ -and the rest is lower case.\n\ -The argument may be a character or string. The result has the same type.\n\ -The argument object is not altered.") + "One arg, a character or string. Convert it to capitalized form and return that.\n\ +This means that each word's first character is upper case and the rest is lower case.") (obj) Lisp_Object obj; { @@ -112,12 +105,8 @@ casify_region (flag, b, e) register int c; register int inword = flag == CASE_DOWN; - if (EQ (b, e)) - /* Not modifying because nothing marked */ - return; - validate_region (&b, &e); - modify_region (XFASTINT (b), XFASTINT (e)); + prepare_to_modify_buffer (); record_change (XFASTINT (b), XFASTINT (e) - XFASTINT (b)); for (i = XFASTINT (b); i < XFASTINT (e); i++) @@ -133,17 +122,14 @@ casify_region (flag, b, e) inword = SYNTAX (c) == Sword; } - signal_after_change (XFASTINT (b), - XFASTINT (e) - XFASTINT (b), - XFASTINT (e) - XFASTINT (b)); + modify_region (XFASTINT (b), XFASTINT (e)); } DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r", "Convert the region to upper case. In programs, wants two arguments.\n\ These arguments specify the starting and ending character numbers of\n\ the region to operate on. When used as a command, the text between\n\ -point and the mark is operated on.\n\ -See also `capitalize-region'.") +point and the mark is operated on.") (b, e) Lisp_Object b, e; { @@ -164,11 +150,12 @@ point and the mark is operated on.") } DEFUN ("capitalize-region", Fcapitalize_region, Scapitalize_region, 2, 2, "r", - "Convert the region to capitalized form.\n\ + "Convert the region to upper case. In programs, wants two arguments.\n\ +These arguments specify the starting and ending character numbers of\n\ +the region to operate on. When used as a command, the text between\n\ +point and the mark is operated on.\n\ Capitalized form means each word's first character is upper case\n\ -and the rest of it is lower case.\n\ -In programs, give two arguments, the starting and ending\n\ -character positions to operate on.") +and the rest of it is lower case.") (b, e) Lisp_Object b, e; { @@ -190,30 +177,26 @@ Lisp_Object operate_on_word (arg) Lisp_Object arg; { - Lisp_Object val, end; + Lisp_Object end, val; int farend; CHECK_NUMBER (arg, 0); farend = scan_words (point, XINT (arg)); if (!farend) farend = XINT (arg) > 0 ? ZV : BEGV; - end = point > farend ? point : farend; SET_PT (end); XFASTINT (val) = farend; - return val; } DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p", "Convert following word (or ARG words) to upper case, moving over.\n\ -With negative argument, convert previous words but do not move.\n\ -See also `capitalize-word'.") +With negative argument, convert previous words but do not move.") (arg) Lisp_Object arg; { Lisp_Object opoint; - XFASTINT (opoint) = point; casify_region (CASE_UP, opoint, operate_on_word (arg)); return Qnil; @@ -260,9 +243,9 @@ syms_of_casefiddle () keys_of_casefiddle () { - initial_define_key (control_x_map, Ctl('U'), "upcase-region"); - initial_define_key (control_x_map, Ctl('L'), "downcase-region"); - initial_define_key (meta_map, 'u', "upcase-word"); - initial_define_key (meta_map, 'l', "downcase-word"); - initial_define_key (meta_map, 'c', "capitalize-word"); + ndefkey (Vctl_x_map, Ctl('U'), "upcase-region"); + ndefkey (Vctl_x_map, Ctl('L'), "downcase-region"); + ndefkey (Vesc_map, 'u', "upcase-word"); + ndefkey (Vesc_map, 'l', "downcase-word"); + ndefkey (Vesc_map, 'c', "capitalize-word"); } |