Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: edit-command-line: disable `monitor' option locally



Bart Schaefer wrote:
> On Mar 17, 11:08am, Frank Terbeck wrote:
[...]
> } Um. How do you end up with a backgrounded editor with this patch?
> } Shouldn't it be impossible to background the editor if `monitor' is
> } unset? I can't seem to get that to happen on my linux-based laptop.
[...]
> Now here's how it differs with your patch applied:
>
> torch% echo otherthing
>
> torch% echo otherthing
> otherthing
> torch% jobs
> [1]  + suspended  
> torch% 
>
> I.e. the only thing that changed was whether I got notified about the
> job being suspended.  Vim still handled the ^Z and stopped itself.
> But bad things happen if I try to bring it back into the foreground
> because zsh doesn't send CONT to the correct process group (I think
> is what's going on, but I can't be sure).

Huh. That's quite bad. :-/

> } In any case, I think the widget should protect the user from losing the
> } command line. And disallowing the editor from backgrounding should do
> } that (and in fact does for me).
>
> I agree but don't think twaddling no_monitor is sufficient.  If you
> remove no_monitor but add xtrace to the setopts in edit-command-line,
> what do you see after you hit ^Z in vim?  I get this:
>
> ----
> torch% echo foo+edit-command-line:2> local 'tmpfile=/tmp/zshecl26567'
> +edit-command-line:3> print -R - 'echo foo'
> +edit-command-line:5> vi /tmp/zshecl26567
>
>
> zsh: suspended  
> torch% echo foo+edit-command-line:6> print -Rz - 'echo foo'
> +edit-command-line:7> rm -f /tmp/zshecl26567
> +edit-command-line:8> zle send-break
>
> torch% echo foo
> ----
>
> I suspect that in your case the entire edit-command-line function is
> stopped, so rm -f / zle send-break never happens until after you bring
> it into the foreground again, but I don't know why it differs for me.

Here it is:
[snip]
% zsh -f
zsh% cat t
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey $'\ee' edit-command-line
zsh% source ./t
zsh% echo foobar+edit-command-line:11> local 'tmpfile=/tmp/zshecl16683'
+edit-command-line:13> print -R - 'echo foobar'
+edit-command-line:15> vim /tmp/zshecl16683
zsh: suspended  

zsh% fg
[1]  + continued  
+edit-command-line:16> print -Rz - 'echo foobar'
+edit-command-line:18> rm -f /tmp/zshecl16683
+edit-command-line:19> zle send-break
edit-command-line:zle:19: widgets can only be called when ZLE is active
[snap]


-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



Messages sorted by: Reverse Date, Date, Thread, Author