Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Add IGNORE_EOF_ALWAYS option?
- X-seq: zsh-workers 29789
- From: Nikolai Weibull <now@xxxxxxxx>
- To: Zsh Workers <zsh-workers@xxxxxxx>
- Subject: Add IGNORE_EOF_ALWAYS option?
- Date: Wed, 21 Sep 2011 10:07:57 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=3B/zPLThFvLV2Ozc07113tkcTleMOGWykKuFFAfiCCA=; b=iY5v7/9/cQIKHwjLgrQrid0G5AZlYy+yQchR0jl6q6DcLofOMXHV/MR47AO2pOe3+T h99m4o8H3zPCKADmxkR8qKTsjUjLi9zdKqs17vzlmm2w1gp2WUmAV12rD2x3P/1/lQrZ aw0lQE5uGZC9zvYUiuBmq9XjqFkx+wOfA3DtE=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Sender: nikolai.weibull@xxxxxxxxx
Hi!
So I’m cooking up this weird set-up where I use ^D for
1. Exiting insert mode in Emacs (running Evil, a Vim emulation layer)
2. Suspending Emacs when in normal mode
3. Exiting insert mode in Zle (running in vi mode)
4. Placing the most recently suspended job in the foreground, if there
is one, otherwise exiting the shell, when in normal mode in Zle
This is set up with
(define-key evil-insert-state-map "\C-d" 'evil-normal-state)
(define-key evil-normal-state-map "\C-d" 'suspend-frame)
bindkey '^D' vi-cmd-mode
bindkey -a '^D' zle/foreground-or-exit
where zle/foreground-or-exit is defined as
emulate -L zsh
if (( $#jobdirs > 0 )); then
(( $+functions[set-terminal-title-from-command] )) &&
set-terminal-title-from-command fg
fg
else
exit
fi
This works fine except for number 4. Zsh wants to be helpful and print
zsh: use 'exit' to exit.
when I press ^D when the following conditions hold (Src/Zle/zle_main.c:1290):
1. ^D is bound to a user-defined command
2. The command line is empty
3. No arguments have been given (unclear exactly what this actually means)
4. IGNORE_EOF has been set
The problem is that I don’t want this behavior. Since IGNORE_EOF
doesn’t actually ignore EOF in all cases, I propose that
IGNORE_EOF_ALWAYS be added that acts exactly like IGNORE_EOF, but will
never print a message and simply invoke the user-defined command.
My current workaround is to add
stty eof undef
to my .zshrc, but that doesn’t feel like an ideal solution.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author