about summary refs log tree commit diff
path: root/Functions/Calendar/calendar_edit
blob: e31decb7614a5a798b9d8e857762abb313053c00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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