(x_draw_relief_rect): Add top_p and bot_p args.
[bpt/emacs.git] / src / emacs.c
index fdd5355..b95f973 100644 (file)
@@ -1,5 +1,5 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
-   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,2002
+   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,03,2004
       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -40,10 +40,15 @@ Boston, MA 02111-1307, USA.  */
 #include <sys/ioctl.h>
 #endif
 
+#ifdef WINDOWSNT
+#include <fcntl.h>
+#endif
+
 #include "lisp.h"
 #include "commands.h"
 #include "intervals.h"
 #include "buffer.h"
+#include "window.h"
 
 #include "systty.h"
 #include "blockinput.h"
@@ -81,13 +86,22 @@ extern char *index P_ ((const char *, int));
 
 /* Make these values available in GDB, which doesn't see macros.  */
 
+#ifdef USE_LSB_TAG
+int gdb_use_lsb = 1;
+#else
+int gdb_use_lsb = 0;
+#endif
+#ifdef NO_UNION_TYPE
+int gdb_use_union = 0;
+#else
+int gdb_use_union = 1;
+#endif
 EMACS_INT gdb_valbits = VALBITS;
 EMACS_INT gdb_gctypebits = GCTYPEBITS;
-EMACS_INT gdb_emacs_intbits = sizeof (EMACS_INT) * BITS_PER_CHAR;
 #ifdef DATA_SEG_BITS
 EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
 #else
-EMACS_INT  gdb_data_seg_bits = 0;
+EMACS_INT gdb_data_seg_bits = 0;
 #endif
 EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
 
@@ -158,7 +172,7 @@ Lisp_Object Vprevious_system_messages_locale;
 Lisp_Object Vsystem_time_locale;
 Lisp_Object Vprevious_system_time_locale;
 
-/* If non-zero, emacs should not attempt to use an window-specific code,
+/* If non-zero, emacs should not attempt to use a window-specific code,
    but instead should use the virtual terminal under which it was started.  */
 int inhibit_window_system;
 
@@ -215,6 +229,8 @@ int initial_argc;
 static void sort_args ();
 void syms_of_emacs ();
 
+/* MSVC needs each string be shorter than 2048 bytes, so the usage
+   strings below are split to not overflow this limit.  */
 #define USAGE1 "\
 Usage: %s [OPTION-OR-FILENAME]...\n\
 \n\
@@ -227,64 +243,71 @@ read the main documentation for these command-line arguments.\n\
 \n\
 Initialization options:\n\
 \n\
---batch                        do not do interactive display; implies -q\n\
---debug-init           enable Emacs Lisp debugger during init file\n\
---help                 display this help message and exit\n\
---multibyte, --no-unibyte   run Emacs in multibyte mode\n\
---no-init-file, -q         load neither ~/.emacs nor default.el\n\
---no-shared-memory, -nl            do not use shared memory\n\
---no-site-file             do not load site-start.el\n\
---no-window-system, -nw            don't communicate with X, ignoring $DISPLAY\n\
---terminal, -t DEVICE      use DEVICE for terminal I/O\n\
+--batch                     do not do interactive display; implies -q\n\
+--debug-init                enable Emacs Lisp debugger for init file\n\
+--display, -d DISPLAY       use X server DISPLAY\n\
+--multibyte, --no-unibyte   inhibit the effect of EMACS_UNIBYTE\n\
+--no-desktop                do not load a saved desktop\n\
+--no-init-file, -q          load neither ~/.emacs nor default.el\n\
+--no-shared-memory, -nl     do not use shared memory\n\
+--no-site-file              do not load site-start.el\n\
+--no-splash                 do not display a splash screen on startup\n\
+--no-window-system, -nw     don't communicate with X, ignoring $DISPLAY\n\
+--script FILE               run FILE as an Emacs Lisp script\n\
+--terminal, -t DEVICE       use DEVICE for terminal I/O\n\
 --unibyte, --no-multibyte   run Emacs in unibyte mode\n\
