zsh-workers
 help / color / mirror / code / Atom feed
* Add IGNORE_EOF_ALWAYS option?
@ 2011-09-21  8:07 Nikolai Weibull
  2011-09-21 16:10 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2011-09-21  8:07 UTC (permalink / raw)
  To: Zsh Workers

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-21 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21  8:07 Add IGNORE_EOF_ALWAYS option? Nikolai Weibull
2011-09-21 16:10 ` Bart Schaefer
2011-09-21 16:33   ` Nikolai Weibull
2011-09-21 17:25     ` S. Cowles

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).