annotate src/casefiddle.c @ 5284:d27c1ee1943b

Make the order of preloaded-file-list more sane. lisp/ChangeLog addition: 2010-10-12 Aidan Kehoe <kehoea@parhasard.net> * abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table): Create both these abbrev tables using the usual #'define-abbrev-table calls, rather than attempting to special-case them. * cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is being loaded interpreted. Previously other, later files would redundantly call (load "cl-macs") when interpreted, it's more reasonable to do it here, once. * cmdloop.el (read-quoted-char-radix): Use defcustom here, we don't have any dump-order dependencies that would prevent that. * custom.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling, rely on cl-extra.el in the former case and the appropriate entry in bytecomp-load-hook in the latter. Get rid of custom-declare-variable-list, we have no dump-time dependencies that would require it. * faces.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling. * packages.el: Remove some inaccurate comments. * post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not here, now the order of preloaded-file-list has been changed to make it available. * subr.el (custom-declare-variable-list): Remove. No need for it. Also remove a stub define-abbrev-table from this file, given the current order of preloaded-file-list there's no need for it.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 12 Oct 2010 21:11:46 +0100
parents 6bc1f3f6cf0d
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* XEmacs case conversion functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 771
diff changeset
3 Copyright (C) 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: FSF 19.34, but substantially rewritten by Martin. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "insdel.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "syntax.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
4910
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
31 enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP,
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
32 CASE_CANONICALIZE};
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 static Lisp_Object
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
35 casify_object (enum case_action flag, Lisp_Object string_or_char,
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
36 Lisp_Object buffer)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 struct buffer *buf = decode_buffer (buffer, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 retry:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
42 if (CHAR_OR_CHAR_INTP (string_or_char))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
44 Ichar c;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
45 CHECK_CHAR_COERCE_INT (string_or_char);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
46 c = XCHAR (string_or_char);
4910
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
47 if (flag == CASE_DOWN)
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
48 {
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
49 c = DOWNCASE (buf, c);
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
50 }
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
51 else if (flag == CASE_UP)
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
52 {
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
53 c = UPCASE (buf, c);
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
54 }
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
55 else
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
56 {
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
57 c = CANONCASE (buf, c);
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
58 }
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
59
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 return make_char (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
63 if (STRINGP (string_or_char))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 {
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 771
diff changeset
65 Lisp_Object syntax_table = buf->mirror_syntax_table;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
66 Ibyte *storage =
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 867
diff changeset
67 alloca_ibytes (XSTRING_LENGTH (string_or_char) * MAX_ICHAR_LEN);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
68 Ibyte *newp = storage;
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
69 Ibyte *oldp = XSTRING_DATA (string_or_char);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
70 Ibyte *endp = oldp + XSTRING_LENGTH (string_or_char);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 int wordp = 0, wordp_prev;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
73 while (oldp < endp)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
75 Ichar c = itext_ichar (oldp);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 switch (flag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 case CASE_UP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 c = UPCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 case CASE_DOWN:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 c = DOWNCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 break;
4910
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
84 case CASE_CANONICALIZE:
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
85 c = CANONCASE (buf, c);
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
86 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 case CASE_CAPITALIZE:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 case CASE_CAPITALIZE_UP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 wordp_prev = wordp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 wordp = WORD_SYNTAX_P (syntax_table, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 if (!wordp) break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 if (wordp_prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 if (flag == CASE_CAPITALIZE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 c = DOWNCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 c = UPCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
102 newp += set_itext_ichar (newp, c);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
103 INC_IBYTEPTR (oldp);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 return make_string (storage, newp - storage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
109 string_or_char = wrong_type_argument (Qchar_or_string_p, string_or_char);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 goto retry;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 DEFUN ("upcase", Fupcase, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
114 Convert STRING-OR-CHAR to upper case and return that.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
115 STRING-OR-CHAR may be a character or string. The result has the same type.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
116 STRING-OR-CHAR is not altered--the value is a copy.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 See also `capitalize', `downcase' and `upcase-initials'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 Optional second arg BUFFER specifies which buffer's case tables to use,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 and defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
121 (string_or_char, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
123 return casify_object (CASE_UP, string_or_char, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 DEFUN ("downcase", Fdowncase, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
127 Convert STRING-OR-CHAR to lower case and return that.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
128 STRING-OR-CHAR may be a character or string. The result has the same type.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
129 STRING-OR-CHAR is not altered--the value is a copy.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 Optional second arg BUFFER specifies which buffer's case tables to use,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 and defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
133 (string_or_char, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
135 return casify_object (CASE_DOWN, string_or_char, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137
4910
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
138 DEFUN ("canoncase", Fcanoncase, 1, 2, 0, /*
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
139 Convert STRING-OR-CHAR to its canonical lowercase form and return that.
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
140
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
141 STRING-OR-CHAR may be a character or string. The result has the same type.
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
142 STRING-OR-CHAR is not altered--the value is a copy.
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
143
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
144 Optional second arg BUFFER specifies which buffer's case tables to use,
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
145 and defaults to the current buffer.
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
146
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
147 For any N characters that are equivalent in case-insensitive searching,
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
148 their canonical lowercase character will be the same.
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
149 */
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
150 (string_or_char, buffer))
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
151 {
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
152 return casify_object (CASE_CANONICALIZE, string_or_char, buffer);
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
153 }
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
154
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 DEFUN ("capitalize", Fcapitalize, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
156 Convert STRING-OR-CHAR to capitalized form and return that.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 This means that each word's first character is upper case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 and the rest is lower case.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
159 STRING-OR-CHAR may be a character or string. The result has the same type.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
160 STRING-OR-CHAR is not altered--the value is a copy.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 Optional second arg BUFFER specifies which buffer's case tables to use,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 and defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
164 (string_or_char, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
166 return casify_object (CASE_CAPITALIZE, string_or_char, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 /* Like Fcapitalize but change only the initial characters. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 DEFUN ("upcase-initials", Fupcase_initials, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
172 Convert the initial of each word in STRING-OR-CHAR to upper case.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 Do not change the other letters of each word.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
174 STRING-OR-CHAR may be a character or string. The result has the same type.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
175 STRING-OR-CHAR is not altered--the value is a copy.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 Optional second arg BUFFER specifies which buffer's case tables to use,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 and defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
179 (string_or_char, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
181 return casify_object (CASE_CAPITALIZE_UP, string_or_char, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
185 START and END specify range of buffer to operate on. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 static void
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
188 casify_region_internal (enum case_action flag, Lisp_Object start,
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
189 Lisp_Object end, struct buffer *buf)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* This function can GC */
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 444
diff changeset
192 Charbpos pos, s, e;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 771
diff changeset
193 Lisp_Object syntax_table = buf->mirror_syntax_table;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 int mccount;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 int wordp = 0, wordp_prev;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
197 if (EQ (start, end))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* Not modifying because nothing marked */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
201 get_buffer_range_char (buf, start, end, &s, &e, 0);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
202
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
203 mccount = begin_multiple_change (buf, s, e);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
204 record_change (buf, s, e - s);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
206 for (pos = s; pos < e; pos++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
208 Ichar oldc = BUF_FETCH_CHAR (buf, pos);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
209 Ichar c = oldc;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 switch (flag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 case CASE_UP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 c = UPCASE (buf, oldc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 case CASE_DOWN:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 c = DOWNCASE (buf, oldc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 case CASE_CAPITALIZE:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 case CASE_CAPITALIZE_UP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 /* !!#### need to revalidate the start and end pointers in case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 the buffer was changed */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 wordp_prev = wordp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 wordp = WORD_SYNTAX_P (syntax_table, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 if (!wordp) continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 if (wordp_prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 if (flag == CASE_CAPITALIZE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 c = DOWNCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 c = UPCASE (buf, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 if (oldc == c) continue;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
237 buffer_replace_char (buf, pos, c, 1, (pos == s));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 BUF_MODIFF (buf)++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 end_multiple_change (buf, mccount);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 static Lisp_Object
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
245 casify_region (enum case_action flag, Lisp_Object start, Lisp_Object end,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 Lisp_Object buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
248 casify_region_internal (flag, start, end, decode_buffer (buffer, 1));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 DEFUN ("upcase-region", Fupcase_region, 2, 3, "r", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 Convert the region to upper case. In programs, wants two arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 These arguments specify the starting and ending character numbers of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 the region to operate on. When used as a command, the text between
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 point and the mark is operated on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 See also `capitalize-region'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 Optional third arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
260 (start, end, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
263 return casify_region (CASE_UP, start, end, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 DEFUN ("downcase-region", Fdowncase_region, 2, 3, "r", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 Convert the region to lower case. In programs, wants two arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 These arguments specify the starting and ending character numbers of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 the region to operate on. When used as a command, the text between
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 point and the mark is operated on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 Optional third arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
273 (start, end, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
276 return casify_region (CASE_DOWN, start, end, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 DEFUN ("capitalize-region", Fcapitalize_region, 2, 3, "r", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 Convert the region to capitalized form.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 Capitalized form means each word's first character is upper case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 and the rest of it is lower case.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 In programs, give two arguments, the starting and ending
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 character positions to operate on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 Optional third arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
287 (start, end, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
290 return casify_region (CASE_CAPITALIZE, start, end, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /* Like Fcapitalize_region but change only the initials. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 DEFUN ("upcase-initials-region", Fupcase_initials_region, 2, 3, "r", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 Upcase the initial of each word in the region.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 Subsequent letters of each word are not changed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 In programs, give two arguments, the starting and ending
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 character positions to operate on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 Optional third arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
302 (start, end, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
304 return casify_region (CASE_CAPITALIZE_UP, start, end, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 casify_word (enum case_action flag, Lisp_Object arg, Lisp_Object buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 444
diff changeset
311 Charbpos farend;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 struct buffer *buf = decode_buffer (buffer, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 CHECK_INT (arg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 farend = scan_words (buf, BUF_PT (buf), XINT (arg));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 if (!farend)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 farend = XINT (arg) > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 casify_region_internal (flag, make_int (BUF_PT (buf)), make_int (farend), buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 BUF_SET_PT (buf, max (BUF_PT (buf), farend));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 DEFUN ("upcase-word", Fupcase_word, 1, 2, "p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
326 Convert following word (or COUNT words) to upper case, moving over.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 With negative argument, convert previous words but do not move.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 See also `capitalize-word'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 Optional second arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
331 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
334 return casify_word (CASE_UP, count, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 DEFUN ("downcase-word", Fdowncase_word, 1, 2, "p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
338 Convert following word (or COUNT words) to lower case, moving over.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 With negative argument, convert previous words but do not move.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 Optional second arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
342 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
345 return casify_word (CASE_DOWN, count, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 DEFUN ("capitalize-word", Fcapitalize_word, 1, 2, "p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
349 Capitalize the following word (or COUNT words), moving over.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 This gives the word(s) a first character in upper case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 and the rest lower case.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 With negative argument, capitalize previous words but do not move.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 Optional second arg BUFFER defaults to the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
355 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
358 return casify_word (CASE_CAPITALIZE, count, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 syms_of_casefiddle (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 DEFSUBR (Fupcase);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 DEFSUBR (Fdowncase);
4910
6bc1f3f6cf0d Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2367
diff changeset
367 DEFSUBR (Fcanoncase);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 DEFSUBR (Fcapitalize);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 DEFSUBR (Fupcase_initials);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 DEFSUBR (Fupcase_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 DEFSUBR (Fdowncase_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 DEFSUBR (Fcapitalize_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 DEFSUBR (Fupcase_initials_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 DEFSUBR (Fupcase_word);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 DEFSUBR (Fdowncase_word);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 DEFSUBR (Fcapitalize_word);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 }