comparison src/buffer.c @ 9785:a72386110d83

(init_buffer): Use DIRECTORY_SEP, IS_DIRECTORY_SEP macros, not character constants. (init_buffer_once, syms_of_buffer): Test DOS_NT, not MSDOS.
author Richard M. Stallman <rms@gnu.org>
date Tue, 01 Nov 1994 06:39:38 +0000
parents 577db538b0b6
children c76b3e670eb3
comparison
equal deleted inserted replaced
9784:93977a321baa 9785:a72386110d83
2502 2502
2503 XSETFASTINT (buffer_defaults.tab_width, 8); 2503 XSETFASTINT (buffer_defaults.tab_width, 8);
2504 buffer_defaults.truncate_lines = Qnil; 2504 buffer_defaults.truncate_lines = Qnil;
2505 buffer_defaults.ctl_arrow = Qt; 2505 buffer_defaults.ctl_arrow = Qt;
2506 2506
2507 #ifdef MSDOS 2507 #ifdef DOS_NT
2508 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ 2508 buffer_defaults.buffer_file_type = Qnil; /* TEXT */
2509 #endif 2509 #endif
2510 XSETFASTINT (buffer_defaults.fill_column, 70); 2510 XSETFASTINT (buffer_defaults.fill_column, 70);
2511 XSETFASTINT (buffer_defaults.left_margin, 0); 2511 XSETFASTINT (buffer_defaults.left_margin, 0);
2512 buffer_defaults.cache_long_line_scans = Qnil; 2512 buffer_defaults.cache_long_line_scans = Qnil;
2548 XSETFASTINT (buffer_local_flags.left_margin, 0x800); 2548 XSETFASTINT (buffer_local_flags.left_margin, 0x800);
2549 XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000); 2549 XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000);
2550 XSETFASTINT (buffer_local_flags.display_table, 0x2000); 2550 XSETFASTINT (buffer_local_flags.display_table, 0x2000);
2551 XSETFASTINT (buffer_local_flags.syntax_table, 0x8000); 2551 XSETFASTINT (buffer_local_flags.syntax_table, 0x8000);
2552 XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000); 2552 XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000);
2553 #ifdef MSDOS 2553 #ifdef DOS_NT
2554 XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000); 2554 XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000);
2555 #endif 2555 #endif
2556 2556
2557 Vbuffer_alist = Qnil; 2557 Vbuffer_alist = Qnil;
2558 current_buffer = 0; 2558 current_buffer = 0;
2582 { 2582 {
2583 char buf[MAXPATHLEN+1]; 2583 char buf[MAXPATHLEN+1];
2584 char *pwd; 2584 char *pwd;
2585 struct stat dotstat, pwdstat; 2585 struct stat dotstat, pwdstat;
2586 Lisp_Object temp; 2586 Lisp_Object temp;
2587 int rc;
2587 2588
2588 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); 2589 Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));
2589 2590
2590 /* If PWD is accurate, use it instead of calling getwd. This is faster 2591 /* If PWD is accurate, use it instead of calling getwd. This is faster
2591 when PWD is right, and may avoid a fatal error. */ 2592 when PWD is right, and may avoid a fatal error. */
2592 if ((pwd = getenv ("PWD")) != 0 && *pwd == '/' 2593 if ((pwd = getenv ("PWD")) != 0 && IS_DIRECTORY_SEP (*pwd)
2593 && stat (pwd, &pwdstat) == 0 2594 && stat (pwd, &pwdstat) == 0
2594 && stat (".", &dotstat) == 0 2595 && stat (".", &dotstat) == 0
2595 && dotstat.st_ino == pwdstat.st_ino 2596 && dotstat.st_ino == pwdstat.st_ino
2596 && dotstat.st_dev == pwdstat.st_dev 2597 && dotstat.st_dev == pwdstat.st_dev
2597 && strlen (pwd) < MAXPATHLEN) 2598 && strlen (pwd) < MAXPATHLEN)
2600 fatal ("`getwd' failed: %s.\n", buf); 2601 fatal ("`getwd' failed: %s.\n", buf);
2601 2602
2602 #ifndef VMS 2603 #ifndef VMS
2603 /* Maybe this should really use some standard subroutine 2604 /* Maybe this should really use some standard subroutine
2604 whose definition is filename syntax dependent. */ 2605 whose definition is filename syntax dependent. */
2605 if (buf[strlen (buf) - 1] != '/') 2606 rc = strlen (buf);
2606 strcat (buf, "/"); 2607 if (!(IS_DIRECTORY_SEP (buf[rc - 1])))
2608 {
2609 buf[rc] = DIRECTORY_SEP;
2610 buf[rc + 1] = '\0';
2611 }
2607 #endif /* not VMS */ 2612 #endif /* not VMS */
2608 current_buffer->directory = build_string (buf); 2613 current_buffer->directory = build_string (buf);
2609 2614
2610 temp = get_minibuffer (0); 2615 temp = get_minibuffer (0);
2611 XBUFFER (temp)->directory = current_buffer->directory; 2616 XBUFFER (temp)->directory = current_buffer->directory;
2689 DEFVAR_LISP_NOPRO ("default-case-fold-search", 2694 DEFVAR_LISP_NOPRO ("default-case-fold-search",
2690 &buffer_defaults.case_fold_search, 2695 &buffer_defaults.case_fold_search,
2691 "Default value of `case-fold-search' for buffers that don't override it.\n\ 2696 "Default value of `case-fold-search' for buffers that don't override it.\n\
2692 This is the same as (default-value 'case-fold-search)."); 2697 This is the same as (default-value 'case-fold-search).");
2693 2698
2694 #ifdef MSDOS 2699 #ifdef DOS_NT
2695 DEFVAR_LISP_NOPRO ("default-buffer-file-type", 2700 DEFVAR_LISP_NOPRO ("default-buffer-file-type",
2696 &buffer_defaults.buffer_file_type, 2701 &buffer_defaults.buffer_file_type,
2697 "Default file type for buffers that do not override it.\n\ 2702 "Default file type for buffers that do not override it.\n\
2698 This is the same as (default-value 'buffer-file-type).\n\ 2703 This is the same as (default-value 'buffer-file-type).\n\
2699 The file type is nil for text, t for binary."); 2704 The file type is nil for text, t for binary.");
2789 \n\ 2794 \n\
2790 Note that this is overridden by the variable\n\ 2795 Note that this is overridden by the variable\n\
2791 `truncate-partial-width-windows' if that variable is non-nil\n\ 2796 `truncate-partial-width-windows' if that variable is non-nil\n\
2792 and this buffer is not full-frame width."); 2797 and this buffer is not full-frame width.");
2793 2798
2794 #ifdef MSDOS 2799 #ifdef DOS_NT
2795 DEFVAR_PER_BUFFER ("buffer-file-type", &current_buffer->buffer_file_type, 2800 DEFVAR_PER_BUFFER ("buffer-file-type", &current_buffer->buffer_file_type,
2796 Qnil, 2801 Qnil,
2797 "*If visited file is text, nil; otherwise, t."); 2802 "*If visited file is text, nil; otherwise, t.");
2798 #endif 2803 #endif
2799 2804