---user, -u USER                load ~USER/.emacs instead of your own\n\
---version              display version information and exit\n\
-\n\
+--user, -u USER             load ~USER/.emacs instead of your own\n\
+\n%s"
+
+#define USAGE2 "\
 Action options:\n\
 \n\
-FILE                   visit FILE using find-file\n\
-+LINE FILE             visit FILE using find-file, then go to line LINE\n\
-+LINE:COLUMN FILE      visit FILE using find-file, then go to line LINE,\n\
-                           column COLUMN\n\
---directory, -L DIR    add DIR to variable load-path\n\
---eval EXPR            evaluate Emacs Lisp expression EXPR\n\
---execute EXPR         evaluate Emacs Lisp expression EXPR\n\
---find-file FILE       visit FILE\n\
---funcall, -f FUNC     call Emacs function FUNC with no arguments\n\
---insert FILE          insert contents of FILE into current buffer\n\
---kill                 exit without asking for confirmation\n\
---load, -l FILE                load FILE of Emacs Lisp code using the load function\n\
---visit FILE           visit FILE\n\
+FILE                    visit FILE using find-file\n\
++LINE FILE              visit FILE using find-file, then go to line LINE\n\
++LINE:COLUMN FILE       visit FILE using find-file, then go to line LINE,\n\
+                          column COLUMN\n\
+--directory, -L DIR     add DIR to variable load-path\n\
+--eval EXPR             evaluate Emacs Lisp expression EXPR\n\
+--execute EXPR          evaluate Emacs Lisp expression EXPR\n\
+--file FILE             visit FILE using find-file\n\
+--find-file FILE        visit FILE using find-file\n\
+--funcall, -f FUNC      call Emacs Lisp function FUNC with no arguments\n\
+--insert FILE           insert contents of FILE into current buffer\n\
+--kill                  exit without asking for confirmation\n\
+--load, -l FILE         load Emacs Lisp FILE using the load function\n\
+--visit FILE            visit FILE using find-file\n\
 \n"
 
-#define USAGE2 "\
+#define USAGE3 "\
 Display options:\n\
 \n\
