* bug#16859: tty-setup-hook can run twice
@ 2014-02-24 1:39 Glenn Morris
2014-02-25 9:06 ` Glenn Morris
0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2014-02-24 1:39 UTC (permalink / raw)
To: 16859
Package: emacs
Version: 24.3.50
Current trunk on GNU/Linux.
I don't know if this matters, but tty-setup-hook can run twice.
From an xterm:
export TERM=xterm
export COLORTERM=rxvt
cat <<EOF >| /tmp/.emacs
(add-hook 'tty-setup-hook (lambda () (message "hi")))
EOF
HOME=/tmp ./src/emacs -nw
C-h e
-> hi [2 times]
This is because tty-run-terminal-initialization runs terminal-init-xterm,
which in this case calls tty-run-terminal-initialization again with type
"rxvt".
Since several of the other init functions in term/ run
tty-run-terminal-initialization, this could happen with other terminal
types as well.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16859: tty-setup-hook can run twice
2014-02-24 1:39 bug#16859: tty-setup-hook can run twice Glenn Morris
@ 2014-02-25 9:06 ` Glenn Morris
2014-02-25 22:01 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2014-02-25 9:06 UTC (permalink / raw)
To: 16859
Possible solutions:
1) Let-bind tty-setup-hook to nil round all calls to
tty-run-terminal-initialization in term/*.el.
2) Move running of tty-setup-hook out of tty-run-terminal-initialization,
into tty-create-frame-with-faces and command-line.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16859: tty-setup-hook can run twice
2014-02-25 9:06 ` Glenn Morris
@ 2014-02-25 22:01 ` Stefan Monnier
2014-02-25 22:24 ` Glenn Morris
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-02-25 22:01 UTC (permalink / raw)
To: Glenn Morris; +Cc: 16859
> 1) Let-bind tty-setup-hook to nil round all calls to
> tty-run-terminal-initialization in term/*.el.
I don't like let-binding hooks (e.g. it doesn't work right when the hook
has both a global and a buffer-local value).
> 2) Move running of tty-setup-hook out of tty-run-terminal-initialization,
> into tty-create-frame-with-faces and command-line.
I haven't looked at it, but it sounds preferable, yes,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16859: tty-setup-hook can run twice
2014-02-25 22:01 ` Stefan Monnier
@ 2014-02-25 22:24 ` Glenn Morris
2014-02-26 15:55 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2014-02-25 22:24 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 16859
Stefan Monnier wrote:
>> 1) Let-bind tty-setup-hook to nil round all calls to
>> tty-run-terminal-initialization in term/*.el.
>
> I don't like let-binding hooks (e.g. it doesn't work right when the hook
> has both a global and a buffer-local value).
>
>> 2) Move running of tty-setup-hook out of tty-run-terminal-initialization,
>> into tty-create-frame-with-faces and command-line.
>
> I haven't looked at it, but it sounds preferable, yes,
Or you can have option 3:
3) Add optional DO-NOT-RUN-HOOK (or the inverse) argument to
tty-run-terminal-initialization.
BTW, I also noticed that the hook runs when emacs --daemon is started,
which seems odd?
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16859: tty-setup-hook can run twice
2014-02-25 22:24 ` Glenn Morris
@ 2014-02-26 15:55 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-02-26 15:55 UTC (permalink / raw)
To: Glenn Morris; +Cc: 16859
> 3) Add optional DO-NOT-RUN-HOOK (or the inverse) argument to
> tty-run-terminal-initialization.
I guess for backward compatibility's sake, adding a RUN-HOOK is a good idea.
> BTW, I also noticed that the hook runs when emacs --daemon is started,
> which seems odd?
Indeed, since we do
(unless (or noninteractive
initial-window-system)
(tty-run-terminal-initialization (selected-frame)))
it would make sense to also prevent tty-run-terminal-initialization when
in daemon (tho I thought `noninteractive' would be set for daemon, but
maybe this is run late enough that `noninteractive' has already been
changed to nil by then).
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-26 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 1:39 bug#16859: tty-setup-hook can run twice Glenn Morris
2014-02-25 9:06 ` Glenn Morris
2014-02-25 22:01 ` Stefan Monnier
2014-02-25 22:24 ` Glenn Morris
2014-02-26 15:55 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.