Mercurial > emacs
comparison src/editfns.c @ 16639:b6ba5d371c1c
(Fline_beginning_position, Fline_end_position): New fns.
(Fuser_full_name): Accept an optional UID and return
the full name of that user instead.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 08 Dec 1996 08:18:52 +0000 |
parents | f34bfb5aa684 |
children | 2103a88cc61f |
comparison
equal
deleted
inserted
replaced
16638:ee85ec2c4203 | 16639:b6ba5d371c1c |
---|---|
250 If you set the marker not to point anywhere, the buffer will have no mark.") | 250 If you set the marker not to point anywhere, the buffer will have no mark.") |
251 () | 251 () |
252 { | 252 { |
253 return current_buffer->mark; | 253 return current_buffer->mark; |
254 } | 254 } |
255 | 255 |
256 DEFUN ("line-beginning-position", Fline_beginning_position, Sline_beginning_position, | |
257 0, 1, 0, | |
258 "Return the character position of the first character on the current line.\n\ | |
259 With argument N not nil or 1, move forward N - 1 lines first.\n\ | |
260 If scan reaches end of buffer, return that position.\n\ | |
261 This function does not move point.") | |
262 (n) | |
263 Lisp_Object n; | |
264 { | |
265 register int orig, end; | |
266 | |
267 if (NILP (n)) | |
268 XSETFASTINT (n, 1); | |
269 else | |
270 CHECK_NUMBER (n, 0); | |
271 | |
272 orig = PT; | |
273 Fforward_line (make_number (XINT (n) - 1)); | |
274 end = PT; | |
275 SET_PT (orig); | |
276 | |
277 return make_number (end); | |
278 } | |
279 | |
280 DEFUN ("line-end-position", Fline_end_position, Sline_end_position, | |
281 0, 1, 0, | |
282 "Return the character position of the last character on the current line.\n\ | |
283 With argument N not nil or 1, move forward N - 1 lines first.\n\ | |
284 If scan reaches end of buffer, return that position.\n\ | |
285 This function does not move point.") | |
286 (n) | |
287 Lisp_Object n; | |
288 { | |
289 if (NILP (n)) | |
290 XSETFASTINT (n, 1); | |
291 else | |
292 CHECK_NUMBER (n, 0); | |
293 | |
294 return make_number (find_before_next_newline | |
295 (PT, 0, XINT (n) - (XINT (n) <= 0))); | |
296 } | |
297 | |
256 Lisp_Object | 298 Lisp_Object |
257 save_excursion_save () | 299 save_excursion_save () |
258 { | 300 { |
259 register int visible = (XBUFFER (XWINDOW (selected_window)->buffer) | 301 register int visible = (XBUFFER (XWINDOW (selected_window)->buffer) |
260 == current_buffer); | 302 == current_buffer); |
539 () | 581 () |
540 { | 582 { |
541 return make_number (getuid ()); | 583 return make_number (getuid ()); |
542 } | 584 } |
543 | 585 |
544 DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 0, 0, | 586 DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0, |
545 "Return the full name of the user logged in, as a string.") | 587 "Return the full name of the user logged in, as a string.\n\ |
546 () | 588 If optional argument UID is an integer, return the full name of the user\n\ |
547 { | 589 with that uid, or nil if there is no such user.") |
548 return Vuser_full_name; | 590 (uid) |
591 Lisp_Object uid; | |
592 { | |
593 struct passwd *pw; | |
594 | |
595 if (NILP (uid)) | |
596 return Vuser_full_name; | |
597 | |
598 CHECK_NUMBER (uid, 0); | |
599 pw = (struct passwd *) getpwuid (XINT (uid)); | |
600 return (pw ? build_string (pw->pw_gecos) : Qnil); | |
549 } | 601 } |
550 | 602 |
551 DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, | 603 DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, |
552 "Return the name of the machine you are running on, as a string.") | 604 "Return the name of the machine you are running on, as a string.") |
553 () | 605 () |
2535 defsubr (&Spoint_max); | 2587 defsubr (&Spoint_max); |
2536 defsubr (&Spoint_min); | 2588 defsubr (&Spoint_min); |
2537 defsubr (&Spoint_min_marker); | 2589 defsubr (&Spoint_min_marker); |
2538 defsubr (&Spoint_max_marker); | 2590 defsubr (&Spoint_max_marker); |
2539 | 2591 |
2592 defsubr (&Sline_beginning_position); | |
2593 defsubr (&Sline_end_position); | |
2594 | |
2540 defsubr (&Sbobp); | 2595 defsubr (&Sbobp); |
2541 defsubr (&Seobp); | 2596 defsubr (&Seobp); |
2542 defsubr (&Sbolp); | 2597 defsubr (&Sbolp); |
2543 defsubr (&Seolp); | 2598 defsubr (&Seolp); |
2544 defsubr (&Sfollowing_char); | 2599 defsubr (&Sfollowing_char); |