---background-color, -bg COLOR  window background color\n\
---border-color, -bd COLOR      main border color\n\
---border-width, -bw WIDTH      width of main border\n\
---color=MODE                   color mode for character terminals;\n\
-                               MODE defaults to `auto', and can also\n\
-                               be `never', `auto', `always',\n\
-                               or a mode name like `ansi8'\n\
---cursor-color, -cr COLOR      color of the Emacs cursor indicating point\n\
---display, -d DISPLAY          use X server DISPLAY\n\
---font, -fn FONT               default font; must be fixed-width\n\
---foreground-color, -fg COLOR  window foreground color\n\
---fullscreen, -fs              make first frame fullscreen\n\
---fullwidth, -fw               make the first frame wide as the screen\n\
---fullheight, -fh              make the first frame high as the screen\n\
---geometry, -g GEOMETRY                window geometry\n\
---iconic                       start Emacs in iconified state\n\
---icon-type, -i                        use picture of gnu for Emacs icon\n\
---internal-border, -ib WIDTH   width between text and main border\n\
---line-spacing, -lsp PIXELS    additional space to put between lines\n\
---mouse-color, -ms COLOR       mouse cursor color in Emacs window\n\
---name NAME                    title of main Emacs window\n\
---reverse-video, -r, -rv       switch foreground and background\n\
---title, -T, -wn TITLE         title for Emacs windows\n\
---vertical-scroll-bars, -vb    enable vertical scroll bars\n\
---xrm XRESOURCES               set additional X resources\n\
+--background-color, -bg COLOR   window background color\n\
+--border-color, -bd COLOR       main border color\n\
+--border-width, -bw WIDTH       width of main border\n\
+--color MODE                    color mode for character terminals;\n\
+                                  MODE defaults to `auto', and can also\n\
+                                  be `never', `auto', `always',\n\
+                                  or a mode name like `ansi8'\n\
+--cursor-color, -cr COLOR       color of the Emacs cursor indicating point\n\
+--font, -fn FONT                default font; must be fixed-width\n\
+--foreground-color, -fg COLOR   window foreground color\n\
+--fullheight, -fh               make the first frame high as the screen\n\
+--fullscreen, -fs               make first frame fullscreen\n\
+--fullwidth, -fw                make the first frame wide as the screen\n\
+--geometry, -g GEOMETRY         window geometry\n\
+--horizontal-scroll-bars, -hb   enable horizontal scroll bars\n\
+--icon-type, -i                 use picture of gnu for Emacs icon\n\
+--iconic                        start Emacs in iconified state\n\
+--internal-border, -ib WIDTH    width between text and main border\n\
+--line-spacing, -lsp PIXELS     additional space to put between lines\n\
+--mouse-color, -ms COLOR        mouse cursor color in Emacs window\n\
+--name NAME                     title for initial Emacs frame\n\
+--reverse-video, -r, -rv        switch foreground and background\n\
+--title, -T TITLE               title for initial Emacs frame\n\
+--vertical-scroll-bars, -vb     enable vertical scroll bars\n\
+--xrm XRESOURCES                set additional X resources\n\
+--help                          display this help and exit\n\
+--version                       output version information and exit\n\
 \n\
 You can generally also specify long option names with a single -; for\n\
 example, -batch as well as --batch.  You can use any unambiguous\n\
@@ -294,7 +317,7 @@ Various environment variables and window system resources also affect\n\
 Emacs' operation.  See the main documentation.\n\
 \n"
 
-#define USAGE3 "\
+#define USAGE4 "\
 Report bugs to %s.  First, please see the Bugs\n\
 section of the Emacs manual or the file BUGS.\n"
 
@@ -424,7 +447,7 @@ init_cmdargs (argc, argv, skip_args)
 {
   register int i;
   Lisp_Object name, dir, tem;
-  int count = specpdl_ptr - specpdl;
+  int count = SPECPDL_INDEX ();
   Lisp_Object raw_name;
 
   initial_argv = argv;
@@ -447,7 +470,7 @@ init_cmdargs (argc, argv, skip_args)
     {
       Lisp_Object found;
       int yes = openp (Vexec_path, Vinvocation_name,
-                      Vexec_suffixes, &found, 1);
+                      Vexec_suffixes, &found, make_number (X_OK));
       if (yes == 1)
        {
          /* Add /: to the front of the name
@@ -599,7 +622,7 @@ void __do_global_ctors_aux ()
 {}
 void __do_global_dtors ()
 {}
-/* Linux has a bug in its library; avoid an error.  */
+/* GNU/Linux has a bug in its library; avoid an error.  */
 #ifndef GNU_LINUX
 char * __CTOR_LIST__[2] = { (char *) (-1), 0 };
 #endif
@@ -742,7 +765,7 @@ bug_reporting_address ()
   if (!STRINGP(temp))
     return REPORT_EMACS_BUG_ADDRESS;
 
-  string = XSTRING (temp)->data;
+  string = SDATA (temp);
 
   /* Count dots in `emacs-version'.  */
   while (*string)
@@ -760,10 +783,16 @@ bug_reporting_address ()
 
 /* ARGSUSED */
 int
-main (argc, argv, envp)
+main (argc, argv
+#ifdef VMS
+, envp
+#endif
+)
      int argc;
      char **argv;
+#ifdef VMS
      char **envp;
+#endif
 {
 #if GC_MARK_STACK
   Lisp_Object dummy;
@@ -778,6 +807,7 @@ main (argc, argv, envp)
   struct rlimit rlim;
 #endif
   int no_loadup = 0;
+  char *junk = 0;
 
 #if GC_MARK_STACK
   extern Lisp_Object *stack_base;
@@ -793,6 +823,11 @@ main (argc, argv, envp)
     run_time_remap (argv[0]);
 #endif
 
+#ifdef MAC_OSX
+  if (!initialized)
+    unexec_init_emacs_zone ();
+#endif
+
   sort_args (argc, argv);
   argc = 0;
   while (argv[argc]) argc++;
@@ -811,7 +846,7 @@ main (argc, argv, envp)
        }
       else
        {
-         printf ("GNU Emacs %s\n", XSTRING (tem)->data);
+         printf ("GNU Emacs %s\n", SDATA (tem));
          printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
          printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
          printf ("You may redistribute copies of Emacs\n");
@@ -848,6 +883,13 @@ main (argc, argv, envp)
   }
 #endif /* NeXT */
 
