+(use-package org
+ :ensure t
+ :bind
+ (("C-c c" . org-capture)
+ ("C-c l" . org-store-link)
+ ("C-c a" . org-agenda))
+ :custom
+ (org-default-notes-file "~/Nextcloud/notes/inbox.org")
+ (org-agenda-files `(,org-default-notes-file "~/Nextcloud/notes/calendar.org"))
+ (org-capture-bookmark nil)
+ ;; Capture templates
+ (org-capture-templates
+ '(("f" "Fleeting note" entry
+ (file+headline org-default-notes-file "Notes")
+ "* %?\nEntered on %U\n %i\n %a")
+ ("b" "Tax receipt" item
+ (file "~/Documents/belastingen/FY24-25.org")
+ "* %t %a\n")
+ ("a" "Appointment" entry
+ (file+olp+datetree "~/Nextcloud/notes/calendar.org")
+ "* %?\n :PROPERTIES:\n :location: %^{Location}\n :END:\n%^T--%^T\n\n"
+ :jump-to-captured t
+ :tree-type month
+ :time-prompt t)
+ ("p" "Permanent note" plain
+ (file denote-last-path)
+ #'denote-org-capture
+ :no-save t
+ :immediate-finish nil
+ :kill-buffer t
+ :jump-to-captured t)
+ ("t" "New task" entry
+ (file+headline org-default-notes-file "Tasks")
+ "* TODO %i%?")
+ ("e" "Email follow-up" entry (file+headline org-default-notes-file "Tasks")
+ "* TODO %:fromname: %a %?\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))")))
+ ;; Agenda views
+ (org-agenda-custom-commands
+ '(("P" "Expired calendar events" ((tags "TIMESTAMP<=\"<now>\"")))
+ ("n" "Agenda and all TODOs" ((agenda "") (alltodo "")))))
+ :config
+ ;; Configure refile
+ (defun my/opened-buffer-files ()
+ "Return the list of org files currently opened in emacs"
+ (delq nil
+ (mapcar (lambda (x)
+ (if (and (buffer-file-name x)
+ (string-match "\\.org$"
+ (buffer-file-name x)))
+ (buffer-file-name x)))
+ (buffer-list))))
+ (setq org-refile-targets `((my/opened-buffer-files :maxlevel . 9)
+ (,(file-expand-wildcards "~/Nextcloud/notes/*.org") :maxlevel . 1)))
+ (setq org-agenda-skip-scheduled-if-done t)
+ (setq org-agenda-skip-deadline-if-done t)
+ (setq org-agenda-start-on-weekday nil)
+ (setq org-log-done 'time)
+ ;; Automatically flow lines based on window width and use
+ ;; variable width fonts in org-mode.
+ (add-hook 'org-mode-hook 'visual-line-mode)
+ (add-hook 'org-mode-hook 'variable-pitch-mode)
+ ;; org-mode support for R and LaTeX
+ (org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((R . t)
+ (latex . t))))
+
+(use-package org-caldav
+ :ensure t
+ :config
+ (setq org-caldav-url "https://owncloud.vanrenterghem.biz/remote.php/dav/calendars/frederik")
+ (setq org-caldav-calendar-id "orgmode")
+ ;; Org filename where new entries from calendar stored
+ (setq org-caldav-inbox "~/Nextcloud/notes/calendar.org")
+ ;; Additional Org files to check for calendar events
+ (setq org-caldav-files nil)
+ ;; Usually a good idea to set the timezone manually
+ (setq org-icalendar-timezone "Australia/Perth"))
+
+(use-package tex
+ :ensure auctex
+ :config
+ (setq TeX-auto-save t
+ TeX-parse-self t
+ TeX-view-program-selection
+ '(((output-dvi has-no-display-manager)
+ "dvi2tty")
+ ((output-dvi style-pstricks)
+ "dvips and gv")
+ (output-dvi "xdvi")
+ (output-pdf "PDF Tools")
+ (output-html "xdg-open"))))
+;; (load "preview-latex.el" nil t t)