diff options
| author | Stefan Monnier | 2009-09-16 17:54:13 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-09-16 17:54:13 +0000 |
| commit | d2fd733eb40fcb20dbed9a1b8ad1798e622e8f0f (patch) | |
| tree | 6c4a8253e8f1ecf103c8870e776ccb6f28cbb2d7 | |
| parent | 8f38189e4f1856e006611cc8c83fd88fc788e86d (diff) | |
| download | emacs-d2fd733eb40fcb20dbed9a1b8ad1798e622e8f0f.tar.gz emacs-d2fd733eb40fcb20dbed9a1b8ad1798e622e8f0f.zip | |
(command-line): Initialize the window-system after
processing the command-line.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/startup.el | 78 |
2 files changed, 43 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 37e4facd8a3..df2c734a341 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2009-09-16 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2009-09-16 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * startup.el (command-line): Initialize the window-system after | ||
| 4 | processing the command-line. | ||
| 5 | |||
| 3 | * textmodes/page.el (what-page): Make sure we don't inf-loop if | 6 | * textmodes/page.el (what-page): Make sure we don't inf-loop if |
| 4 | page-delimiter matches the empty string. | 7 | page-delimiter matches the empty string. |
| 5 | 8 | ||
diff --git a/lisp/startup.el b/lisp/startup.el index e7e988d367c..8ce63b3f037 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -727,44 +727,6 @@ opening the first frame (e.g. open a connection to an X server).") | |||
| 727 | (setq eol-mnemonic-dos "(DOS)" | 727 | (setq eol-mnemonic-dos "(DOS)" |
| 728 | eol-mnemonic-mac "(Mac)"))) | 728 | eol-mnemonic-mac "(Mac)"))) |
| 729 | 729 | ||
| 730 | ;; Make sure window system's init file was loaded in loadup.el if | ||
| 731 | ;; using a window system. | ||
| 732 | (condition-case error | ||
| 733 | (unless noninteractive | ||
| 734 | (if (and initial-window-system | ||
| 735 | (not (featurep | ||
| 736 | (intern | ||
| 737 | (concat (symbol-name initial-window-system) "-win"))))) | ||
| 738 | (error "Unsupported window system `%s'" initial-window-system)) | ||
| 739 | ;; Process window-system specific command line parameters. | ||
| 740 | (setq command-line-args | ||
| 741 | (funcall | ||
| 742 | (or (cdr (assq initial-window-system handle-args-function-alist)) | ||
| 743 | (error "Unsupported window system `%s'" initial-window-system)) | ||
| 744 | command-line-args)) | ||
| 745 | ;; Initialize the window system. (Open connection, etc.) | ||
| 746 | (funcall | ||
| 747 | (or (cdr (assq initial-window-system window-system-initialization-alist)) | ||
| 748 | (error "Unsupported window system `%s'" initial-window-system)))) | ||
| 749 | ;; If there was an error, print the error message and exit. | ||
| 750 | (error | ||
| 751 | (princ | ||
| 752 | (if (eq (car error) 'error) | ||
| 753 | (apply 'concat (cdr error)) | ||
| 754 | (if (memq 'file-error (get (car error) 'error-conditions)) | ||
| 755 | (format "%s: %s" | ||
| 756 | (nth 1 error) | ||
| 757 | (mapconcat (lambda (obj) (prin1-to-string obj t)) | ||
| 758 | (cdr (cdr error)) ", ")) | ||
| 759 | (format "%s: %s" | ||
| 760 | (get (car error) 'error-message) | ||
| 761 | (mapconcat (lambda (obj) (prin1-to-string obj t)) | ||
| 762 | (cdr error) ", ")))) | ||
| 763 | 'external-debugging-output) | ||
| 764 | (terpri 'external-debugging-output) | ||
| 765 | (setq initial-window-system nil) | ||
| 766 | (kill-emacs))) | ||
| 767 | |||
| 768 | (set-locale-environment nil) | 730 | (set-locale-environment nil) |
| 769 | 731 | ||
| 770 | ;; Convert preloaded file names in load-history to absolute. | 732 | ;; Convert preloaded file names in load-history to absolute. |
| @@ -869,6 +831,46 @@ opening the first frame (e.g. open a connection to an X server).") | |||
| 869 | (and command-line-args | 831 | (and command-line-args |
| 870 | (setcdr command-line-args args))) | 832 | (setcdr command-line-args args))) |
| 871 | 833 | ||
| 834 | ;; Make sure window system's init file was loaded in loadup.el if | ||
| 835 | ;; using a window system. | ||
| 836 | ;; Initialize the window-system only after processing the command-line | ||
| 837 | ;; args so that -Q can influence this initialization. | ||
| 838 | (condition-case error | ||
| 839 | (unless noninteractive | ||
| 840 | (if (and initial-window-system | ||
| 841 | (not (featurep | ||
| 842 | (intern | ||
| 843 | (concat (symbol-name initial-window-system) "-win"))))) | ||
| 844 | (error "Unsupported window system `%s'" initial-window-system)) | ||
| 845 | ;; Process window-system specific command line parameters. | ||
| 846 | (setq command-line-args | ||
| 847 | (funcall | ||
| 848 | (or (cdr (assq initial-window-system handle-args-function-alist)) | ||
| 849 | (error "Unsupported window system `%s'" initial-window-system)) | ||
| 850 | command-line-args)) | ||
| 851 | ;; Initialize the window system. (Open connection, etc.) | ||
| 852 | (funcall | ||
| 853 | (or (cdr (assq initial-window-system window-system-initialization-alist)) | ||
| 854 | (error "Unsupported window system `%s'" initial-window-system)))) | ||
| 855 | ;; If there was an error, print the error message and exit. | ||
| 856 | (error | ||
| 857 | (princ | ||
| 858 | (if (eq (car error) 'error) | ||
| 859 | (apply 'concat (cdr error)) | ||
| 860 | (if (memq 'file-error (get (car error) 'error-conditions)) | ||
| 861 | (format "%s: %s" | ||
| 862 | (nth 1 error) | ||
| 863 | (mapconcat (lambda (obj) (prin1-to-string obj t)) | ||
| 864 | (cdr (cdr error)) ", ")) | ||
| 865 | (format "%s: %s" | ||
| 866 | (get (car error) 'error-message) | ||
| 867 | (mapconcat (lambda (obj) (prin1-to-string obj t)) | ||
| 868 | (cdr error) ", ")))) | ||
| 869 | 'external-debugging-output) | ||
| 870 | (terpri 'external-debugging-output) | ||
| 871 | (setq initial-window-system nil) | ||
| 872 | (kill-emacs))) | ||
| 873 | |||
| 872 | (run-hooks 'before-init-hook) | 874 | (run-hooks 'before-init-hook) |
| 873 | 875 | ||
| 874 | ;; Under X Window, this creates the X frame and deletes the terminal frame. | 876 | ;; Under X Window, this creates the X frame and deletes the terminal frame. |