+#ifdef MAC_OSX
+  /* Skip process serial number passed in the form -psn_x_y as
+     command-line argument.  */
+  if (argc > skip_args + 1 && strncmp (argv[skip_args+1], "-psn_", 5) == 0)
+    skip_args++;
+#endif /* MAC_OSX */
+
 #ifdef VMS
   /* If -map specified, map the data file in.  */
   {
@@ -933,11 +975,13 @@ main (argc, argv, envp)
   uninterrupt_malloc ();
 #endif /* not SYSTEM_MALLOC */
 
-#ifdef MSDOS
+#if defined (MSDOS) || defined (WINDOWSNT)
   /* We do all file input/output as binary files.  When we need to translate
      newlines, we do that manually.  */
   _fmode = O_BINARY;
+#endif /* MSDOS || WINDOWSNT */
 
+#ifdef MSDOS
 #if __DJGPP__ >= 2
   if (!isatty (fileno (stdin)))
     setmode (fileno (stdin), O_BINARY);
@@ -1020,13 +1064,22 @@ main (argc, argv, envp)
   noninteractive = 0;
   if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
     noninteractive = 1;
+  if (argmatch (argv, argc, "-script", "--script", 3, &junk, &skip_args))
+    {
+      noninteractive = 1;      /* Set batch mode.  */
+      /* Convert --script to -l, un-skip it, and sort again so that -l will be
+        handled in proper sequence.  */
+      argv[skip_args - 1] = "-l";
+      skip_args -= 2;
+      sort_args (argc, argv);
+    }
 
   /* Handle the --help option, which gives a usage message.  */
   if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
     {
-      printf (USAGE1, argv[0]);
-      printf (USAGE2);
-      printf (USAGE3, bug_reporting_address ());
+      printf (USAGE1, argv[0], USAGE2);
+      printf (USAGE3);
+      printf (USAGE4, bug_reporting_address ());
       exit (0);
     }
 
@@ -1175,12 +1228,12 @@ main (argc, argv, envp)
         CANNOT_DUMP is defined.  */
       syms_of_keyboard ();
 
-#ifdef macintosh
+#ifdef MAC_OS8
       /* init_window_once calls make_terminal_frame which on Mac OS
          creates a full-fledge output_mac type frame.  This does not
          work correctly before syms_of_textprop, syms_of_macfns,
          syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search,
-         syms_of_frame, x_term_init, and init_keyboard have already
+         syms_of_frame, mac_initialize, and init_keyboard have already
          been called.  */
       syms_of_textprop ();
       syms_of_macfns ();
@@ -1192,12 +1245,15 @@ main (argc, argv, envp)
       syms_of_search ();
       syms_of_frame ();
 
-      x_term_init ();
+      mac_initialize ();
       init_keyboard ();
 #endif
 
       init_window_once ();     /* Init the window system.  */
       init_fileio_once ();     /* Must precede any path manipulation.  */
+#ifdef HAVE_WINDOW_SYSTEM
+      init_fringe_once ();     /* Swap bitmaps if necessary. */
+#endif /* HAVE_WINDOW_SYSTEM */
     }
 
   init_alloc ();
@@ -1345,11 +1401,17 @@ main (argc, argv, envp)
 #endif /* MSDOS */
 
 #ifdef WINDOWSNT
+  globals_of_w32 ();
   /* Initialize environment from registry settings.  */
   init_environment (argv);
   init_ntproc ();      /* must precede init_editfns.  */
 #endif
 
