zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Vincent Lefevre <vincent@vinc17.org>, zsh-users@sunsite.dk
Subject: Re: get the number of active jobs to show in the prompt?
Date: Wed, 3 Oct 2001 15:58:06 +0000	[thread overview]
Message-ID: <1011003155807.ZM26499@candle.brasslantern.com> (raw)
In-Reply-To: <20011003173500.A1255@greux.loria.fr>

On Oct 3,  5:35pm, Vincent Lefevre wrote:
} Subject: Re: get the number of active jobs to show in the prompt?
}
} On Wed, Oct 03, 2001 at 15:11:04 +0000, Bart Schaefer wrote:
} > There are two issues:  One, I think it's a bad idea in the first place
} > because its potentially very disruptive to the interactive experience.
} > Imagine how you'd feel using, say, "vi" if it were to exit in the middle
} > of you typing a sentence and then start up again with the text you were
} > editing possibly shifted to another part of the screen.
} 
} But this is not caused by calling a function when the prompt is
} redisplayed. This is caused by the NOTIFY option. And any user
} can disable it.

I'm addressing your original question, which, paraphrased, was, "Is there
a way to force the prompt to be recomputed rather than just redisplayed
when I'm notified that a job has exited?  And I want `setopt notify'."

If notify isn't involved, precmd is already sufficient.  If notify is
involved, then the fact that the prompt could change length and that the
current "prompt level" could need to change from PS2 or deeper back to
PS1, leads to all the objections that have been raised.

} Perhaps I could disable NOTIFY when zle is active and use TRAPCLD with
} zle -M in this case. Is it possible? For instance with a setopt nonotify
} in precmd and a setopt notify in preexec?

Unfortunately, installing a TRAPCLD handler forces `notify' to behave as
if it were on, even if it's actually off.  I reported this to zsh-workers
yesterday.

} > It's another matter if this happens on an explicit user action -- you
} > could create your own widget that would redraw the prompt, and bind it
} > to ctrl-L or something.
} 
} How can I do that (to rebuild the prompt when clear-screen is called)?

Basically the same way I did it in push-line-at-random:

    function redraw-prompt {
	local nested=${(%):-%_}
	# zle .clear-screen	# You may or may not want this
	if [[ -n $nested ]]
	then
	    zle .push-line-or-edit
	else
	    zle .push-input
	    zle .send-break	# Force new prompt; sorry about beeping
	fi
    }
    # Pick one:
    # zle -N clear-screen redraw-prompt
    # zle -N redraw-prompt; bindkey '^L' redraw-prompt


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-10-03 15:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-01  5:56 Drew Perttula
2001-10-01  6:09 ` Goran Koruga
2001-10-01  6:12 ` Sweth Chandramouli
2001-10-01  6:37   ` Phil Pennock
2001-10-01  6:59     ` Drew Perttula
2001-10-01  7:08     ` Sweth Chandramouli
2001-10-01  8:28 ` Deborah Ariel Pickett
2001-10-01  9:04   ` Phil Pennock
2001-10-01 17:44     ` Vincent Lefevre
2001-10-02 15:43       ` Bart Schaefer
2001-10-02 16:13         ` Vincent Lefevre
2001-10-02 23:25           ` Deborah Ariel Pickett
2001-10-02 23:29             ` unsubscribe me Matthew Lyon
2001-10-03  0:06             ` get the number of active jobs to show in the prompt? Vincent Lefevre
2001-10-03  5:43               ` Bart Schaefer
2001-10-03 14:22                 ` Vincent Lefevre
2001-10-03 14:59                   ` Vincent Lefevre
2001-10-03 15:11                   ` Bart Schaefer
2001-10-03 15:35                     ` Vincent Lefevre
2001-10-03 15:58                       ` Bart Schaefer [this message]
2001-10-03 16:47                         ` Vincent Lefevre
2001-10-03 17:09                           ` Bart Schaefer
2001-10-03 19:34                             ` Vincent Lefevre
2001-10-03 20:01                               ` Bart Schaefer
2001-10-03 20:08                                 ` Vincent Lefevre
2001-10-03 21:46                                   ` Bart Schaefer
2001-10-03 21:51                                     ` Bart Schaefer
2001-10-03 23:15                                       ` Vincent Lefevre
2001-10-04  0:05                                         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1011003155807.ZM26499@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=vincent@vinc17.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).