;;; mf-org.el --- My configuration for Org mode and Org Roam -*- lexical-binding: t -*- ;;; Code: ;; Org mode (defun mf/org-mode-hook () (auto-fill-mode) (yas-minor-mode) (org-fragtog-mode) (org-modern-mode)) (mf/install org-modern (setq org-modern-star '("" "" "" "" "" ""))) (mf/install org-edna) (mf/install org-ref) (mf/install org-fragtog) (mf/install ob-go) (mf/install org-super-agenda) (mf/install orgit) (mf/install org-roam (message "Loaded org-roam") (setq org-roam-directory (file-truename "~/doc/pers/org/Notes/") org-roam-v2-ack t org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) (define-key org-mode-map (kbd "C-c b") #'org-roam-buffer-toggle) (org-roam-db-autosync-mode)) (mf/install org-rich-yank) (mf/install ob-async) (setq org-directory (file-truename "~/doc/pers/org/")) (mf/install org (message "Loaded org-mode") (org-super-agenda-mode) (require 'org-tempo) (plist-put org-format-latex-options :scale 2.0) (setq org-archive-location (concat org-directory "agenda.org::* Past") org-agenda-window-setup 'other-window org-agenda-restore-windows-after-quit nil org-agenda-sticky nil org-agenda-skip-archived-trees t org-agenda-start-with-log-mode t org-agenda-include-diary t org-agenda-todo-list-sublevels t org-columns-default-format-for-agenda "%40ITEM(Task) %TODO %TAGS %17Effort(Estimated Effort){:} %CLOCKSUM" org-log-done 'time org-log-into-drawer t org-todo-keywords '((sequence "TODO(t)" "NEXT(n!)" "WAITING(w@/!)" "|" "DONE(d)" "NO(N@)")) org-todo-keyword-faces '(("TODO" . org-todo) ("WAITING" . (:inherit org-todo :foreground "#b0b0b0")) ("DONE" . org-done) ("NO" . error)) org-use-fast-todo-selection 'expert org-super-agenda-groups '((:name "Deadlines Laurea" :and (:tag "laurea" :deadline t)) (:name "Esami" :tag "esame") (:name "Laurea" :tag "laurea") (:name "Uni" :tag "@uni") (:name "Work" :tag "@work")) org-agenda-prefix-format '((agenda . "%i %-12:c%?-12t% s") (todo . "") (tags . "%i %-12:c") (search . "%i %-12:c")) org-agenda-files (mapcar #'(lambda (name) (concat org-directory name)) '("inbox.org" "agenda.org" "projects.org" "journal.org")) org-default-notes-file (concat org-directory "notes.org") org-capture-templates `(("a" "Agenda" entry (file+headline "agenda.org" "Agenda") "** TODO %?\n/Entered on/ %U") ("b" "Birthday" entry (file+headline "agenda.org" "Recurrent") "** %?\n%t\n" :time-prompt t) ("i" "Inbox" entry (file "inbox.org") "* TODO %?\n/Entered on/ %U") ("j" "Journal") ("jj" "New journal entry" entry (file+datetree "journal.org") "* Log\n") ("jl" "Log entry" entry (file+datetree "journal.org") "** %? (%a)\n") ("u" "University project" entry (file+headline "projects.org" "University") "** %?\n/Created on/ %U\n*** TODO [#A] Lezioni\n*** TODO [#B] Esercizi\n*** TODO [#A] Schema\n") ("@" "Inbox [mu4e]" entry (file "inbox.org") "* TODO Process \"%a\" %?\n/Entered on/ %U") ("m" "Meeting" entry (file+headline "agenda.org" "Future") "* %? :meeting:\n<%<%Y-%m-%d %a %H:%M>>") ("n" "Notes" entry (file "notes.org") "* Note (%a)\n/Entered on/ %U\n\n%?")) org-agenda-custom-commands '(("a" "Agenda for current week or day" ((agenda "") (todo))) ("g" "Get Things Done (GTD)" ((agenda "" ((org-agenda-span 'day) (org-agenda-include-diary nil) (org-agenda-include-deadlines t) (org-agenda-skip-function '(org-agenda-skip-entry-if 'regexp "\\* \\(DONE\\|NO\\)")))) (todo "NEXT|WAITING" ((org-agenda-prefix-format " %i %-12:c%-4e ") (org-agenda-overriding-header "\nNEXT or WAITING\n"))) (todo "TODO" ((org-agenda-prefix-format " %i %-12:c%-4e ") (org-agenda-overriding-header "\nTODO\n")))))) org-refile-targets '(("projects.org" :level . 3)) org-refile-use-outline-path 'file org-outline-path-complete-in-steps nil org-confirm-babel-evaluate nil org-html-doctype "html4-strict" org-html-head "" org-html-head-extra "" org-html-head-include-default-style nil org-html-head-include-scripts nil org-html-preamble nil org-html-postamble nil org-html-use-infojs nil org-latex-packages-alist '(("" "physics" t '("pdflatex")) ("" "amsmath" t '("pdflatex")) ("" "amsfonts" t '("pdflatex")))) (define-key org-mode-map (kbd "M-o") #'consult-outline) (define-key org-mode-map (kbd "C-M-y") #'org-rich-yank) (add-hook 'org-mode-hook #'mf/org-mode-hook) (with-eval-after-load 'org-agenda (setq diary-file (file-truename "~/doc/pers/diary")) (org-edna-mode)) (add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("gp" . "src gnuplot")) (add-to-list 'org-structure-template-alist '("go" . "src go")) (add-to-list 'org-structure-template-alist '("c" . "src c")) (add-to-list 'org-structure-template-alist '("cpp" . "src c++")) (add-to-list 'org-structure-template-alist '("hs" . "src haskell")) (add-to-list 'org-structure-template-alist '("la" . "latex")) (add-to-list 'org-structure-template-alist '("cl" . "src lisp")) (add-to-list 'org-structure-template-alist '("asm" . "src nasm")) (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (shell . t) (awk . t) (go . t) (python . t) (C . t) (lisp . t) (gnuplot . t))) (require 'ob-async) ;; I like my display-buffer-alist and would like it to be respected (defun mf/switch-to-buffer-other-window (orig-func &rest args) (apply #'switch-to-buffer-other-window args)) (advice-add 'org-agenda-get-restriction-and-command :around #'mf/org-agenda-get-restriction-and-command) (advice-add 'org-switch-to-buffer-other-window :around #'mf/switch-to-buffer-other-window) (mf/install org-caldav (setq org-caldav-files org-agenda-files org-caldav-calendar-id "b641a7e4-efcd-2852-5e22-d691063f78ad" org-caldav-url "https://cal.marioforzanini.com/mf" org-caldav-inbox (concat org-directory "caldav.org") org-caldav-timezone "Europe/Rome" org-icalendar-use-scheduled '(event-if-todo-not-done)))) ;; keybindings (define-prefix-command 'mf/leader-org-map) (mf/leader "o" mf/leader-org-map) (define-key 'mf/leader-org-map (kbd "a") #'org-agenda) (define-key 'mf/leader-org-map (kbd "c") #'org-capture) (define-key 'mf/leader-org-map (kbd "e") #'mf/edit-org-inbox) (define-key 'mf/leader-org-map (kbd "f") #'org-roam-node-find) (define-key 'mf/leader-org-map (kbd "i") #'org-roam-node-insert) (mf/leader "c" mf/capture-inbox) (mf/leader "a" mf/agenda) (provide 'mf-org) ;;; mf-org.el ends here