Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
10 KiB

  1. ;;; $DOOMDIR/org-conf.el -*- lexical-binding: t; -*-
  2. ;;; org-conf.el<2> --- Description
  3. ;; Author: Yigit Colakoglu yigit@yigitcolakoglu.com
  4. ;; Copyright (C) Symbol’s value as variable is void: %Y, Yigit Colakoglu, all rights reserved.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;; This file contains the org-mode specific configuration for my emacs config
  17. ;;
  18. ;;; Code:
  19. (setq org-export-with-section-numbers nil)
  20. (setq org-agenda-files (directory-files org-directory t "\\.org$" t))
  21. (setq org-display-remote-inline-images 'download)
  22. (setq org-agenda-include-deadlines t)
  23. (setq org-agenda-dim-blocked-tasks 'invisible)
  24. (setq org-latex-packages-alist '(("margin=1in" "geometry" nil))) ;; adjusting the margins of latex output
  25. (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.5)) ;; making latex previews larger
  26. (setq org-bullets-bullet-list '("·"))
  27. (setq org-log-done 'time)
  28. (setq org-tags-column -80)
  29. (setq org-refile-targets (quote ((nil :maxlevel . 1))))
  30. (setq org-todo-keywords '((sequence
  31. "TODO"
  32. "PROJ"
  33. "NEXT(n)"
  34. "PROG(p!)"
  35. "WAIT(w@/!)"
  36. "SOMEDAY"
  37. "|"
  38. "DONE(d)"
  39. "CANCEL(c@)"
  40. "DELEGATED(@)"
  41. )
  42. (sequence
  43. "IDEA"
  44. "GOAL"
  45. "|"
  46. "DUD(@)")
  47. (sequence
  48. "RD"
  49. "RDING"
  50. "RDNOTE"
  51. "TMPDROP"
  52. "|"
  53. "DROP"
  54. "FNSHED"
  55. )
  56. ))
  57. (setq org-fancy-priorities-list '("" "" "" ""))
  58. (setq org-caldav-url "https://drive.yigitcolakoglu.com/remote.php/dav/calendars/yigitcolakoglu")
  59. (setq org-icalendar-timezone "Europe/Istanbul")
  60. (setq org-caldav-calendars
  61. '((:calendar-id "pcalendar" :files ("~/Documents/org/pcalendar.org")
  62. :inbox "~/.local/share/pcalendar.org")))
  63. ;; Mappings
  64. (map! :ne "SPC m a c" #'org-insert-clipboard-image)
  65. (map! :map calc-mode-map
  66. :after calc
  67. :localleader
  68. :desc "Embedded calc (toggle)" "e" #'calc-embedded)
  69. (map! :map org-mode-map
  70. :after org
  71. :localleader
  72. :desc "Embedded calc (toggle)" "E" #'calc-embedded)
  73. (map! :map latex-mode-map
  74. :after latex
  75. :localleader
  76. :desc "Embedded calc (toggle)" "e" #'calc-embedded)
  77. (map! :map org-mode-map
  78. :after org
  79. :localleader
  80. :desc "Outline" "O" #'org-ol-tree)
  81. ;; Org Superstar
  82. ;;
  83. (setq org-superstar-remove-leading-stars t)
  84. (setq org-capture-templates
  85. `(
  86. ("t" "Todo" entry (file ,(concat org-directory "personal.org"))
  87. "* TODO %? \n%U" :empty-lines 1)
  88. ("d" "Todo deadline" entry (file ,(concat org-directory "personal.org"))
  89. "* TODO %? \nDEADLINE: %^T\n%U" :empty-lines 1)
  90. ("w" "Wait deadline" entry (file ,(concat org-directory "personal.org"))
  91. "* WAIT %? \nDEADLINE: %^T\n%U" :empty-lines 1)
  92. ("r" "Reading List" entry (file+olp ,(concat org-directory "reading_list.org") "Catchall")
  93. "* RD %? \n%U" :empty-lines 1)
  94. ("i" "Idea" entry (file ,(concat org-directory "personal.org"))
  95. "* IDEA %? \n%U" :empty-lines 1)
  96. ("s" "Someday" entry (file+olp ,(concat org-directory "someday.org") "Catchall")
  97. "* SOMEDAY %? \n%U" :empty-lines 1)
  98. ("e" "Event" entry (file ,(concat org-directory "personal.org"))
  99. "* %? \nSCHEDULED: %^T\n%U" :empty-lines 1)
  100. ("c" "Cookbook" entry (file ,(concat org-directory "cookbook.org"))
  101. "%(org-chef-get-recipe-from-url)" :empty-lines 1)
  102. ("C" "Manual Cookbook" entry (file ,(concat org-directory "cookbook.org"))
  103. "* %^{Recipe title: }\n :PROPERTIES:\n :source-url:\n :servings:\n :prep-time:\n :cook-time:\n :ready-in:\n :END:\n** Ingredients\n %?\n** Directions\n\n")
  104. ("j" "Journal entry" entry (function org-journal-find-location)
  105. "* NEXT %?\n%U" :empty-lines 1)
  106. ("k" "Journal sched entry" entry (function org-journal-find-location)
  107. "* %? %^T\n%U" :empty-lines 1)
  108. ("m" "Morning Journal entry" entry (function org-journal-find-location)
  109. "* Morning Entry
  110. ** Checklist
  111. - [ ] Make bed
  112. - [ ] Brush Teeth
  113. - [ ] Cook something nice
  114. - [ ] Read for 20 pages
  115. - [ ] Take note of things I am looking forward to in journal
  116. - [ ] Wash face
  117. - plan tips:
  118. - don't put mentally straining todos after working out or eating.
  119. - mentally chill stuff includes:
  120. - relaxing reading
  121. - article reading
  122. ** Looking Forward To %?
  123. ** Day Plan
  124. ** Determinations :determ:" :empty-lines 1)
  125. ("n" "Night Journal entry" entry (function org-journal-find-location)
  126. "* Today's Learnings\n* My Day\n%U")
  127. ))
  128. ;; Org Journal
  129. (defun org-journal-find-location ()
  130. ;; Open today's journal, but specify a non-nil prefix argument in order to
  131. ;; inhibit inserting the heading; org-capture will insert the heading.
  132. (org-journal-new-entry t)
  133. ;; Position point on the journal's top-level heading so that org-capture
  134. ;; will add the new entry as a child entry.
  135. (goto-char (point-min)))
  136. (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
  137. (set-face-attribute 'org-block nil :inherit 'fixed-pitch)
  138. ;; Refile taken from here: https://www.reddit.com/r/emacs/comments/4366f9/how_do_orgrefiletargets_work/
  139. (setq org-refile-targets '((nil :maxlevel . 9)
  140. (org-agenda-files :maxlevel . 9)))
  141. (setq org-outline-path-complete-in-steps nil) ; Refile in a single go
  142. (setq org-refile-use-outline-path t) ; Show full paths for refiling
  143. (setq org-refile-allow-creating-parent-nodes (quote confirm))
  144. (setq org-pretty-entities t)
  145. (setq org-hide-emphasis-markers t)
  146. (setq org-fontify-whole-heading-line t)
  147. (setq org-fontify-done-headline t)
  148. (setq org-fontify-quote-and-verse-blocks t)
  149. (setq org-tags-column 0)
  150. (setq org-src-fontify-natively t)
  151. (setq org-edit-src-content-indentation 0)
  152. (setq org-src-tab-acts-natively t)
  153. (setq org-src-preserve-indentation t)
  154. (setq org-list-demote-modify-bullet '(("+" . "-") ("-" . "+") ("*" . "+") ("1." . "a.")))
  155. (setq org-log-done 'time)
  156. (provide 'org-conf.el)
  157. ;; Embedded Calc
  158. (defvar calc-embedded-trail-window nil)
  159. (defvar calc-embedded-calculator-window nil)
  160. (defadvice! calc-embedded-with-side-pannel (&rest _)
  161. :after #'calc-do-embedded
  162. (when calc-embedded-trail-window
  163. (ignore-errors
  164. (delete-window calc-embedded-trail-window))
  165. (setq calc-embedded-trail-window nil))
  166. (when calc-embedded-calculator-window
  167. (ignore-errors
  168. (delete-window calc-embedded-calculator-window))
  169. (setq calc-embedded-calculator-window nil))
  170. (when (and calc-embedded-info
  171. (> (* (window-width) (window-height)) 1200))
  172. (let ((main-window (selected-window))
  173. (vertical-p (> (window-width) 80)))
  174. (select-window
  175. (setq calc-embedded-trail-window
  176. (if vertical-p
  177. (split-window-horizontally (- (max 30 (/ (window-width) 3))))
  178. (split-window-vertically (- (max 8 (/ (window-height) 4)))))))
  179. (switch-to-buffer "*Calc Trail*")
  180. (select-window
  181. (setq calc-embedded-calculator-window
  182. (if vertical-p
  183. (split-window-vertically -6)
  184. (split-window-horizontally (- (/ (window-width) 2))))))
  185. (switch-to-buffer "*Calculator*")
  186. (select-window main-window))))
  187. ;;; ol-man.el - Support for links to man pages in Org mode
  188. ;;; https://www.gnu.org/software/emacs/manual/html_node/org/Adding-Hyperlink-Types.html
  189. (org-link-set-parameters "man"
  190. :follow #'org-man-open
  191. :export #'org-man-export
  192. :store #'org-man-store-link)
  193. (defcustom org-man-command 'man
  194. "The Emacs command to be used to display a man page."
  195. :group 'org-link
  196. :type '(choice (const man) (const woman)))
  197. (defun org-man-open (path _)
  198. "Visit the manpage on PATH.
  199. PATH should be a topic that can be thrown at the man command."
  200. (funcall org-man-command path))
  201. (defun org-man-store-link ()
  202. "Store a link to a man page."
  203. (when (memq major-mode '(Man-mode woman-mode))
  204. ;; This is a man page, we do make this link.
  205. (let* ((page (org-man-get-page-name))
  206. (link (concat "man:" page))
  207. (description (format "Man page for %s" page)))
  208. (org-link-store-props
  209. :type "man"
  210. :link link
  211. :description description))))
  212. (defun org-man-get-page-name ()
  213. "Extract the page name from the buffer name."
  214. ;; This works for both `Man-mode' and `woman-mode'.
  215. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  216. (match-string 1 (buffer-name))
  217. (error "Cannot create link to this man page")))
  218. (defun org-man-export (link description format _)
  219. "Export a man page link from Org files."
  220. (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  221. (desc (or description link)))
  222. (pcase format
  223. (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  224. (`latex (format "\\href{%s}{%s}" path desc))
  225. (`texinfo (format "@uref{%s,%s}" path desc))
  226. (`ascii (format "%s (%s)" desc path))
  227. (t path))))
  228. ;;; org-conf.el<2> ends here.