+#ifdef HAVE_CARBON
+  if (initialized)
+    init_mac_osx_environment ();
+#endif
+
   /* egetenv is a pretty low-level facility, which may get called in
      many circumstances; it seems flimsy to put off initializing it
      until calling init_callproc.  */
@@ -1388,8 +1450,8 @@ main (argc, argv, envp)
       /* The basic levels of Lisp must come first.  */
       /* And data must come first of all
         for the sake of symbols like error-message.  */
-#ifndef macintosh
-      /* Called before init_window_once for Mac OS.  */
+#ifndef MAC_OS8
+      /* Called before init_window_once for Mac OS Classic.  */
       syms_of_data ();
 #endif
       syms_of_alloc ();
@@ -1407,8 +1469,8 @@ main (argc, argv, envp)
       syms_of_casetab ();
       syms_of_callproc ();
       syms_of_category ();
-#ifndef macintosh
-      /* Called before init_window_once for Mac OS.  */
+#ifndef MAC_OS8
+      /* Called before init_window_once for Mac OS Classic.  */
       syms_of_ccl ();
 #endif
       syms_of_charset ();
@@ -1432,8 +1494,8 @@ main (argc, argv, envp)
       syms_of_marker ();
       syms_of_minibuf ();
       syms_of_process ();
-#ifndef macintosh
-      /* Called before init_window_once for Mac OS.  */
+#ifndef MAC_OS8
+      /* Called before init_window_once for Mac OS Classic.  */
       syms_of_search ();
       syms_of_frame ();
 #endif
@@ -1443,8 +1505,8 @@ main (argc, argv, envp)
 #ifdef HAVE_SOUND
       syms_of_sound ();
 #endif
-#ifndef macintosh
-      /* Called before init_window_once for Mac OS.  */
+#ifndef MAC_OS8
+      /* Called before init_window_once for Mac OS Classic.  */
       syms_of_textprop ();
 #endif
       syms_of_composite ();
@@ -1456,6 +1518,10 @@ main (argc, argv, envp)
 #endif /* WINDOWSNT */
       syms_of_window ();
       syms_of_xdisp ();
+#ifdef HAVE_WINDOW_SYSTEM
+      syms_of_fringe ();
+      syms_of_image ();
+#endif /* HAVE_WINDOW_SYSTEM */
 #ifdef HAVE_X_WINDOWS
       syms_of_xterm ();
       syms_of_xfns ();
@@ -1468,11 +1534,14 @@ main (argc, argv, envp)
 #endif
 #endif /* HAVE_X_WINDOWS */
 
+#ifdef HAVE_MENUS
 #ifndef HAVE_NTGUI
-#ifndef macintosh
+#ifndef MAC_OS
+      /* Called before init_window_once for Mac OS Classic.  */
       syms_of_xmenu ();
 #endif
 #endif
+#endif
 
 #ifdef HAVE_NTGUI
       syms_of_w32term ();
@@ -1482,6 +1551,13 @@ main (argc, argv, envp)
       syms_of_fontset ();
 #endif /* HAVE_NTGUI */
 
+#ifdef HAVE_CARBON
+      syms_of_macterm ();
+      syms_of_macfns ();
+      syms_of_macmenu ();
+      syms_of_fontset ();
+#endif /* HAVE_CARBON */
+
 #ifdef SYMS_SYSTEM
       SYMS_SYSTEM;
 #endif
@@ -1497,6 +1573,17 @@ main (argc, argv, envp)
       keys_of_keymap ();
       keys_of_minibuf ();
       keys_of_window ();
+    }
+       else
+    {
+      /*
+        Initialization that must be done even if the global variable
+        initialized is non zero
+      */
+#ifdef HAVE_NTGUI
+      globals_of_w32fns ();
+      globals_of_w32menu ();
+#endif  /* end #ifdef HAVE_NTGUI */
     }
 
   if (!noninteractive)
@@ -1506,19 +1593,20 @@ main (argc, argv, envp)
 #endif /* VMS */
       init_display (); /* Determine terminal type.  init_sys_modes uses results.  */
     }
