;;; startup.el --- process Emacs shell arguments -*- lexical-binding: t -*-
-;; Copyright (C) 1985-1986, 1992, 1994-2015 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1992, 1994-2016 Free Software Foundation,
;; Inc.
;; Maintainer: emacs-devel@gnu.org
(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\")
If your init file is byte-compiled, use the following form
instead:
- (eval '(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\"))
+ (eval \\='(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\"))
Thus, someone else using a copy of your init file will see the
startup message unless he personally acts to inhibit it."
:type '(choice (const :tag "Don't inhibit")
(defvaralias 'argv 'command-line-args-left
"List of command-line args not yet processed.
-This is a convenience alias, so that one can write \(pop argv\)
+This is a convenience alias, so that one can write \(pop argv)
inside of --eval command line arguments in order to access
following arguments.")
(internal-make-var-non-special 'argv)
:group 'initialization
:initialize #'custom-initialize-default
:set (lambda (_variable _value)
- (error "Customizing ‘site-run-file’ does not work")))
+ (error "Customizing `site-run-file' does not work")))
(make-obsolete-variable 'system-name "use (system-name) instead" "25.1")
(set-buffer elt)
(if default-directory
(setq default-directory
- (decode-coding-string default-directory coding t)))))
+ (if (eq system-type 'windows-nt)
+ ;; Convert backslashes to forward slashes.
+ (expand-file-name
+ (decode-coding-string default-directory coding t))
+ (decode-coding-string default-directory coding t))))))
;; Decode all the important variables and directory lists, now
;; that we know the locale's encoding. This is because the
method, which should parse the command line arguments. Those
pertaining to the window system should be processed and removed
from the returned command line.")
-(cl-defmethod handle-args-function (args &context (window-system (eql nil)))
+(cl-defmethod handle-args-function (args &context (window-system nil))
(tty-handle-args args))
(cl-defgeneric window-system-initialization (&optional _display)
(let ((elt (assoc completion tty-long-option-alist)))
;; Check for abbreviated long option.
(or elt
- (error "Option ‘%s’ is ambiguous" argi))
+ (error "Option `%s' is ambiguous" argi))
(setq argi (cdr elt)))
;; Check for a short option.
(setq argval nil
(defvar server-name)
(defvar server-process)
+(defun startup--setup-quote-display (&optional style)
+ "If needed, display ASCII approximations to curved quotes.
+Do this by modifying `standard-display-table'. Optional STYLE
+specifies the desired quoting style, as in `text-quoting-style'.
+If STYLE is nil, display appropriately for the terminal."
+ (let ((repls (let ((style-repls (assq style '((grave . "`'\"\"")
+ (straight . "''\"\"")))))
+ (if style-repls (cdr style-repls) (make-vector 4 nil))))
+ glyph-count)
+ ;; REPLS is a sequence of the four replacements for "‘’“”", respectively.
+ ;; If STYLE is nil, infer REPLS from terminal characteristics.
+ (unless style
+ ;; On a terminal that supports glyph codes,
+ ;; GLYPH-COUNT[i] is the number of times that glyph code I
+ ;; represents either an ASCII character or one of the 4
+ ;; quote characters. This assumes glyph codes are valid
+ ;; Elisp characters, which is a safe assumption in practice.
+ (when (integerp (internal-char-font nil (max-char)))
+ (setq glyph-count (make-char-table nil 0))
+ (dotimes (i 132)
+ (let ((glyph (internal-char-font
+ nil (if (< i 128) i (aref "‘’“”" (- i 128))))))
+ (when (<= 0 glyph)
+ (aset glyph-count glyph (1+ (aref glyph-count glyph)))))))
+ (dotimes (i 2)
+ (let ((lq (aref "‘“" i)) (rq (aref "’”" i))
+ (lr (aref "`\"" i)) (rr (aref "'\"" i))
+ (i2 (* i 2)))
+ (unless (if glyph-count
+ ;; On a terminal that supports glyph codes, use
+ ;; ASCII replacements unless both quotes are displayable.
+ ;; If not using ASCII replacements, highlight
+ ;; quotes unless they are both unique among the
+ ;; 128 + 4 characters of concern.
+ (let ((lglyph (internal-char-font nil lq))
+ (rglyph (internal-char-font nil rq)))
+ (when (and (<= 0 lglyph) (<= 0 rglyph))
+ (setq lr lq rr rq)
+ (and (= 1 (aref glyph-count lglyph))
+ (= 1 (aref glyph-count rglyph)))))
+ ;; On a terminal that does not support glyph codes, use
+ ;; ASCII replacements unless both quotes are displayable.
+ (and (char-displayable-p lq)
+ (char-displayable-p rq)))
+ (aset repls i2 lr)
+ (aset repls (1+ i2) rr)))))
+ (dotimes (i 4)
+ (let ((char (aref "‘’“”" i))
+ (repl (aref repls i)))
+ (if repl
+ (aset (or standard-display-table
+ (setq standard-display-table (make-display-table)))
+ char (vector (make-glyph-code repl 'escape-glyph)))
+ (when standard-display-table
+ (aset standard-display-table char nil)))))))
+
(defun command-line ()
"A subroutine of `normal-top-level'.
Amongst another things, it parses the command-line arguments."
((stringp completion)
(let ((elt (assoc completion longopts)))
(unless elt
- (error "Option ‘%s’ is ambiguous" argi))
+ (error "Option `%s' is ambiguous" argi))
(setq argi (substring (car elt) 1))))
(t
(setq argval nil
(setq done t)))
;; Was argval set but not used?
(and argval
- (error "Option ‘%s’ doesn't allow an argument" argi))))
+ (error "Option `%s' doesn't allow an argument" argi))))
;; Re-attach the --display arg.
(and display-arg (setq args (append display-arg args)))
(not (featurep
(intern
(concat (symbol-name initial-window-system) "-win")))))
- (error "Unsupported window system ‘%s’" initial-window-system))
+ (error "Unsupported window system `%s'" initial-window-system))
;; Process window-system specific command line parameters.
(setq command-line-args
(let ((window-system initial-window-system)) ;Hack attack!
'("no" "off" "false" "0")))))
(setq no-blinking-cursor t))
- ;; If curved quotes don't work, display ASCII approximations.
- (dolist (char-repl '((?‘ . [?\`]) (?’ . [?\']) (?“ . [?\"]) (?” . [?\"])))
- (when (not (char-displayable-p (car char-repl)))
- (or standard-display-table
- (setq standard-display-table (make-display-table)))
- (aset standard-display-table (car char-repl) (cdr char-repl))))
- (setq internal--text-quoting-flag t)
+ (unless noninteractive
+ (startup--setup-quote-display)
+ (setq internal--text-quoting-flag t))
;; Re-evaluate predefined variables whose initial value depends on
;; the runtime context.
(display-warning
'initialization
(format-message "\
-An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\
+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."
+the `--debug-init' option to view a complete error backtrace."
user-init-file
(get (car error) 'error-message)
(if (cdr error) ": " "")
(setq warned t)
(display-warning 'initialization
(format-message "\
-Your ‘load-path’ seems to contain\n\
-your ‘.emacs.d’ directory: %s\n\
+Your `load-path' seems to contain\n\
+your `.emacs.d' directory: %s\n\
This is likely to cause problems...\n\
Consider using a subdirectory instead, e.g.: %s"
dir (expand-file-name
(put 'cursor 'face-modified t))))
(defcustom initial-scratch-message (purecopy "\
-;; This buffer is for notes you don't want to save, and for Lisp evaluation.
-;; If you want to create a file, visit that file with C-x C-f,
-;; then enter the text in that file's own buffer.
+;; This buffer is for text that is not saved, and for Lisp evaluation.
+;; To create a file, visit it with \\[find-file] and enter text in its buffer.
")
- "Initial message displayed in *scratch* buffer at startup.
+ "Initial documentation displayed in *scratch* buffer at startup.
If this is nil, no message will be displayed."
:type '(choice (text :tag "Message")
(const :tag "none" nil))
auto-save-list-file-prefix)))
t)
(insert "\n\nIf an Emacs session crashed recently, "
- "type Meta-x recover-session RET\nto recover"
+ "type M-x recover-session RET\nto recover"
" the files you were editing.\n"))
(use-local-map splash-screen-keymap)
'action (lambda (_button) (info-emacs-manual))
'follow-link t)
(insert "\tView the Emacs manual using Info\n")
- (insert-button "\(Non)Warranty"
+ (insert-button "(Non)Warranty"
'action (lambda (_button) (describe-no-warranty))
'follow-link t)
(insert "\t\tGNU Emacs comes with ABSOLUTELY NO WARRANTY\n")
(insert-button "Visit New File"
'action (lambda (_button) (call-interactively 'find-file))
'follow-link t)
- (insert "\t\tSpecify a new file's name, to edit the file\n")
+ (insert (substitute-command-keys
+ "\t\tSpecify a new file's name, to edit the file\n"))
(insert-button "Open Home Directory"
'action (lambda (_button) (dired "~"))
'follow-link t)
(insert (substitute-command-keys " \\[tmm-menubar]")))
;; Many users seem to have problems with these.
- (insert "
+ (insert (substitute-command-keys "
\(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key.
-If you have no Meta key, you may instead type ESC followed by the character.)")
+If you have no Meta key, you may instead type ESC followed by the character.)"))
;; Insert links to useful tasks
(insert "\nUseful tasks:\n")
(if (stringp completion)
(let ((elt (member completion longopts)))
(or elt
- (error "Option ‘%s’ is ambiguous" argi))
+ (error "Option `%s' is ambiguous" argi))
(setq argi (substring (car elt) 1)))
(setq argval nil
argi orig-argi)))))
(setq inhibit-startup-screen t)
(setq tem (or argval (pop command-line-args-left)))
(or (stringp tem)
- (error "File name omitted from ‘-insert’ option"))
+ (error "File name omitted from `-insert' option"))
(insert-file-contents (command-line-normalize-file-name tem)))
((equal argi "-kill")
;; An explicit option to specify visiting a file.
(setq tem (or argval (pop command-line-args-left)))
(unless (stringp tem)
- (error "File name omitted from ‘%s’ option" argi))
+ (error "File name omitted from `%s' option" argi))
(funcall process-file-arg tem))
;; These command lines now have no effect.
(unless did-hook
;; Presume that the argument is a file name.
(if (string-match "\\`-" argi)
- (error "Unknown option ‘%s’" argi))
+ (error "Unknown option `%s'" argi))
;; FIXME: Why do we only inhibit the startup
;; screen for -nw?
(unless initial-window-system
(get-buffer "*scratch*")
(with-current-buffer "*scratch*"
(when (zerop (buffer-size))
- (insert initial-scratch-message)
+ (insert (substitute-command-keys initial-scratch-message))
(set-buffer-modified-p nil))))
;; Prepend `initial-buffer-choice' to `displayable-buffers'.