1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-11 08:21:13 +01:00
zsh/Functions/Calendar/calendar_edit

21 lines
440 B
Text

local editor=${VISUAL:-${EDITOR:-vi}}
local line calendar
local -a lockfiles
integer cal_running
sched | while read line; do
[[ $line = *" calendar -s "<->" "<-> ]] && (( cal_running = 1 ))
done
zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar
{
calendar_lockfiles $calendar || return 1
eval $editor \$calendar
} always {
(( ${#lockfiles} )) && rm -f $lockfiles
}
(( cal_running )) && calendar -s