comparison src/editfns.c @ 365:30d2cfa1092a r21-1-12

Import from CVS: tag r21-1-12
author cvs
date Mon, 13 Aug 2007 11:00:12 +0200
parents 8429d81ab209
children a4f53d9b3154
comparison
equal deleted inserted replaced
364:63c3368d1275 365:30d2cfa1092a
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
605 611
606 DEFUN ("temp-directory", Ftemp_directory, 0, 0, 0, /* 612 DEFUN ("temp-directory", Ftemp_directory, 0, 0, 0, /*
607 Return the pathname to the directory to use for temporary files. 613 Return the pathname to the directory to use for temporary files.
608 On NT/MSDOS, this is obtained from the TEMP or TMP environment variables, 614 On NT/MSDOS, this is obtained from the TEMP or TMP environment variables,
609 defaulting to / if they are both undefined. 615 defaulting to / if they are both undefined.
619 if (!tmpdir) 625 if (!tmpdir)
620 tmpdir = "/"; 626 tmpdir = "/";
621 #else /* WINDOWSNT || MSDOS */ 627 #else /* WINDOWSNT || MSDOS */
622 tmpdir = getenv ("TMPDIR"); 628 tmpdir = getenv ("TMPDIR");
623 if (!tmpdir) 629 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 {
624 tmpdir = "/tmp"; 667 tmpdir = "/tmp";
668 }
669 }
670 }
625 #endif 671 #endif
626 672
627 return build_ext_string (tmpdir, FORMAT_FILENAME); 673 return build_ext_string (tmpdir, FORMAT_FILENAME);
628 } 674 }
629 675
2396 executing each command that did not explicitly turn it on with the function 2442 executing each command that did not explicitly turn it on with the function
2397 zmacs-activate-region. Setting this to true lets a command be non-intrusive. 2443 zmacs-activate-region. Setting this to true lets a command be non-intrusive.
2398 See the variable `zmacs-regions'. 2444 See the variable `zmacs-regions'.
2399 2445
2400 The same effect can be achieved using the `_' interactive specification. 2446 The same effect can be achieved using the `_' interactive specification.
2447
2448 `zmacs-region-stays' is reset to nil before each command is executed.
2401 */ ); 2449 */ );
2402 zmacs_region_stays = 0; 2450 zmacs_region_stays = 0;
2403 2451
2404 DEFVAR_BOOL ("atomic-extent-goto-char-p", &atomic_extent_goto_char_p /* 2452 DEFVAR_BOOL ("atomic-extent-goto-char-p", &atomic_extent_goto_char_p /*
2405 Do not use this -- it will be going away soon. 2453 Do not use this -- it will be going away soon.