-#ifndef macintosh
-  /* Called before init_window_once for Mac OS.  */
+#ifndef MAC_OS8
+  /* Called before init_window_once for Mac OS Classic.  */
   init_keyboard ();    /* This too must precede init_sys_modes.  */
 #endif
 #ifdef VMS
   init_vmsproc ();     /* And this too.  */
 #endif /* VMS */
   init_sys_modes ();   /* Init system terminal modes (RAW or CBREAK, etc.).  */
-#if defined (HAVE_X_WINDOWS) || defined (WINDOWSNT)
-  init_xfns ();
-#endif /* HAVE_X_WINDOWS */
   init_fns ();
   init_xdisp ();
+#ifdef HAVE_WINDOW_SYSTEM
+  init_fringe ();
+  init_image ();
+#endif /* HAVE_WINDOW_SYSTEM */
   init_macros ();
   init_editfns ();
   init_floatfns ();
@@ -1632,6 +1720,7 @@ struct standard_args standard_args[] =
   { "-nw", "--no-window-system", 110, 0 },
   { "-nw", "--no-windows", 110, 0 },
   { "-batch", "--batch", 100, 0 },
+  { "-script", "--script", 100, 1 },
   { "-help", "--help", 90, 0 },
   { "-no-unibyte", "--no-unibyte", 83, 0 },
   { "-multibyte", "--multibyte", 82, 0 },
@@ -1645,6 +1734,7 @@ struct standard_args standard_args[] =
   { "-q", "--no-init-file", 50, 0 },
   { "-no-init-file", 0, 50, 0 },
   { "-no-site-file", "--no-site-file", 40, 0 },
+  { "-no-splash", "--no-splash", 40, 0 },
   { "-u", "--user", 30, 1 },
   { "-user", 0, 30, 1 },
   { "-debug-init", "--debug-init", 20, 0 },
@@ -1886,7 +1976,7 @@ all of which are called before Emacs is actually killed.  */)
      kill it because we are exiting Emacs deliberately (not crashing).
      Do it after shut_down_emacs, which does an auto-save.  */
   if (STRINGP (Vauto_save_list_file_name))
-    unlink (XSTRING (Vauto_save_list_file_name)->data);
+    unlink (SDATA (Vauto_save_list_file_name));
 
   exit (INTEGERP (arg) ? XINT (arg)
 #ifdef VMS
@@ -1930,7 +2020,7 @@ shut_down_emacs (sig, no_x, stuff)
        fflush (stdout);
        reset_sys_modes ();
        if (sig && sig != SIGTERM)
-         fprintf (stderr, "Fatal error (%d).", sig);
+         fprintf (stderr, "Fatal error (%d)", sig);
       }
   }
 #else
@@ -1955,8 +2045,8 @@ shut_down_emacs (sig, no_x, stuff)
 #ifdef HAVE_X_WINDOWS
   /* It's not safe to call intern here.  Maybe we are crashing.  */
   if (!noninteractive && SYMBOLP (Vwindow_system)
-      && XSYMBOL (Vwindow_system)->name->size == 1
-      && XSYMBOL (Vwindow_system)->name->data[0] == 'x'
+      && SCHARS (SYMBOL_NAME (Vwindow_system)) == 1
+      && SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x'
       && ! no_x)
     Fx_close_current_connection ();
 #endif /* HAVE_X_WINDOWS */
@@ -2014,7 +2104,7 @@ This function exists on systems that use HAVE_SHM.  */)
 #ifndef SYSTEM_MALLOC
   memory_warnings (my_edata, malloc_warning);
 #endif
-  map_out_data (XSTRING (filename)->data);
+  map_out_data (SDATA (filename));
 
   Vpurify_flag = tem;
 
@@ -2035,7 +2125,7 @@ You must run Emacs in batch mode in order to dump it.  */)
   extern char my_edata[];
   Lisp_Object tem;
   Lisp_Object symbol;
