mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 05:00:59 +01:00
update calendar to run calendar_show in current shell
This commit is contained in:
parent
95a581f6d4
commit
5e629a4565
2 changed files with 18 additions and 13 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
2010-03-19 Peter Stephenson <pws@csr.com>
|
2010-03-19 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* unposted: Functions/Calendar/calendar: update previous
|
||||||
|
change also to perform calendar_show in current shell since
|
||||||
|
it interacts better with zle for use with sched.
|
||||||
|
|
||||||
* 27808: Completion/Unix/Type/_files: Use // parameter
|
* 27808: Completion/Unix/Type/_files: Use // parameter
|
||||||
substitution instead of :gs. This form is consistent with the
|
substitution instead of :gs. This form is consistent with the
|
||||||
rest of the file and has handled quoting correctly for longer.
|
rest of the file and has handled quoting correctly for longer.
|
||||||
|
|
@ -12934,5 +12938,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.4938 $
|
* $Revision: 1.4939 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,6 @@ if [[ -n $warnstr ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local myschedcmds="${TMPPREFIX:-/tmp/zsh}.sched.$$"
|
|
||||||
|
|
||||||
[[ -f $calendar ]] || return 1
|
[[ -f $calendar ]] || return 1
|
||||||
|
|
||||||
# We're not using getopts because we want +... to refer to a
|
# We're not using getopts because we want +... to refer to a
|
||||||
|
|
@ -255,6 +253,10 @@ if (( verbose )); then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local mycmds="${TMPPREFIX:-/tmp/zsh}.calendar_cmds.$$"
|
||||||
|
touch $mycmds
|
||||||
|
chmod 600 $mycmds
|
||||||
|
|
||||||
# start of subshell for OS file locking
|
# start of subshell for OS file locking
|
||||||
(
|
(
|
||||||
# start of block for following always to clear up lockfiles.
|
# start of block for following always to clear up lockfiles.
|
||||||
|
|
@ -322,14 +324,15 @@ fi
|
||||||
showline=${showline%%[[:space:]]#}
|
showline=${showline%%[[:space:]]#}
|
||||||
if (( showall || (t >= start && (remaining || t <= stop || icount < showcount)) ))
|
if (( showall || (t >= start && (remaining || t <= stop || icount < showcount)) ))
|
||||||
then
|
then
|
||||||
$showprog $start $stop "$showline"
|
print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
|
||||||
(( icount++ ))
|
(( icount++ ))
|
||||||
# Doesn't count as "shown" unless the event has now passed.
|
# Doesn't count as "shown" unless the event has now passed.
|
||||||
(( t <= EPOCHSECONDS )) && (( shown = 1 ))
|
(( t <= EPOCHSECONDS )) && (( shown = 1 ))
|
||||||
elif [[ -n $sched ]]; then
|
elif [[ -n $sched ]]; then
|
||||||
(( tsched = t - mywarntime ))
|
(( tsched = t - mywarntime ))
|
||||||
if (( tsched >= start && tsched <= stop)); then
|
if (( tsched >= start && tsched <= stop)); then
|
||||||
$showprog $start $stop "due in ${mywarnstr}: $showline"
|
showline="due in ${mywarnstr}: $showline"
|
||||||
|
print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
|
||||||
elif (( tsched < start )); then
|
elif (( tsched < start )); then
|
||||||
# We haven't actually shown it, but it's in the past,
|
# We haven't actually shown it, but it's in the past,
|
||||||
# so treat it the same. Should probably rename this variable.
|
# so treat it the same. Should probably rename this variable.
|
||||||
|
|
@ -398,12 +401,12 @@ fi
|
||||||
i=${"${(@)zsh_scheduled_events#*:*:}"[(I)calendar -s*]}
|
i=${"${(@)zsh_scheduled_events#*:*:}"[(I)calendar -s*]}
|
||||||
{
|
{
|
||||||
(( i )) && print sched -$i
|
(( i )) && print sched -$i
|
||||||
print $sched $next calendar "${calopts[@]}" $next $next
|
print -r -- ${(qq)sched} $next calendar "${calopts[@]}" $next $next
|
||||||
} >$myschedcmds
|
} >>$mycmds
|
||||||
else
|
else
|
||||||
$showprog $start $stop \
|
showline="No more calendar events: calendar not rescheduled.
|
||||||
"No more calendar events: calendar not rescheduled.
|
|
||||||
Run \"calendar -s\" again if you add to it."
|
Run \"calendar -s\" again if you add to it."
|
||||||
|
print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -433,8 +436,6 @@ Old calendar left in $calendar.old." >&2
|
||||||
exit $rstat
|
exit $rstat
|
||||||
) && {
|
) && {
|
||||||
# Tasks that need to be in the current shell
|
# Tasks that need to be in the current shell
|
||||||
if [[ -f $myschedcmds ]]; then
|
[[ -s $mycmds ]] && . $mycmds
|
||||||
. $myschedcmds
|
rm -f $mycmds
|
||||||
rm -f $myschedcmds
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue