You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB
EmacsLisp

;;; $DOOMDIR/user/org.el -*- lexical-binding: t; -*-
(require 'org)
(require 'ox-org)
(add-hook! 'org-mode-hook 'org-num-mode)
(after! org
(setq
org-link-file-path-type 'relative
org-directory "~/Documents/org/"
org-roam-directory "~/Documents/org/"
org-attach-id-dir ".attach/"
+org-capture-journal-file "journal.org"
org-agenda-files '("agendas.org")
org-fancy-priorities-list '("󰈅󰈅󰈅" "󰈅󰈅" "󰈅")
org-link-file-path-type 'relative)
(org-link-set-parameters "rel" :follow #'browse-url :export #'wvxvw/export-rel-url)
(set-company-backend!
'org-mode
'company-capf 'company-files)
(setq org-todo-keywords
'((sequence
"TODO(t)"
"BLOCKED(b)"
"WIP(w)"
"REVIEW(r)"
"|"
"CLOSED(c)"
"RESOLVED(R)"
"DONE(d)")))
)
;; (setcdr (assq 'system org-file-apps-defaults-gnu) "xdg-open %s")
(setcdr (assq 'system org-file-apps-gnu) "xdg-open %s")
(advice-add 'org-open-file :around
(lambda (orig-fun &rest args)
;; Work around a weird problem with xdg-open.
(let ((process-connection-type nil))
(apply orig-fun args))))
(defun org-table-import-xlsx-to-csv-org ()
(interactive)
(let* ((source-file (file-name-sans-extension (buffer-file-name
(current-buffer))))
(xlsx-file (concat source-file ".xlsx"))
(csv-file (concat source-file ".csv")))
(org-odt-convert xlsx-file "csv")
(org-table-import csv-file nil)))
(defun org-table-import-xlsx-file-to-csv-org (file)
(interactive "f")
(let* ((source-file (file-name-sans-extension (buffer-file-name
(current-buffer))))
(xlsx-file (concat source-file ".xlsx"))
(csv-file (concat source-file ".csv")))
(org-odt-convert file "csv")
(org-table-import csv-file nil)))
;; I originally added this to fix relative links when converting org to html links but I'm pretty sure it doesn't even work
(defun wvxvw/export-rel-url (path desc format)
(cl-case format
(html (format "<a href=\"%s\">%s</a>" path (or desc path)))
(latex (format "\\href{%s}{%s}" path (or desc path)))
(otherwise path)))
(after! 'org-mode
(require 'ox-rst))