-  int count = BINDING_STACK_SIZE ();
+  int count = SPECPDL_INDEX ();
 
   check_pure_size ();
 
@@ -2053,7 +2143,7 @@ You must run Emacs in batch mode in order to dump it.  */)
   if (!NILP (symfile))
     {
       CHECK_STRING (symfile);
-      if (XSTRING (symfile)->size)
+      if (SCHARS (symfile))
        symfile = Fexpand_file_name (symfile, Qnil);
     }
 
@@ -2070,7 +2160,7 @@ You must run Emacs in batch mode in order to dump it.  */)
 
   fflush (stdout);
 #ifdef VMS
-  mapout_data (XSTRING (filename)->data);
+  mapout_data (SDATA (filename));
 #else
   /* Tell malloc where start of impure now is.  */
   /* Also arrange for warnings when nearly out of space.  */
@@ -2088,8 +2178,8 @@ You must run Emacs in batch mode in order to dump it.  */)
 #ifdef USE_MMAP_FOR_BUFFERS
   mmap_set_vars (0);
 #endif
-  unexec (XSTRING (filename)->data,
-         !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0);
+  unexec (SDATA (filename),
+         !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0);
 #ifdef USE_MMAP_FOR_BUFFERS
   mmap_set_vars (1);
 #endif
@@ -2129,7 +2219,7 @@ synchronize_locale (category, plocale, desired_locale)
     {
       *plocale = desired_locale;
       setlocale (category, (STRINGP (desired_locale)
-                           ? (char *)(XSTRING (desired_locale)->data)
+                           ? (char *)(SDATA (desired_locale))
                            : ""));
     }
 }
@@ -2199,6 +2289,17 @@ decode_env_path (evarname, defalt)
       /* Add /: to the front of the name
         if it would otherwise be treated as magic.  */
       tem = Ffind_file_name_handler (element, Qt);
+
+      /* However, if the handler says "I'm safe",
+        don't bother adding /:.  */
+      if (SYMBOLP (tem))
+       {
+         Lisp_Object prop;
+         prop = Fget (tem, intern ("safe-magic"));
+         if (! NILP (prop))
+           tem = Qnil;
+       }
+
       if (! NILP (tem))
        element = concat2 (build_string ("/:"), element);
 
@@ -2231,7 +2332,8 @@ syms_of_emacs ()
   defsubr (&Sinvocation_directory);
 
   DEFVAR_LISP ("command-line-args", &Vcommand_line_args,
-              doc: /* Args passed by shell to Emacs, as a list of strings.  */);
+              doc: /* Args passed by shell to Emacs, as a list of strings.
+Many arguments are deleted from the list as they are processed.  */);
 
   DEFVAR_LISP ("system-type", &Vsystem_type,
               doc: /* Value is symbol indicating type of operating system you are using.  */);
@@ -2251,11 +2353,13 @@ Emacs is running.  */);
               doc: /* Non-nil means Emacs is running without interactive terminal.  */);
 
   DEFVAR_LISP ("kill-emacs-hook", &Vkill_emacs_hook,
-              doc: /* Hook to be run whenever kill-emacs is called.
-Since kill-emacs may be invoked when the terminal is disconnected (or
+              doc: /* Hook to be run when kill-emacs is called.
+Since `kill-emacs' may be invoked when the terminal is disconnected (or
 in other similar situations), functions placed on this hook should not
 expect to be able to interact with the user.  To ask for confirmation,
-see `kill-emacs-query-functions' instead.  */);
+see `kill-emacs-query-functions' instead.
+
+The hook is not run in batch mode, i.e., if `noninteractive' is non-nil.  */);
   Vkill_emacs_hook = Qnil;
 
   empty_string = build_string ("");
@@ -2321,3 +2425,6 @@ near where the Emacs executable was found.  */);
               doc: /* Most recently used system locale for time.  */);
   Vprevious_system_time_locale = Qnil;
 }
+
+/* arch-tag: 7bfd356a-c720-4612-8ab6-aa4222931c2e
+   (do not change this comment) */