Mercurial > hg > xemacs-beta
comparison src/editfns.c @ 371:cc15677e0335 r21-2b1
Import from CVS: tag r21-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:03:08 +0200 |
parents | a4f53d9b3154 |
children | d883f39b8495 |
comparison
equal
deleted
inserted
replaced
370:bd866891f083 | 371:cc15677e0335 |
---|---|
367 if that was true previously. That avoids some anomalies. | 367 if that was true previously. That avoids some anomalies. |
368 But it creates others, and it wasn't documented, and it is simpler | 368 But it creates others, and it wasn't documented, and it is simpler |
369 and cleaner never to alter the window/buffer connections. */ | 369 and cleaner never to alter the window/buffer connections. */ |
370 /* I'm certain some code somewhere depends on this behavior. --jwz */ | 370 /* I'm certain some code somewhere depends on this behavior. --jwz */ |
371 /* Even if it did, it certainly doesn't matter anymore, because | 371 /* Even if it did, it certainly doesn't matter anymore, because |
372 this has been the behavior for countless XEmacs releases | 372 this has been the behaviour for countless XEmacs releases |
373 now. --hniksic */ | 373 now. --hniksic */ |
374 if (visible | 374 if (visible |
375 && (current_buffer != XBUFFER (XWINDOW (selected_window)->buffer))) | 375 && (current_buffer != XBUFFER (XWINDOW (selected_window)->buffer))) |
376 switch_to_buffer (Fcurrent_buffer (), Qnil); | 376 switch_to_buffer (Fcurrent_buffer (), Qnil); |
377 #endif | 377 #endif |
600 if (n < BUF_BEGV (b)) | 600 if (n < BUF_BEGV (b)) |
601 return Qnil; | 601 return Qnil; |
602 return make_char (BUF_FETCH_CHAR (b, n)); | 602 return make_char (BUF_FETCH_CHAR (b, n)); |
603 } | 603 } |
604 | 604 |
605 #if !defined(WINDOWSNT) && !defined(MSDOS) | |
606 #include <sys/stat.h> | |
607 #include <fcntl.h> | |
608 #include <errno.h> | |
609 #include <limits.h> | |
610 #endif | |
611 | 605 |
612 DEFUN ("temp-directory", Ftemp_directory, 0, 0, 0, /* | 606 DEFUN ("temp-directory", Ftemp_directory, 0, 0, 0, /* |
613 Return the pathname to the directory to use for temporary files. | 607 Return the pathname to the directory to use for temporary files. |
614 On NT/MSDOS, this is obtained from the TEMP or TMP environment variables, | 608 On NT/MSDOS, this is obtained from the TEMP or TMP environment variables, |
615 defaulting to / if they are both undefined. | 609 defaulting to / if they are both undefined. |
625 if (!tmpdir) | 619 if (!tmpdir) |
626 tmpdir = "/"; | 620 tmpdir = "/"; |
627 #else /* WINDOWSNT || MSDOS */ | 621 #else /* WINDOWSNT || MSDOS */ |
628 tmpdir = getenv ("TMPDIR"); | 622 tmpdir = getenv ("TMPDIR"); |
629 if (!tmpdir) | 623 if (!tmpdir) |
630 { | |
631 struct stat st; | |
632 char * logname = user_login_name(NULL); | |
633 int myuid = getuid(); | |
634 static char path[1+_POSIX_PATH_MAX]; | |
635 | |
636 strcpy(path, "/tmp/"); strncat(path, logname, _POSIX_PATH_MAX); | |
637 if (lstat(path, &st) < 0 && errno == ENOENT) | |
638 { | |
639 mkdir(path, 0700); /* ignore retval -- checked next anyway. */ | |
640 } | |
641 if (lstat(path, &st) == 0 && st.st_uid == myuid && S_ISDIR(st.st_mode)) | |
642 { | |
643 tmpdir = path; | |
644 } | |
645 else | |
646 { | |
647 strcpy(path, getenv("HOME")); strncat(path, "/tmp/", _POSIX_PATH_MAX); | |
648 if (stat(path, &st) < 0 && errno == ENOENT) | |
649 { | |
650 int fd; | |
651 char warnpath[1+_POSIX_PATH_MAX]; | |
652 mkdir(path, 0700); /* ignore retvals */ | |
653 strcpy(warnpath, path); | |
654 strncat(warnpath, ".created_by_xemacs", _POSIX_PATH_MAX); | |
655 if ((fd = open(warnpath, O_WRONLY|O_CREAT, 0644)) > 0) | |
656 { | |
657 write(fd, "XEmacs created this directory because /tmp/<yourname> was unavailable -- \nPlease check !\n", 89); | |
658 close(fd); | |
659 } | |
660 } | |
661 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) | |
662 { | |
663 tmpdir = path; | |
664 } | |
665 else | |
666 { | |
667 tmpdir = "/tmp"; | 624 tmpdir = "/tmp"; |
668 } | |
669 } | |
670 } | |
671 #endif | 625 #endif |
672 | 626 |
673 return build_ext_string (tmpdir, FORMAT_FILENAME); | 627 return build_ext_string (tmpdir, FORMAT_FILENAME); |
674 } | 628 } |
675 | 629 |
1089 %M is replaced by the minute (00-59). | 1043 %M is replaced by the minute (00-59). |
1090 %n is a synonym for "\\n". | 1044 %n is a synonym for "\\n". |
1091 %p is replaced by AM or PM, as appropriate. | 1045 %p is replaced by AM or PM, as appropriate. |
1092 %r is a synonym for "%I:%M:%S %p". | 1046 %r is a synonym for "%I:%M:%S %p". |
1093 %R is a synonym for "%H:%M". | 1047 %R is a synonym for "%H:%M". |
1094 %s is replaced by the time in seconds since 00:00:00, Jan 1, 1970 (a | |
1095 nonstandard extension) | |
1096 %S is replaced by the second (00-60). | 1048 %S is replaced by the second (00-60). |
1097 %t is a synonym for "\\t". | 1049 %t is a synonym for "\\t". |
1098 %T is a synonym for "%H:%M:%S". | 1050 %T is a synonym for "%H:%M:%S". |
1099 %U is replaced by the week of the year (00-53), first day of week is Sunday. | 1051 %U is replaced by the week of the year (00-53), first day of week is Sunday. |
1100 %w is replaced by the day of week (0-6), Sunday is day 0. | 1052 %w is replaced by the day of week (0-6), Sunday is day 0. |
2442 executing each command that did not explicitly turn it on with the function | 2394 executing each command that did not explicitly turn it on with the function |
2443 zmacs-activate-region. Setting this to true lets a command be non-intrusive. | 2395 zmacs-activate-region. Setting this to true lets a command be non-intrusive. |
2444 See the variable `zmacs-regions'. | 2396 See the variable `zmacs-regions'. |
2445 | 2397 |
2446 The same effect can be achieved using the `_' interactive specification. | 2398 The same effect can be achieved using the `_' interactive specification. |
2447 | |
2448 `zmacs-region-stays' is reset to nil before each command is executed. | |
2449 */ ); | 2399 */ ); |
2450 zmacs_region_stays = 0; | 2400 zmacs_region_stays = 0; |
2451 | 2401 |
2452 DEFVAR_BOOL ("atomic-extent-goto-char-p", &atomic_extent_goto_char_p /* | 2402 DEFVAR_BOOL ("atomic-extent-goto-char-p", &atomic_extent_goto_char_p /* |
2453 Do not use this -- it will be going away soon. | 2403 Do not use this -- it will be going away soon. |