comparison src/cmds.c @ 74:54cc21c15cbb r20-0b32

Import from CVS: tag r20-0b32
author cvs
date Mon, 13 Aug 2007 09:04:33 +0200
parents 131b0175ea99
children 0d2f883870bc
comparison
equal deleted inserted replaced
73:e2d7a37b7c8d 74:54cc21c15cbb
132 shortage--; 132 shortage--;
133 BUF_SET_PT (buf, pos); 133 BUF_SET_PT (buf, pos);
134 return make_int (negp ? - shortage : shortage); 134 return make_int (negp ? - shortage : shortage);
135 } 135 }
136 136
137 DEFUN ("point-at-bol", Fpoint_at_bol, 0, 2, 0, /*
138 Return the character position of the first character on the current line.
139 With argument N not nil or 1, move forward N - 1 lines first.
140 If scan reaches end of buffer, return that position.
141 This function does not move point.
142 */
143 (arg, buffer))
144 {
145 struct buffer *b = decode_buffer (buffer, 1);
146 register int orig, end;
147
148 XSETBUFFER (buffer, b);
149 if (NILP (arg))
150 arg = make_int (1);
151 else
152 CHECK_INT (arg);
153
154 orig = BUF_PT(b);
155 Fforward_line (make_int (XINT (arg) - 1), buffer);
156 end = BUF_PT(b);
157 BUF_SET_PT(b, orig);
158
159 return make_int (end);
160 }
161
137 DEFUN ("beginning-of-line", Fbeginning_of_line, 0, 2, "_p", /* 162 DEFUN ("beginning-of-line", Fbeginning_of_line, 0, 2, "_p", /*
138 Move point to beginning of current line. 163 Move point to beginning of current line.
139 With argument ARG not nil or 1, move forward ARG - 1 lines first. 164 With argument ARG not nil or 1, move forward ARG - 1 lines first.
140 If scan reaches end of buffer, stop there without error. 165 If scan reaches end of buffer, stop there without error.
141 If BUFFER is nil, the current buffer is assumed. 166 If BUFFER is nil, the current buffer is assumed.
142 */ 167 */
143 (arg, buffer)) 168 (arg, buffer))
144 { 169 {
145 struct buffer *b = decode_buffer (buffer, 1); 170 struct buffer *b = decode_buffer (buffer, 1);
146 171
147 XSETBUFFER (buffer, b); 172 BUF_SET_PT(b, XINT (Fpoint_at_bol(arg, buffer)));
173 return Qnil;
174 }
175
176 DEFUN ("point-at-eol", Fpoint_at_eol, 0, 2, 0, /*
177 Return the character position of the last character on the current line.
178 With argument N not nil or 1, move forward N - 1 lines first.
179 If scan reaches end of buffer, return that position.
180 This function does not move point.
181 */
182 (arg, buffer))
183 {
184 struct buffer *buf = decode_buffer (buffer, 1);
185
186 XSETBUFFER (buffer, buf);
187
148 if (NILP (arg)) 188 if (NILP (arg))
149 arg = make_int (1); 189 arg = make_int (1);
150 else 190 else
151 CHECK_INT (arg); 191 CHECK_INT (arg);
152 192
153 Fforward_line (make_int (XINT (arg) - 1), buffer); 193 return make_int (find_before_next_newline (buf, BUF_PT (buf), 0,
154 return Qnil; 194 XINT (arg) - (XINT (arg) <= 0)));
155 } 195 }
156 196
157 DEFUN ("end-of-line", Fend_of_line, 0, 2, "_p", /* 197 DEFUN ("end-of-line", Fend_of_line, 0, 2, "_p", /*
158 Move point to end of current line. 198 Move point to end of current line.
159 With argument ARG not nil or 1, move forward ARG - 1 lines first. 199 With argument ARG not nil or 1, move forward ARG - 1 lines first.
160 If scan reaches end of buffer, stop there without error. 200 If scan reaches end of buffer, stop there without error.
161 If BUFFER is nil, the current buffer is assumed. 201 If BUFFER is nil, the current buffer is assumed.
162 */ 202 */
163 (arg, buffer)) 203 (arg, buffer))
164 { 204 {
165 struct buffer *buf = decode_buffer (buffer, 1); 205 struct buffer *b = decode_buffer (buffer, 1);
166 206
167 XSETBUFFER (buffer, buf); 207 BUF_SET_PT(b, XINT (Fpoint_at_eol (arg, buffer)));
168
169 if (NILP (arg))
170 arg = make_int (1);
171 else
172 CHECK_INT (arg);
173
174 BUF_SET_PT (buf, find_before_next_newline (buf, BUF_PT (buf), 0,
175 XINT (arg) - (XINT (arg) <= 0)));
176 return Qnil; 208 return Qnil;
177 } 209 }
178 210
179 DEFUN ("delete-char", Fdelete_char, 1, 2, "*p\nP", /* 211 DEFUN ("delete-char", Fdelete_char, 1, 2, "*p\nP", /*
180 Delete the following ARG characters (previous, with negative arg). 212 Delete the following ARG characters (previous, with negative arg).
415 DEFSUBR (Fbackward_char); 447 DEFSUBR (Fbackward_char);
416 DEFSUBR (Fforward_line); 448 DEFSUBR (Fforward_line);
417 DEFSUBR (Fbeginning_of_line); 449 DEFSUBR (Fbeginning_of_line);
418 DEFSUBR (Fend_of_line); 450 DEFSUBR (Fend_of_line);
419 451
452 DEFSUBR (Fpoint_at_bol);
453 DEFSUBR (Fpoint_at_eol);
454
420 DEFSUBR (Fdelete_char); 455 DEFSUBR (Fdelete_char);
421 DEFSUBR (Fdelete_backward_char); 456 DEFSUBR (Fdelete_backward_char);
422 457
423 DEFSUBR (Fself_insert_command); 458 DEFSUBR (Fself_insert_command);
424 DEFSUBR (Fself_insert_internal); 459 DEFSUBR (Fself_insert_internal);