Mercurial > hg > xemacs-beta
comparison src/editfns.c @ 149:538048ae2ab8 r20-3b1
Import from CVS: tag r20-3b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:36:16 +0200 |
parents | 8619ce7e4c50 |
children | 59463afc5666 |
comparison
equal
deleted
inserted
replaced
148:f659db2a1f73 | 149:538048ae2ab8 |
---|---|
200 struct Lisp_String *p; | 200 struct Lisp_String *p; |
201 CHECK_STRING (str); | 201 CHECK_STRING (str); |
202 | 202 |
203 p = XSTRING (str); | 203 p = XSTRING (str); |
204 if (string_length (p) != 0) | 204 if (string_length (p) != 0) |
205 { | 205 return make_char (string_char (p, 0)); |
206 return (make_char (string_char (p, 0))); | |
207 } | |
208 else /* #### Gag me! */ | 206 else /* #### Gag me! */ |
209 return (Qzero); | 207 return Qzero; |
210 } | 208 } |
211 | 209 |
212 | 210 |
213 static Lisp_Object | 211 static Lisp_Object |
214 buildmark (Bufpos val, Lisp_Object buffer) | 212 buildmark (Bufpos val, Lisp_Object buffer) |
224 Beginning of buffer is position (point-min). | 222 Beginning of buffer is position (point-min). |
225 If BUFFER is nil, the current buffer is assumed. | 223 If BUFFER is nil, the current buffer is assumed. |
226 */ | 224 */ |
227 (buffer)) | 225 (buffer)) |
228 { | 226 { |
229 struct buffer *b = decode_buffer (buffer, 1); | 227 return make_int (BUF_PT (decode_buffer (buffer, 1))); |
230 return (make_int (BUF_PT (b))); | |
231 } | 228 } |
232 | 229 |
233 DEFUN ("point-marker", Fpoint_marker, 0, 2, 0, /* | 230 DEFUN ("point-marker", Fpoint_marker, 0, 2, 0, /* |
234 Return value of point, as a marker object. | 231 Return value of point, as a marker object. |
235 This marker is a copy; you may modify it with reckless abandon. | 232 This marker is a copy; you may modify it with reckless abandon. |
292 { | 289 { |
293 struct buffer *b = decode_buffer (buffer, 1); | 290 struct buffer *b = decode_buffer (buffer, 1); |
294 Bufpos n = get_buffer_pos_char (b, position, GB_COERCE_RANGE); | 291 Bufpos n = get_buffer_pos_char (b, position, GB_COERCE_RANGE); |
295 BUF_SET_PT (b, n); | 292 BUF_SET_PT (b, n); |
296 atomic_extent_goto_char_p = 1; | 293 atomic_extent_goto_char_p = 1; |
297 return (make_int (n)); | 294 return make_int (n); |
298 } | 295 } |
299 | 296 |
300 static Lisp_Object | 297 static Lisp_Object |
301 region_limit (int beginningp, struct buffer *b) | 298 region_limit (int beginningp, struct buffer *b) |
302 { | 299 { |
308 Fsignal (Qmark_inactive, Qnil); | 305 Fsignal (Qmark_inactive, Qnil); |
309 #endif | 306 #endif |
310 m = Fmarker_position (b->mark); | 307 m = Fmarker_position (b->mark); |
311 if (NILP (m)) error ("There is no region now"); | 308 if (NILP (m)) error ("There is no region now"); |
312 if (!!(BUF_PT (b) < XINT (m)) == !!beginningp) | 309 if (!!(BUF_PT (b) < XINT (m)) == !!beginningp) |
313 return (make_int (BUF_PT (b))); | 310 return make_int (BUF_PT (b)); |
314 else | 311 else |
315 return (m); | 312 return m; |
316 } | 313 } |
317 | 314 |
318 DEFUN ("region-beginning", Fregion_beginning, 0, 1, 0, /* | 315 DEFUN ("region-beginning", Fregion_beginning, 0, 1, 0, /* |
319 Return position of beginning of region, as an integer. | 316 Return position of beginning of region, as an integer. |
320 If BUFFER is nil, the current buffer is assumed. | 317 If BUFFER is nil, the current buffer is assumed. |
328 Return position of end of region, as an integer. | 325 Return position of end of region, as an integer. |
329 If BUFFER is nil, the current buffer is assumed. | 326 If BUFFER is nil, the current buffer is assumed. |
330 */ | 327 */ |
331 (buffer)) | 328 (buffer)) |
332 { | 329 { |
333 return (region_limit (0, decode_buffer (buffer, 1))); | 330 return region_limit (0, decode_buffer (buffer, 1)); |
334 } | 331 } |
335 | 332 |
336 /* Whether to use lispm-style active-regions */ | 333 /* Whether to use lispm-style active-regions */ |
337 int zmacs_regions; | 334 int zmacs_regions; |
338 | 335 |
530 is in effect, in which case it is less. | 527 is in effect, in which case it is less. |
531 If BUFFER is nil, the current buffer is assumed. | 528 If BUFFER is nil, the current buffer is assumed. |
532 */ | 529 */ |
533 (buffer)) | 530 (buffer)) |
534 { | 531 { |
535 struct buffer *b = decode_buffer (buffer, 1); | 532 return make_int (BUF_ZV (decode_buffer (buffer,1))); |
536 return (make_int (BUF_ZV (b))); | |
537 } | 533 } |
538 | 534 |
539 DEFUN ("point-max-marker", Fpoint_max_marker, 0, 1, 0, /* | 535 DEFUN ("point-max-marker", Fpoint_max_marker, 0, 1, 0, /* |
540 Return a marker to the maximum permissible value of point BUFFER. | 536 Return a marker to the maximum permissible value of point BUFFER. |
541 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) | 537 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) |
699 user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ | 695 user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ |
700 #else /* WINDOWSNT */ | 696 #else /* WINDOWSNT */ |
701 user_name = (char *) getenv ("USER"); | 697 user_name = (char *) getenv ("USER"); |
702 #endif /* WINDOWSNT */ | 698 #endif /* WINDOWSNT */ |
703 if (user_name) | 699 if (user_name) |
704 return (build_string (user_name)); | 700 return build_string (user_name); |
705 else | 701 else |
706 pw = (struct passwd *) getpwuid (geteuid ()); | 702 pw = (struct passwd *) getpwuid (geteuid ()); |
707 } | 703 } |
708 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ | 704 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ |
709 return (pw ? build_string (pw->pw_name) : Qnil); | 705 return pw ? build_string (pw->pw_name) : Qnil; |
710 } | 706 } |
711 | 707 |
712 DEFUN ("user-real-login-name", Fuser_real_login_name, 0, 0, 0, /* | 708 DEFUN ("user-real-login-name", Fuser_real_login_name, 0, 0, 0, /* |
713 Return the name of the user's real uid, as a string. | 709 Return the name of the user's real uid, as a string. |
714 This ignores the environment variables LOGNAME and USER, so it differs from | 710 This ignores the environment variables LOGNAME and USER, so it differs from |
1050 This feature lets (apply 'encode-time (decode-time ...)) work. | 1046 This feature lets (apply 'encode-time (decode-time ...)) work. |
1051 | 1047 |
1052 Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed; | 1048 Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed; |
1053 for example, a DAY of 0 means the day preceding the given month. | 1049 for example, a DAY of 0 means the day preceding the given month. |
1054 Year numbers less than 100 are treated just like other year numbers. | 1050 Year numbers less than 100 are treated just like other year numbers. |
1055 If you want them to stand for years in this century, you must do that yourself | 1051 If you want them to stand for years in this century, you must do that yourself. |
1056 */ | 1052 */ |
1057 (int nargs, Lisp_Object *args)) | 1053 (int nargs, Lisp_Object *args)) |
1058 { | 1054 { |
1059 time_t _time; | 1055 time_t _time; |
1060 struct tm tm; | 1056 struct tm tm; |
1061 Lisp_Object zone = (nargs > 6) ? args[nargs - 1] : Qnil; | 1057 Lisp_Object zone = (nargs > 6) ? args[nargs - 1] : Qnil; |
1062 | 1058 |
1063 CHECK_INT (args[0]); /* second */ | 1059 CHECK_INT (*args); tm.tm_sec = XINT (*args++); /* second */ |
1064 CHECK_INT (args[1]); /* minute */ | 1060 CHECK_INT (*args); tm.tm_min = XINT (*args++); /* minute */ |
1065 CHECK_INT (args[2]); /* hour */ | 1061 CHECK_INT (*args); tm.tm_hour = XINT (*args++); /* hour */ |
1066 CHECK_INT (args[3]); /* day */ | 1062 CHECK_INT (*args); tm.tm_mday = XINT (*args++); /* day */ |
1067 CHECK_INT (args[4]); /* month */ | 1063 CHECK_INT (*args); tm.tm_mon = XINT (*args++) - 1; /* month */ |
1068 CHECK_INT (args[5]); /* year */ | 1064 CHECK_INT (*args); tm.tm_year = XINT (*args++) - 1900;/* year */ |
1069 | 1065 |
1070 tm.tm_sec = XINT (args[0]); | |
1071 tm.tm_min = XINT (args[1]); | |
1072 tm.tm_hour = XINT (args[2]); | |
1073 tm.tm_mday = XINT (args[3]); | |
1074 tm.tm_mon = XINT (args[4]) - 1; | |
1075 tm.tm_year = XINT (args[5]) - 1900; | |
1076 tm.tm_isdst = -1; | 1066 tm.tm_isdst = -1; |
1077 | 1067 |
1078 if (CONSP (zone)) | 1068 if (CONSP (zone)) |
1079 zone = Fcar (zone); | 1069 zone = Fcar (zone); |
1080 if (NILP (zone)) | 1070 if (NILP (zone)) |