diff options
author | Glenn Morris <rgm@gnu.org> | 2014-02-26 14:40:56 -0500 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-02-26 14:40:56 -0500 |
commit | 1d491ef203a07bf570436b8f7f47b965eee1cd2b (patch) | |
tree | a94c47d10224e3e317c9926cfb09313639f48ff9 | |
parent | 9577b56996868204a5e86e0233a763652b42b788 (diff) | |
download | emacs-1d491ef203a07bf570436b8f7f47b965eee1cd2b.tar.gz |
Avoid calling tty-setup-hook twice
eg if a term file explicitly calls tty-run-terminal-initialization
* lisp/faces.el (tty-run-terminal-initialization): Add run-hook argument.
(tty-create-frame-with-faces): Use it.
* lisp/startup.el (command-line): Pass run-hook argument
to tty-run-terminal-initialization.
Fixes: debbugs:16859
-rw-r--r-- | lisp/ChangeLog | 7 | ||||
-rw-r--r-- | lisp/faces.el | 12 | ||||
-rw-r--r-- | lisp/startup.el | 2 |
3 files changed, 15 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4748767f939..510784e459a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2014-02-26 Glenn Morris <rgm@gnu.org> + Avoid calling tty-setup-hook twice, eg if a term file + explicitly calls tty-run-terminal-initialization. (Bug#16859) + * faces.el (tty-run-terminal-initialization): Add run-hook argument. + (tty-create-frame-with-faces): Use it. + * startup.el (command-line): Pass run-hook argument + to tty-run-terminal-initialization. + * dired.el (dired-restore-desktop-buffer): Demote errors; eg in case a glob match fails. (Bug#16884) diff --git a/lisp/faces.el b/lisp/faces.el index 985355ade09..e008993b49f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2080,7 +2080,7 @@ If PARAMETERS contains a `reverse' parameter, handle that." (unless (terminal-parameter frame 'terminal-initted) (set-terminal-parameter frame 'terminal-initted t) (set-locale-environment nil frame) - (tty-run-terminal-initialization frame)) + (tty-run-terminal-initialization frame nil t)) (frame-set-background-mode frame t) (face-set-after-frame-default frame parameters) (setq success t)) @@ -2110,11 +2110,13 @@ the above example." Specifically, `tty-run-terminal-initialization' runs this. This can be used to fine tune the `input-decode-map', for example.") -(defun tty-run-terminal-initialization (frame &optional type) +(defun tty-run-terminal-initialization (frame &optional type run-hook) "Run the special initialization code for the terminal type of FRAME. The optional TYPE parameter may be used to override the autodetected -terminal type to a different value. As a final step, this runs the -hook `tty-setup-hook'. +terminal type to a different value. + +If optional argument RUN-HOOK is non-nil, then as a final step, +this runs the hook `tty-setup-hook'. If you set `term-file-prefix' to nil, this function does nothing." (setq type (or type (tty-type frame))) @@ -2139,7 +2141,7 @@ If you set `term-file-prefix' to nil, this function does nothing." (when (fboundp term-init-func) (funcall term-init-func)) (set-terminal-parameter frame 'terminal-initted term-init-func) - (run-hooks 'tty-setup-hook))))) + (if run-hook (run-hooks 'tty-setup-hook)))))) ;; Called from C function init_display to initialize faces of the ;; dumped terminal frame on startup. diff --git a/lisp/startup.el b/lisp/startup.el index 9c9f23ba9a6..531cba2af55 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1286,7 +1286,7 @@ the `--debug-init' option to view a complete error backtrace." ;; User init file can set term-file-prefix to nil to prevent this. (unless (or noninteractive initial-window-system) - (tty-run-terminal-initialization (selected-frame))) + (tty-run-terminal-initialization (selected-frame) nil t)) ;; Update the out-of-memory error message based on user's key bindings ;; for save-some-buffers. |