[Org] Fix misplaced require when exporting calendar

This commit is contained in:
Daniel - 2017-10-29 22:27:38 +01:00
parent ff607e439f
commit 305c358ca9
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 20 additions and 20 deletions

View File

@ -804,28 +804,28 @@ _y_: ?y? year _q_: quit _L__l__c_: ?l?
"Export diary.org as ics file to the current value of `org-icalendar-combined-agenda-file.
This is done only if the value of this variable is not null."
(interactive)
(require 'ox-icalendar)
(if (null org-icalendar-combined-agenda-file)
(message "`org-icalendar-combined-agenda-file not set, not exporting diary.")
(progn
(require 'ox-icalendar)
(org-save-all-org-buffers)
(let ((org-agenda-files (list db/org-default-home-file
db/org-default-work-file))
(org-agenda-new-buffers nil))
;; check whether we need to do something
(when (some (lambda (org-file)
(file-newer-than-file-p org-file
org-icalendar-combined-agenda-file))
org-agenda-files)
(message "Exporting diary ...")
;; open files manually to avoid polluting `org-agenda-new-buffers; we dont
;; want these buffers to be closed after exporting
(mapc #'find-file-noselect (cl-remove-if #'null org-agenda-files))
;; actual export; calls `org-release-buffers and may thus close buffers
;; we want to keep around … which is why we set `org-agenda-new-buffers
;; to nil
(org-icalendar-combine-agenda-files)
(message "Exporting diary ... done."))))))
(progn
(org-save-all-org-buffers)
(let ((org-agenda-files (list db/org-default-home-file
db/org-default-work-file))
(org-agenda-new-buffers nil))
;; check whether we need to do something
(when (some (lambda (org-file)
(file-newer-than-file-p org-file
org-icalendar-combined-agenda-file))
org-agenda-files)
(message "Exporting diary ...")
;; open files manually to avoid polluting `org-agenda-new-buffers; we dont
;; want these buffers to be closed after exporting
(mapc #'find-file-noselect (cl-remove-if #'null org-agenda-files))
;; actual export; calls `org-release-buffers and may thus close buffers
;; we want to keep around … which is why we set `org-agenda-new-buffers
;; to nil
(org-icalendar-combine-agenda-files)
(message "Exporting diary ... done."))))))
(defun db/ical-to-org (ical-file-name org-file-name category filetags)
"Convert ICAL-FILE-NAME to ORG-FILE-NAME using ical2org.