* precmd() affecting the "r" command output
@ 2005-06-12 17:05 Josselin Noirel
2005-06-12 19:39 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Josselin Noirel @ 2005-06-12 17:05 UTC (permalink / raw)
To: zsh-workers
Hi,
I'm using the precmd() special function to print the current directory
and the hostname in the title bar of my xterms. But doing this, the
output of the r command (executing again the last command) is affected
in a unexpected and unwanted way - I guess.
1> which precmd
precmd not found
2> locate foobar
/usr/TeX/texmf-dist/doc/latex/examdesign/foobar.tex
3> less `r`
locate foobar
4> precmd () {
function> print -Pn "\e]0;[ %n@%m: %~ ]\a"
function> }
5> locate foobar
/usr/TeX/texmf-dist/doc/latex/examdesign/foobar.tex
6> less `r`
locate foobar
test@matamore:: No such file or directory
/home/noirel is a directory
]/usr/TeX/texmf-dist/doc/latex/examdesign/foobar.tex: No such file or
directory
7>
precmd() is supposed to be executed once before each prompt (according
to the man page) but here it is executed one more time, when "r" is
executed. I think that either the behaviour or the man page is
wrong and should therefore be corrected.
Thank you for your time (and for zsh of course),
--
Josselin Noirel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: precmd() affecting the "r" command output
2005-06-12 17:05 precmd() affecting the "r" command output Josselin Noirel
@ 2005-06-12 19:39 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2005-06-12 19:39 UTC (permalink / raw)
To: zsh-workers
On Jun 12, 7:05pm, Josselin Noirel wrote:
} Subject: precmd() affecting the "r" command output
}
} precmd() is supposed to be executed once before each prompt (according
} to the man page) but here it is executed one more time, when "r" is
} executed.
I'm surprised no one has ever noticed this before (it's been happening
this way for *years*), but I think this is what's needed:
Index: Src/init.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/init.c,v
retrieving revision 1.20
diff -c -r1.20 init.c
--- Src/init.c 14 Apr 2005 04:33:51 -0000 1.20
+++ Src/init.c 12 Jun 2005 19:34:24 -0000
@@ -112,7 +112,7 @@
hbegin(1); /* init history mech */
if (isset(SHINSTDIN)) {
setblock_stdin();
- if (interact) {
+ if (interact && toplevel) {
int hstop = stophist;
stophist = 3;
preprompt();
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-12 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-12 17:05 precmd() affecting the "r" command output Josselin Noirel
2005-06-12 19:39 ` Bart Schaefer
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).