Bump version to 24.0.94
[bpt/emacs.git] / lisp / startup.el
index c6f3063..41056f3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; startup.el --- process Emacs shell arguments  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994-2011  Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992, 1994-2012  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -41,8 +41,9 @@
 (defcustom initial-buffer-choice nil
   "Buffer to show after starting Emacs.
 If the value is nil and `inhibit-startup-screen' is nil, show the
-startup screen.  If the value is string, visit the specified file or
-directory using `find-file'.  If t, open the `*scratch*' buffer."
+startup screen.  If the value is string, visit the specified file
+or directory using `find-file'.  If t, open the `*scratch*'
+buffer."
   :type '(choice
          (const     :tag "Startup screen" nil)
          (directory :tag "Directory" :value "~/")
@@ -104,6 +105,11 @@ This is a convenience alias, so that one can write \(pop argv\)
 inside of --eval command line arguments in order to access
 following arguments.")
 
+(with-no-warnings
+  ;; FIXME: Bad name for a dynamically bound variable
+  (defvar argi nil
+    "Current command-line argument."))
+
 (defvar command-line-functions nil    ;; lrs 7/31/89
   "List of functions to process unrecognized command-line arguments.
 Each function should access the dynamically bound variables
@@ -403,7 +409,7 @@ The regexp should not contain a starting \"\\`\" or a trailing
  \"\\'\"; those are added automatically by callers.")
 
 (defun normal-top-level-add-subdirs-to-load-path ()
-  "Add all subdirectories of current directory to `load-path'.
+  "Add all subdirectories of `default-directory' to `load-path'.
 More precisely, this uses only the subdirectories whose names
 start with letters or digits; it excludes any subdirectory named `RCS'
 or `CVS', and any subdirectory that contains a file named `.nosearch'."
@@ -904,7 +910,7 @@ opening the first frame (e.g. open a connection to an X server).")
            (setq no-blinking-cursor t)))
       ;; If the cursorColor X resource exists, alter the `cursor' face
       ;; spec, but mark it as changed outside of Customize.
-      (let ((color (x-get-resource "cursorColor" "CursorColor")))
+      (let ((color (x-get-resource "cursorColor" "Foreground")))
        (when color
          (put 'cursor 'theme-face
               `((changed ((t :background ,color)))))
@@ -923,7 +929,7 @@ opening the first frame (e.g. open a connection to an X server).")
              emacs-basic-display
              (and (memq window-system '(x w32 ns))
                   (not (member (x-get-resource "cursorBlink" "CursorBlink")
-                               '("off" "false")))))
+                               '("no" "off" "false" "0")))))
     (setq no-blinking-cursor t))
 
   ;; Re-evaluate predefined variables whose initial value depends on
@@ -937,7 +943,7 @@ opening the first frame (e.g. open a connection to an X server).")
   (normal-erase-is-backspace-setup-frame)
 
   ;; Register default TTY colors for the case the terminal hasn't a
-  ;; terminal init file.  We do this regardles of whether the terminal
+  ;; terminal init file.  We do this regardless of whether the terminal
   ;; supports colors or not and regardless the current display type,
   ;; since users can connect to color-capable terminals and also
   ;; switch color support on or off in mid-session by setting the
@@ -1126,7 +1132,7 @@ the `--debug-init' option to view a complete error backtrace."
                  (eq orig-enable-multibyte (default-value
                                              'enable-multibyte-characters)))
        ;; Init file changed to unibyte.  Reset existing multibyte
-       ;; buffers (probably *scratch*, *Messages*, *Minibuff-0*).
+       ;; buffers (probably *scratch*, *Messages*, *Minibuf-0*).
        ;; Arguably this should only be done if they're free of
        ;; multibyte characters.
        (mapc (lambda (buffer)
@@ -1444,8 +1450,8 @@ Each element in the list should be a list of strings or pairs
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
     (set-keymap-parent map button-buffer-map)
-    (define-key map "\C-?" 'scroll-down)
-    (define-key map " " 'scroll-up)
+    (define-key map "\C-?" 'scroll-down-command)
+    (define-key map " " 'scroll-up-command)
     (define-key map "q" 'exit-splash-screen)
     map)
   "Keymap for splash screen buffer.")
@@ -2301,13 +2307,13 @@ A fancy display is used on graphic displays, normal otherwise."
            ;; abort later.
            (unless (frame-live-p (selected-frame)) (kill-emacs nil))))))
 
-    (when initial-buffer-choice
-      (cond ((eq initial-buffer-choice t)
-            (switch-to-buffer (get-buffer-create "*scratch*")))
-           ((stringp initial-buffer-choice)
-            (find-file initial-buffer-choice))))
+    (when (eq initial-buffer-choice t)
+      ;; When initial-buffer-choice equals t make sure that *scratch*
+      ;; exists.
+      (get-buffer-create "*scratch*"))
 
     ;; If *scratch* exists and is empty, insert initial-scratch-message.
+    ;; Do this before switching to *scratch* below to handle bug#9605.
     (and initial-scratch-message
         (get-buffer "*scratch*")
         (with-current-buffer "*scratch*"
@@ -2315,6 +2321,12 @@ A fancy display is used on graphic displays, normal otherwise."
             (insert initial-scratch-message)
             (set-buffer-modified-p nil))))
 
+    (when initial-buffer-choice
+      (cond ((eq initial-buffer-choice t)
+            (switch-to-buffer (get-buffer-create "*scratch*")))
+           ((stringp initial-buffer-choice)
+            (find-file initial-buffer-choice))))
+
     (if (or inhibit-startup-screen
            initial-buffer-choice
            noninteractive