Skip to content

Commit

Permalink
add keyword for soccer fixture etc
Browse files Browse the repository at this point in the history
  • Loading branch information
md-arif-shaikh committed Apr 10, 2023
1 parent 8de8111 commit c99a20c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion soccer.el
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ Remember to add this in the list of agenda files if it's not already added."
:type 'string
:group 'soccer)

(defcustom soccer-schedule-keyword "FOOTBALL"
"Keyword to represent fixture schedule in agenda view."
:type 'string
:group 'soccer)

(defun soccer--get-schedule-file-name (league)
"Get the file name based on LEAGUE."
(file-name-concat soccer-schedule-dir (format "%s.org" (string-replace " " "-" league))))
Expand Down Expand Up @@ -632,7 +637,7 @@ Remember to add this in the list of agenda files if it's not already added."
(cl-loop for h in headers
for ts in timestamps
when (not (soccer--schedule-existsp h file-name))
do (insert (format "* %s\n%s\n\n" h ts)))
do (insert (format "* %s %s\n%s\n\n" soccer-schedule-keyword h ts)))
(append-to-file (point-min) (point-max) file-name))
(with-current-buffer (find-file-noselect file-name)
(write-file file-name)
Expand Down Expand Up @@ -684,5 +689,18 @@ Remember to add this in the list of agenda files if it's not already added."
(forward-line))
(write-file file-name))))

;;;###autoload
(defun soccer-schedule-remove-league (league)
"Remove all fixtures of a LEAGUE.
This will remove the org file for the given league."
(interactive
(let* ((league-name (completing-read "league: " (soccer--get-league-names))))
(list league-name)))
(let* ((file-name (soccer--get-schedule-file-name league)))
;;; check if any file for the league exists
(unless (file-exists-p file-name)
(user-error "No schedule file for %s exists!" league))
(delete-file file-name)))

(provide 'soccer)
;;; soccer.el ends here

0 comments on commit c99a20c

Please sign in to comment.