comparison src/cmds.c @ 6:27bc7f280385 r19-15b4

Import from CVS: tag r19-15b4
author cvs
date Mon, 13 Aug 2007 08:47:15 +0200
parents 376386a54a3c
children 4b173ad71786
comparison
equal deleted inserted replaced
5:49b78a777eb4 6:27bc7f280385
147 (arg, buffer) 147 (arg, buffer)
148 Lisp_Object arg, buffer; 148 Lisp_Object arg, buffer;
149 { 149 {
150 struct buffer *b = decode_buffer (buffer, 1); 150 struct buffer *b = decode_buffer (buffer, 1);
151 151
152 BUF_SET_PT(b, XINT (Fpoint_at_bol(arg, buffer)));
153 return Qnil;
154 }
155
156 DEFUN ("point-at-bol", Fpoint_at_bol, Spoint_at_bol, 0, 2, 0 /*
157 Return the character position of the first character on the current line.
158 With argument N not nil or 1, move forward N - 1 lines first.
159 If scan reaches end of buffer, return that position.
160 This function does not move point.
161 */ )
162 (arg, buffer)
163 {
164 struct buffer *b = decode_buffer (buffer, 1);
165 register int orig, end;
166
152 XSETBUFFER (buffer, b); 167 XSETBUFFER (buffer, b);
153 if (NILP (arg)) 168 if (NILP (arg))
154 arg = make_int (1); 169 arg = make_int (1);
155 else 170 else
156 CHECK_INT (arg); 171 CHECK_INT (arg);
157 172
173 orig = BUF_PT(b);
158 Fforward_line (make_int (XINT (arg) - 1), buffer); 174 Fforward_line (make_int (XINT (arg) - 1), buffer);
159 return Qnil; 175 end = BUF_PT(b);
176 BUF_SET_PT(b, orig);
177
178 return make_int (end);
160 } 179 }
161 180
162 DEFUN ("end-of-line", Fend_of_line, Send_of_line, 181 DEFUN ("end-of-line", Fend_of_line, Send_of_line,
163 0, 2, "_p" /* 182 0, 2, "_p" /*
164 Move point to end of current line. 183 Move point to end of current line.
169 (arg, buffer) 188 (arg, buffer)
170 Lisp_Object arg, buffer; 189 Lisp_Object arg, buffer;
171 { 190 {
172 struct buffer *buf = decode_buffer (buffer, 1); 191 struct buffer *buf = decode_buffer (buffer, 1);
173 192
193 BUF_SET_PT(buf, XINT (Fpoint_at_eol (arg, buffer)));
194 return Qnil;
195 }
196
197 DEFUN ("point-at-eol", Fpoint_at_eol, Spoint_at_eol, 0, 2, 0 /*
198 Return the character position of the last character on the current line.
199 With argument N not nil or 1, move forward N - 1 lines first.
200 If scan reaches end of buffer, return that position.
201 This function does not move point.
202 */ )
203 (arg, buffer)
204 {
205 struct buffer *buf = decode_buffer (buffer, 1);
206
174 XSETBUFFER (buffer, buf); 207 XSETBUFFER (buffer, buf);
175 208
176 if (NILP (arg)) 209 if (NILP (arg))
177 arg = make_int (1); 210 arg = make_int (1);
178 else 211 else
179 CHECK_INT (arg); 212 CHECK_INT (arg);
180 213
181 BUF_SET_PT (buf, find_before_next_newline (buf, BUF_PT (buf), 0, 214 return find_before_next_newline (buf, BUF_PT (buf), 0,
182 XINT (arg) - (XINT (arg) <= 0))); 215 XINT (arg) - (XINT (arg) <= 0));
183 return Qnil;
184 } 216 }
185 217
186 DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "*p\nP" /* 218 DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "*p\nP" /*
187 Delete the following ARG characters (previous, with negative arg). 219 Delete the following ARG characters (previous, with negative arg).
188 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). 220 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).