;;; startup.el --- process Emacs shell arguments
;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Maintainer: FSF
:type '(choice
(const :tag "Startup screen" nil)
(directory :tag "Directory" :value "~/")
- (file :tag "File" :value "~/file.txt")
+ (file :tag "File" :value "~/.emacs")
(const :tag "Lisp scratch buffer" t))
:version "23.1"
:group 'initialization)
(defcustom inhibit-startup-screen nil
"Non-nil inhibits the startup screen.
-This is for use in your personal init file (but NOT site-start.el), once
-you are familiar with the contents of the startup screen."
+This is for use in your personal init file (but NOT site-start.el),
+once you are familiar with the contents of the startup screen."
:type 'boolean
:group 'initialization)
(defvar startup-screen-inhibit-startup-screen nil)
(defcustom inhibit-startup-echo-area-message nil
- "*Non-nil inhibits the initial startup echo area message.
+ "Non-nil inhibits the initial startup echo area message.
Setting this variable takes effect
only if you do it with the customization buffer
or if your `.emacs' file contains a line of this form:
:group 'initialization)
(defcustom inhibit-default-init nil
- "*Non-nil inhibits loading the `default' library."
+ "Non-nil inhibits loading the `default' library."
:type 'boolean
:group 'initialization)
(defcustom inhibit-startup-buffer-menu nil
- "*Non-nil inhibits display of buffer list when more than 2 files are loaded."
+ "Non-nil inhibits display of buffer list when more than 2 files are loaded."
:type 'boolean
:group 'initialization)
("-fs" 0 x-handle-initial-switch fullscreen fullboth)
("-fw" 0 x-handle-initial-switch fullscreen fullwidth)
("-fh" 0 x-handle-initial-switch fullscreen fullheight)
+ ("-mm" 0 x-handle-initial-switch fullscreen maximized)
("-ib" 1 x-handle-numeric-switch internal-border-width)
("-g" 1 x-handle-geometry)
("-lsp" 1 x-handle-numeric-switch line-spacing)
("--fullscreen" 0 x-handle-initial-switch fullscreen fullboth)
("--fullwidth" 0 x-handle-initial-switch fullscreen fullwidth)
("--fullheight" 0 x-handle-initial-switch fullscreen fullheight)
+ ("--maximized" 0 x-handle-initial-switch fullscreen maximized)
("--internal-border" 1 x-handle-numeric-switch internal-border-width)
("--geometry" 1 x-handle-geometry)
("--foreground-color" 1 x-handle-switch foreground-color)
and VALUE is the value which is given to that frame parameter
\(most options use the argument for this, so VALUE is not present).")
+(defconst command-line-ns-option-alist
+ '(("-NSAutoLaunch" 1 ns-ignore-1-arg)
+ ("-NXAutoLaunch" 1 ns-ignore-1-arg)
+ ("-macosx" 0 ignore)
+ ("-NSHost" 1 ns-ignore-1-arg)
+ ("-_NSMachLaunch" 1 ns-ignore-1-arg)
+ ("-MachLaunch" 1 ns-ignore-1-arg)
+ ("-NXOpen" 1 ns-ignore-1-arg)
+ ("-NSOpen" 1 ns-handle-nxopen)
+ ("-NXOpenTemp" 1 ns-ignore-1-arg)
+ ("-NSOpenTemp" 1 ns-handle-nxopentemp)
+ ("-GSFilePath" 1 ns-handle-nxopen)
+ ;;("-bw" . x-handle-numeric-switch)
+ ;;("-d" . x-handle-display)
+ ;;("-display" . x-handle-display)
+ ("-name" 1 ns-handle-name-switch)
+ ("-title" 1 ns-handle-switch title)
+ ("-T" 1 ns-handle-switch title)
+ ("-r" 0 ns-handle-switch reverse t)
+ ("-rv" 0 ns-handle-switch reverse t)
+ ("-reverse" 0 ns-handle-switch reverse t)
+ ("-fn" 1 ns-handle-switch font)
+ ("-font" 1 ns-handle-switch font)
+ ("-ib" 1 ns-handle-numeric-switch internal-border-width)
+ ;;("-g" . x-handle-geometry)
+ ;;("-geometry" . x-handle-geometry)
+ ("-fg" 1 ns-handle-switch foreground-color)
+ ("-foreground" 1 ns-handle-switch foreground-color)
+ ("-bg" 1 ns-handle-switch background-color)
+ ("-background" 1 ns-handle-switch background-color)
+; ("-ms" 1 ns-handle-switch mouse-color)
+ ("-itype" 0 ns-handle-switch icon-type t)
+ ("-i" 0 ns-handle-switch icon-type t)
+ ("-iconic" 0 ns-handle-iconic icon-type t)
+ ;;("-xrm" . x-handle-xrm-switch)
+ ("-cr" 1 ns-handle-switch cursor-color)
+ ("-vb" 0 ns-handle-switch vertical-scroll-bars t)
+ ("-hb" 0 ns-handle-switch horizontal-scroll-bars t)
+ ("-bd" 1 ns-handle-switch)
+ ;; ("--border-width" 1 ns-handle-numeric-switch border-width)
+ ;; ("--display" 1 ns-handle-display)
+ ("--name" 1 ns-handle-name-switch)
+ ("--title" 1 ns-handle-switch title)
+ ("--reverse-video" 0 ns-handle-switch reverse t)
+ ("--font" 1 ns-handle-switch font)
+ ("--internal-border" 1 ns-handle-numeric-switch internal-border-width)
+ ;; ("--geometry" 1 ns-handle-geometry)
+ ("--foreground-color" 1 ns-handle-switch foreground-color)
+ ("--background-color" 1 ns-handle-switch background-color)
+ ("--mouse-color" 1 ns-handle-switch mouse-color)
+ ("--icon-type" 0 ns-handle-switch icon-type t)
+ ("--iconic" 0 ns-handle-iconic)
+ ;; ("--xrm" 1 ns-handle-xrm-switch)
+ ("--cursor-color" 1 ns-handle-switch cursor-color)
+ ("--vertical-scroll-bars" 0 ns-handle-switch vertical-scroll-bars t)
+ ("--border-color" 1 ns-handle-switch border-width))
+ "Alist of NS options.
+Each element has the form
+ (NAME NUMARGS HANDLER FRAME-PARAM VALUE)
+where NAME is the option name string, NUMARGS is the number of arguments
+that the option accepts, HANDLER is a function to call to handle the option.
+FRAME-PARAM (optional) is the frame parameter this option specifies,
+and VALUE is the value which is given to that frame parameter
+\(most options use the argument for this, so VALUE is not present).")
+
+
(defvar before-init-hook nil
"Normal hook run after handling urgent options but before loading init files.")
therefore, if you set `debug-on-error' non-nil in `.emacs',
an error in one of these functions will invoke the debugger.")
-(defvar before-init-time nil
- "Value of `current-time' before Emacs begins initialization.")
-
-(defvar after-init-time nil
- "Value of `current-time' after loading the init files.")
-
(defvar emacs-startup-hook nil
"Normal hook run after loading init files and handling the command line.")
(error "Customizing `site-run-file' does not work")))
(defcustom mail-host-address nil
- "*Name of this machine, for purposes of naming users."
+ "Name of this machine, for purposes of naming users."
:type '(choice (const nil) string)
:group 'mail)
(system-name))))
;; Empty string means "not set yet".
"")
- "*Full mailing address of this user.
+ "Full mailing address of this user.
This is initialized with environment variable `EMAIL' or, as a
-fallback, using `mail-host-address'. This is done after your
+fallback, using `mail-host-address'. This is done after your
init file is read, in case it sets `mail-host-address'."
:type 'string
:group 'mail)
;; the end, because the subdirs.el files may add elements to the end
;; of load-path and we want to take it into account.
(setq tail (cdr tail))))
- (unless (eq system-type 'vax-vms)
- ;; If the PWD environment variable isn't accurate, delete it.
- (let ((pwd (getenv "PWD")))
- (and (stringp pwd)
- ;; Use FOO/., so that if FOO is a symlink, file-attributes
- ;; describes the directory linked to, not FOO itself.
- (or (equal (file-attributes
- (concat (file-name-as-directory pwd) "."))
- (file-attributes
- (concat (file-name-as-directory default-directory)
- ".")))
- (setq process-environment
- (delete (concat "PWD=" pwd)
- process-environment))))))
+ ;; If the PWD environment variable isn't accurate, delete it.
+ (let ((pwd (getenv "PWD")))
+ (and (stringp pwd)
+ ;; Use FOO/., so that if FOO is a symlink, file-attributes
+ ;; describes the directory linked to, not FOO itself.
+ (or (equal (file-attributes
+ (concat (file-name-as-directory pwd) "."))
+ (file-attributes
+ (concat (file-name-as-directory default-directory)
+ ".")))
+ (setq process-environment
+ (delete (concat "PWD=" pwd)
+ process-environment)))))
(setq default-directory (abbreviate-file-name default-directory))
- (let ((menubar-bindings-done nil))
+ (let ((menubar-bindings-done nil)
+ (old-face-font-rescale-alist face-font-rescale-alist))
(unwind-protect
(command-line)
;; Do this again, in case .emacs defined more abbreviations.
(not (and initial-window-system
(not noninteractive)
(not (eq initial-window-system 'pc)))))
+
+ ;; FIXME: The user's init file may change
+ ;; face-font-rescale-alist. However, the default face
+ ;; already has an assigned font object, which does not take
+ ;; face-font-rescale-alist into account. For such
+ ;; situations, we ought to have a way to find all font
+ ;; objects and regenerate them; currently we do not. As a
+ ;; workaround, we specifically reset te default face's :font
+ ;; attribute here. See bug#1785.
+ (unless (eq face-font-rescale-alist
+ old-face-font-rescale-alist)
+ (set-face-attribute 'default nil :font (font-spec)))
+
;; Modify the initial frame based on what .emacs puts into
;; ...-frame-alist.
(if (fboundp 'frame-notice-user-settings)
("--color" . "-color")))
(defconst tool-bar-images-pixel-height 24
- "Height in pixels of images in the tool bar.")
+ "Height in pixels of images in the tool-bar.")
(defvar tool-bar-originally-present nil
"Non-nil if tool-bars are present before user and site init files are read.")
(declare-function x-get-resource "frame.c"
(attribute class &optional component subclass))
(declare-function tool-bar-mode "tool-bar" (&optional arg))
+(declare-function tool-bar-setup "tool-bar")
+
+(defvar server-name)
+(defvar server-process)
(defun command-line ()
(setq before-init-time (current-time)
+ after-init-time nil
command-line-default-directory default-directory)
;; Choose a reasonable location for temporary files.
(setq eol-mnemonic-dos "(DOS)"
eol-mnemonic-mac "(Mac)")))
- ;; Make sure window system's init file was loaded in loadup.el if using a window system.
+ ;; Make sure window system's init file was loaded in loadup.el if
+ ;; using a window system.
(condition-case error
(unless noninteractive
(if (and initial-window-system
(not (featurep
- (intern (concat (symbol-name initial-window-system) "-win")))))
+ (intern
+ (concat (symbol-name initial-window-system) "-win")))))
(error "Unsupported window system `%s'" initial-window-system))
;; Process window-system specific command line parameters.
(setq command-line-args
- (funcall (or (cdr (assq initial-window-system handle-args-function-alist))
- (error "Unsupported window system `%s'" initial-window-system))
- command-line-args))
+ (funcall
+ (or (cdr (assq initial-window-system handle-args-function-alist))
+ (error "Unsupported window system `%s'" initial-window-system))
+ command-line-args))
;; Initialize the window system. (Open connection, etc.)
- (funcall (or (cdr (assq initial-window-system window-system-initialization-alist))
- (error "Unsupported window system `%s'" initial-window-system))))
+ (funcall
+ (or (cdr (assq initial-window-system window-system-initialization-alist))
+ (error "Unsupported window system `%s'" initial-window-system))))
;; If there was an error, print the error message and exit.
(error
(princ
(orig-argi argi)
argval)
;; Handle --OPTION=VALUE format.
- (when (string-match "^\\(--[^=]*\\)=" argi)
+ (when (string-match "\\`\\(--[^=]*\\)=" argi)
(setq argval (substring argi (match-end 0))
argi (match-string 1 argi)))
- (unless (equal argi "--")
+ (when (string-match "\\`--." orig-argi)
(let ((completion (try-completion argi longopts)))
(if (eq completion t)
(setq argi (substring argi 1))
(run-hooks 'before-init-hook)
;; Under X Window, this creates the X frame and deletes the terminal frame.
- (when (fboundp 'frame-initialize)
+ (unless (daemonp)
(frame-initialize))
;; Turn off blinking cursor if so specified in X resources. This is here
;; only because all other settings of no-blinking-cursor are here.
(unless (or noninteractive
emacs-basic-display
- (and (memq window-system '(x w32 mac))
+ (and (memq window-system '(x w32 ns))
(not (member (x-get-resource "cursorBlink" "CursorBlink")
'("off" "false")))))
(setq no-blinking-cursor t))
(<= (frame-parameter nil 'menu-bar-lines) 0)))
(menu-bar-mode 1))
- ;; If frame was created with a tool bar, switch tool-bar-mode on.
- (unless (or noninteractive
- emacs-basic-display
- (not (display-graphic-p))
- (<= (frame-parameter nil 'tool-bar-lines) 0))
- (tool-bar-mode 1))
+ (unless (or noninteractive (not (fboundp 'tool-bar-mode)))
+ ;; Set up the tool-bar. Do this even in tty frames, so that there
+ ;; is a tool-bar if Emacs later opens a graphical frame.
+ (if (or emacs-basic-display
+ (and (numberp (frame-parameter nil 'tool-bar-lines))
+ (<= (frame-parameter nil 'tool-bar-lines) 0)))
+ ;; On a graphical display with the toolbar disabled via X
+ ;; resources, set up the toolbar without enabling it.
+ (tool-bar-setup)
+ ;; Otherwise, enable tool-bar-mode.
+ (tool-bar-mode 1)))
;; Can't do this init in defcustom because the relevant variables
;; are not set.
;; since users can connect to color-capable terminals and also
;; switch color support on or off in mid-session by setting the
;; tty-color-mode frame parameter.
- (tty-register-default-colors)
+ ;; Exception: the `pc' ``window system'' has only 16 fixed colors,
+ ;; and they are already set at this point by a suitable function in
+ ;; window-system-initialization-alist.
+ (or (eq initial-window-system 'pc)
+ (tty-register-default-colors))
;; Record whether the tool-bar is present before the user and site
;; init files are processed. frame-notice-user-settings uses this
init-file-user)
:error)
(if (file-directory-p (expand-file-name
- ;; We don't support ~USER on MS-Windows except
- ;; for the current user, and always load .emacs
- ;; from the current user's home directory (see
- ;; below). So always check "~", even if invoked
- ;; with "-u USER", or if $USER or $LOGNAME are
- ;; set to something different.
- (if (eq system-type 'windows-nt)
+ ;; We don't support ~USER on MS-Windows
+ ;; and MS-DOS except for the current
+ ;; user, and always load .emacs from
+ ;; the current user's home directory
+ ;; (see below). So always check "~",
+ ;; even if invoked with "-u USER", or
+ ;; if $USER or $LOGNAME are set to
+ ;; something different.
+ (if (memq system-type '(windows-nt ms-dos))
"~"
(concat "~" init-file-user))))
nil
"~/_emacs"
;; But default to .emacs if _emacs does not exist.
"~/.emacs")))
- ((eq system-type 'vax-vms)
- "sys$login:.emacs")
(t
(concat "~" init-file-user "/.emacs")))))
;; This tells `load' to store the file name found
(funcall inner)
(setq init-file-had-error nil))
(error
- (let ((message-log-max nil))
- (with-current-buffer (get-buffer-create "*Messages*")
- (insert "\n\n"
- (format "An error has occurred while loading `%s':\n\n"
- user-init-file)
- (format "%s%s%s"
- (get (car error) 'error-message)
- (if (cdr error) ": " "")
- (mapconcat (lambda (s) (prin1-to-string s t)) (cdr error) ", "))
- "\n\n"
- "To ensure normal operation, you should investigate and remove the\n"
- "cause of the error in your initialization file. Start Emacs with\n"
- "the `--debug-init' option to view a complete error backtrace.\n\n"))
- (message "Error in init file: %s%s%s"
- (get (car error) 'error-message)
- (if (cdr error) ": " "")
- (mapconcat 'prin1-to-string (cdr error) ", "))
- (let ((pop-up-windows nil))
- (pop-to-buffer "*Messages*"))
- (setq init-file-had-error t)))))
-
- (if (and deactivate-mark transient-mark-mode)
+ (display-warning
+ 'initialization
+ (format "An error occurred while loading `%s':\n\n%s%s%s\n\n\
+To ensure normal operation, you should investigate and remove the
+cause of the error in your initialization file. Start Emacs with
+the `--debug-init' option to view a complete error backtrace."
+ user-init-file
+ (get (car error) 'error-message)
+ (if (cdr error) ": " "")
+ (mapconcat (lambda (s) (prin1-to-string s t)) (cdr error) ", "))
+ :warning)
+ (setq init-file-had-error t))))
+
+ (if (and deactivate-mark transient-mark-mode)
(with-current-buffer (window-buffer)
(deactivate-mark)))
;; If -batch, terminate after processing the command options.
(if noninteractive (kill-emacs t))
+ ;; In daemon mode, start the server to allow clients to connect.
+ ;; This is done after loading the user's init file and after
+ ;; processing all command line arguments to allow e.g. `server-name'
+ ;; to be changed before the server starts.
+ (let ((dn (daemonp)))
+ (when dn
+ (when (stringp dn) (setq server-name dn))
+ (server-start)
+ (if server-process
+ (daemon-initialized)
+ (if (stringp dn)
+ (message
+ "Unable to start daemon: Emacs server named %S already running"
+ server-name)
+ (message "Unable to start the daemon.\nAnother instance of Emacs is running the server, either as daemon or interactively.\nYou can use emacsclient to connect to that Emacs process."))
+ (kill-emacs 1))))
+
;; Run emacs-session-restore (session management) if started by
;; the session manager and we have a session manager connection.
(if (and (boundp 'x-session-previous-id)
"Browse http://www.gnu.org/gnu/linux-and-gnu.html")
'("GNU" (lambda (button) (describe-gnu-project))
"Display info on the GNU project")))
- " operating system.\n"
- :face variable-pitch "To quit a partially entered command, type "
- :face default "Control-g"
- :face variable-pitch ".\n\n"
+ " operating system.\n\n"
+ :face variable-pitch
:link ("Emacs Tutorial" (lambda (button) (help-with-tutorial)))
"\tLearn basic keystroke commands"
(lambda ()
""
(concat " (" title ")"))))
"\n"
- :face variable-pitch
:link ("Emacs Guided Tour"
(lambda (button) (browse-url "http://www.gnu.org/software/emacs/tour/"))
"Browse http://www.gnu.org/software/emacs/tour/")
- "\tOverview of Emacs features\n"
+ "\tOverview of Emacs features at gnu.org\n"
:link ("View Emacs Manual" (lambda (button) (info-emacs-manual)))
"\tView the Emacs manual using Info\n"
:link ("Absence of Warranty" (lambda (button) (describe-no-warranty)))
:group 'initialization)
(defcustom fancy-splash-image nil
- "*The image to show in the splash screens, or nil for defaults."
+ "The image to show in the splash screens, or nil for defaults."
:group 'fancy-splash-screen
:type '(choice (const :tag "Default" nil)
(file :tag "File")))
(let* ((image-file (cond ((stringp fancy-splash-image)
fancy-splash-image)
((display-color-p)
- (cond ((image-type-available-p 'svg)
+ (cond ((<= (display-planes) 8)
+ (if (image-type-available-p 'xpm)
+ "splash.xpm"
+ "splash.pbm"))
+ ((image-type-available-p 'svg)
"splash.svg")
((image-type-available-p 'png)
"splash.png")
((image-type-available-p 'xpm)
- (if (and (fboundp 'x-display-planes)
- (= (funcall 'x-display-planes) 8))
- "splash8.xpm"
- "splash.xpm"))))
+ "splash.xpm")
+ (t "splash.pbm")))
(t "splash.pbm")))
(img (create-image image-file))
(image-width (and img (car (image-size img))))
(lambda (button) (customize-group 'initialization))
"Change initialization settings including this screen")
"\n"))
+ (fancy-splash-insert
+ :face 'variable-pitch "To quit a partially entered command, type "
+ :face 'default "Control-g"
+ :face 'variable-pitch ".\n")
(fancy-splash-insert :face `(variable-pitch (:foreground ,fg))
"\nThis is "
(emacs-version)
;; If keys have their default meanings,
;; use precomputed string to save lots of time.
- (if (and (eq (key-binding "\C-h") 'help-command)
- (eq (key-binding "\C-xu") 'advertised-undo)
- (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
- (eq (key-binding "\C-ht") 'help-with-tutorial)
- (eq (key-binding "\C-hi") 'info)
- (eq (key-binding "\C-hr") 'info-emacs-manual)
- (eq (key-binding "\C-h\C-n") 'view-emacs-news))
- (progn
- (insert "
-Get help\t C-h (Hold down CTRL and press h)
+ (let ((c-h-accessible
+ ;; If normal-erase-is-backspace is used on a tty, there's
+ ;; no way to invoke C-h and you have to use F1 instead.
+ (or (not (char-table-p keyboard-translate-table))
+ (eq (aref keyboard-translate-table ?\C-h) ?\C-h))))
+ (if (and (eq (key-binding "\C-h") 'help-command)
+ (eq (key-binding "\C-xu") 'advertised-undo)
+ (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
+ (eq (key-binding "\C-ht") 'help-with-tutorial)
+ (eq (key-binding "\C-hi") 'info)
+ (eq (key-binding "\C-hr") 'info-emacs-manual)
+ (eq (key-binding "\C-h\C-n") 'view-emacs-news))
+ (let ((help (if c-h-accessible "C-h" "<f1>")))
+ (insert "
+Get help\t " help " (Hold down CTRL and press h)
")
- (insert-button "Emacs manual"
- 'action (lambda (button) (info-emacs-manual))
- 'follow-link t)
- (insert " C-h r\t")
- (insert-button "Browse manuals"
- 'action (lambda (button) (Info-directory))
- 'follow-link t)
- (insert "\t C-h i
+ (insert-button "Emacs manual"
+ 'action (lambda (button) (info-emacs-manual))
+ 'follow-link t)
+ (insert " " help " r\t")
+ (insert-button "Browse manuals"
+ 'action (lambda (button) (Info-directory))
+ 'follow-link t)
+ (insert "\t " help " i
")
- (insert-button "Emacs tutorial"
- 'action (lambda (button) (help-with-tutorial))
- 'follow-link t)
- (insert " C-h t\tUndo changes\t C-x u
+ (insert-button "Emacs tutorial"
+ 'action (lambda (button) (help-with-tutorial))
+ 'follow-link t)
+ (insert " " help " t\tUndo changes\t C-x u
")
- (insert-button "Buy manuals"
- 'action (lambda (button) (view-order-manuals))
- 'follow-link t)
- (insert "\t C-h C-m\tExit Emacs\t C-x C-c"))
+ (insert-button "Buy manuals"
+ 'action (lambda (button) (view-order-manuals))
+ 'follow-link t)
+ (insert "\t " help " C-m\tExit Emacs\t C-x C-c"))
- (insert (format "
+ (insert (format "
Get help\t %s
"
- (let ((where (where-is-internal
- 'help-command nil t)))
- (if where
- (key-description where)
- "M-x help"))))
- (insert-button "Emacs manual"
- 'action (lambda (button) (info-emacs-manual))
- 'follow-link t)
- (insert (substitute-command-keys"\t \\[info-emacs-manual]\t"))
- (insert-button "Browse manuals"
- 'action (lambda (button) (Info-directory))
- 'follow-link t)
- (insert (substitute-command-keys "\t \\[info]
+ (let ((where (where-is-internal 'help-command nil t)))
+ (if where
+ (key-description where)
+ "M-x help"))))
+ (insert-button "Emacs manual"
+ 'action (lambda (button) (info-emacs-manual))
+ 'follow-link t)
+ (insert (substitute-command-keys"\t \\[info-emacs-manual]\t"))
+ (insert-button "Browse manuals"
+ 'action (lambda (button) (Info-directory))
+ 'follow-link t)
+ (insert (substitute-command-keys "\t \\[info]
"))
- (insert-button "Emacs tutorial"
- 'action (lambda (button) (help-with-tutorial))
- 'follow-link t)
- (insert (substitute-command-keys
- "\t \\[help-with-tutorial]\tUndo changes\t \\[advertised-undo]
+ (insert-button "Emacs tutorial"
+ 'action (lambda (button) (help-with-tutorial))
+ 'follow-link t)
+ (insert (substitute-command-keys
+ "\t \\[help-with-tutorial]\tUndo changes\t \\[advertised-undo]
"))
- (insert-button "Buy manuals"
- 'action (lambda (button) (view-order-manuals))
- 'follow-link t)
- (insert (substitute-command-keys
- "\t \\[view-order-manuals]\tExit Emacs\t \\[save-buffers-kill-terminal]")))
+ (insert-button "Buy manuals"
+ 'action (lambda (button) (view-order-manuals))
+ 'follow-link t)
+ (insert (substitute-command-keys
+ "\t \\[view-order-manuals]\tExit Emacs\t \\[save-buffers-kill-terminal]"))))
;; Say how to use the menu bar with the keyboard.
(insert "\n")
(insert "\tBuying printed manuals from the FSF\n"))
(defun startup-echo-area-message ()
- (if (eq (key-binding "\C-h\C-a") 'about-emacs)
- "For information about GNU Emacs and the GNU system, type C-h C-a."
- (substitute-command-keys
- "For information about GNU Emacs and the GNU system, type \
-\\[about-emacs].")))
-
+ (cond ((daemonp)
+ "Starting Emacs daemon.")
+ ((eq (key-binding "\C-h\C-a") 'about-emacs)
+ "For information about GNU Emacs and the GNU system, type C-h C-a.")
+ (t
+ (substitute-command-keys
+ "For information about GNU Emacs and the GNU system, type \
+\\[about-emacs]."))))
(defun display-startup-echo-area-message ()
(let ((resize-mini-windows t))
(defun command-line-1 (command-line-args-left)
(display-startup-echo-area-message)
-
- ;; Delay 2 seconds after an init file error message
- ;; was displayed, so user can read it.
- (when init-file-had-error
- (sit-for 2))
-
(when (and pure-space-overflow
(not noninteractive))
(display-warning
'initialization
- "Building Emacs overflowed pure space. (See the node Pure Storage in the Lisp manual for details.)"
+ "Building Emacs overflowed pure space.\
+ (See the node Pure Storage in the Lisp manual for details.)"
:warning))
(let ((file-count 0)
(if (string-match "^--" (car tem))
(push (list (car tem)) longopts)))
+ ;; Add the long NS options to longopts.
+ (dolist (tem command-line-ns-option-alist)
+ (if (string-match "^--" (car tem))
+ (push (list (car tem)) longopts)))
+
;; Loop, processing options.
(while command-line-args-left
(let* ((argi (car command-line-args-left))
(setq argi "")
;; Convert long options to ordinary options
;; and separate out an attached option argument into argval.
- (when (string-match "^\\(--[^=]*\\)=" argi)
+ (when (string-match "\\`\\(--[^=]*\\)=" argi)
(setq argval (substring argi (match-end 0))
argi (match-string 1 argi)))
- (if (equal argi "--")
- (setq completion nil)
- (setq completion (try-completion argi longopts)))
- (if (eq completion t)
- (setq argi (substring argi 1))
- (if (stringp completion)
- (let ((elt (assoc completion longopts)))
- (or elt
- (error "Option `%s' is ambiguous" argi))
- (setq argi (substring (car elt) 1)))
- (setq argval nil
- argi orig-argi))))
+ (when (string-match "\\`--." orig-argi)
+ (setq completion (try-completion argi longopts))
+ (if (eq completion t)
+ (setq argi (substring argi 1))
+ (if (stringp completion)
+ (let ((elt (assoc completion longopts)))
+ (or elt
+ (error "Option `%s' is ambiguous" argi))
+ (setq argi (substring (car elt) 1)))
+ (setq argval nil
+ argi orig-argi)))))
;; Execute the option.
(cond ((setq tem (assoc argi command-switch-alist))
(setq command-line-args-left
(nthcdr (nth 1 tem) command-line-args-left)))
+ ((setq tem (assoc argi command-line-ns-option-alist))
+ ;; Ignore NS-windows options and their args if not using NS.
+ (setq command-line-args-left
+ (nthcdr (nth 1 tem) command-line-args-left)))
+
((member argi '("-find-file" "-file" "-visit"))
(setq inhibit-startup-screen t)
;; An explicit option to specify visiting a file.
(if (= file-count 1)
(setq first-file-buffer (find-file file))
(find-file-other-window file)))
- (or (zerop line)
- (goto-line line))
+ (unless (zerop line)
+ (goto-char (point-min))
+ (forward-line (1- line)))
(setq line 0)
(unless (< column 1)
(move-to-column (1- column)))
(inhibit-startup-screen
(find-file-other-window file))
(t (find-file file))))
- (or (zerop line)
- (goto-line line))
+ (unless (zerop line)
+ (goto-char (point-min))
+ (forward-line (1- line)))
(setq line 0)
(unless (< column 1)
(move-to-column (1- column)))