I showed you my source code, pls respond
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.

286 lines
7.4 KiB

4 years ago
4 years ago
4 years ago
  1. ;; Writing
  2. ;; :PROPERTIES:
  3. ;; :header-args: :tangle modules/writing.el
  4. ;; :END:
  5. ;; I am using [[https://orgmode.org][org-mode]] extensively for writing projects for different purposes. Most of the improvements are done in the *Core* module for the Literate programming configuration. Encrypt files using symmetric key encryption via PGP. This enables my workflow of storing my personal notes anywhere. Emacs can cache the gpg password if you trust your session.
  6. (setq epa-file-select-keys 2
  7. epa-file-cache-passphrase-for-symmetric-encryption t
  8. epa-file-encrypt-to dotfiles/public-key)
  9. ;; Download and install [[https://github.com/integral-dw/org-superstar-mode][org-superstar-mode]] for making headline stars more *super*.
  10. (use-package org-superstar
  11. :after org
  12. :hook (org-mode . org-superstar-mode))
  13. ;; Roam
  14. ;; #+ATTR_ORG: :width 420px
  15. ;; #+ATTR_HTML: :width 420px
  16. ;; #+ATTR_LATEX: :width 420px
  17. ;; [[./docs/images/2021-02-13-example-roam.png]]
  18. ;; Download and install [[https://orgroam.com][org-roam]], a plain text knowledge management system for Emacs.
  19. (use-package org-roam
  20. :hook (after-init . org-roam-mode)
  21. :custom (org-roam-directory org-directory)
  22. (org-roam-encrypt-files t)
  23. (org-roam-capture-templates '())
  24. (org-roam-dailies-capture-templates
  25. '(("d" "Default" entry (function org-roam-capture--get-point)
  26. "* %?"
  27. :file-name "docs/daily/%<%Y-%m-%d>"
  28. :head
  29. "
  30. #+TITLE: %<%Y-%m-%d>
  31. #+AUTHOR: Christopher James Hayward
  32. "))))
  33. ;; Place keybindings behind =SPC r=.
  34. ;; + Find with =f=
  35. ;; + Toggle buffer with =b=
  36. ;; + Dailies with =d=
  37. ;; + Arbitrary date with =d=
  38. ;; + Today with =t=
  39. ;; + Tomorrow with =m=
  40. ;; + Yesterday with =y=
  41. (dotfiles/leader
  42. "r" '(:ignore t :which-key "Roam")
  43. "rf" '(org-roam-find-file :which-key "Find")
  44. "rb" '(org-roam-buffer-toggle-display :which-key "Buffer")
  45. "rd" '(:ignore t :which-key "Dailies")
  46. "rdd" '(org-roam-dailies-find-date :which-key "Date")
  47. "rdt" '(org-roam-dailies-find-today :which-key "Today")
  48. "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  49. "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  50. ;; Visualize the org-roam database with the server, available when the editor is running at http://localhost:8080
  51. (use-package org-roam-server
  52. :hook (org-roam-mode . org-roam-server-mode))
  53. ;; Hugo
  54. ;; I use [[https://gohugo.io][Hugo]] for my personal [[https://chrishayward.xyz][website]], which I write in =org-mode= before compiling to =hugo-markdown=. [[https://github.com/kaushalmodi/ox-hugo][ox-hugo]], configured for =one-post-per-file= is my technique for managing my content.
  55. (use-package ox-hugo
  56. :after ox)
  57. ;; Posts
  58. ;; Add a capture template for creating new blog posts.
  59. (with-eval-after-load 'org-roam
  60. (add-to-list 'org-roam-capture-templates
  61. '("p" "Post" plain (function org-roam-capture--get-point)
  62. "%?"
  63. :file-name "docs/posts/${slug}"
  64. :unnarrowed t
  65. :head
  66. "
  67. #+TITLE: ${title}
  68. #+AUTHOR: Christopher James Hayward
  69. #+DATE: %<%Y-%m-%d>
  70. #+EXPORT_FILE_NAME: ${slug}
  71. #+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
  72. #+HUGO_BASE_DIR: ../
  73. #+HUGO_AUTO_SET_LASTMOD: t
  74. #+HUGO_SECTION: posts
  75. #+HUGO_DRAFT: true
  76. ")))
  77. ;; Notes
  78. ;; Add a capture template for creating blog posts and notes on other peoples content / published works.
  79. (with-eval-after-load 'org-roam
  80. (add-to-list 'org-roam-capture-templates
  81. '("n" "Notes" plain (function org-roam-capture--get-point)
  82. "%?"
  83. :file-name "docs/notes/${slug}"
  84. :unnarrowed t
  85. :head
  86. "
  87. #+TITLE: ${title}
  88. #+AUTHOR: Christopher James Hayward
  89. #+EXPORT_FILE_NAME: ${slug}
  90. #+ROAM_KEY: https://chrishayward.xyz/notes/${slug}/
  91. #+HUGO_BASE_DIR: ../
  92. #+HUGO_AUTO_SET_LASTMOD: t
  93. #+HUGO_SECTION: notes
  94. #+HUGO_DRAFT: true
  95. ")))
  96. ;; Slides
  97. ;; Produce high quality presentations that work anywhere with =HTML/JS= and the [[https://revealjs.com][reveal.js]] package. [[https://github.com/hexmode/ox-reveal][ox-reveal]], configured to use a =cdn= allows us to produce ones that are not dependent on a local version of =reveal.js=.
  98. (use-package ox-reveal
  99. :after ox
  100. :custom (org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"))
  101. ;; Create a capture template for creating slides quickly, with our desired configuration.
  102. (with-eval-after-load 'org-roam
  103. (add-to-list 'org-roam-capture-templates
  104. '("s" "Slides" plain (function org-roam-capture--get-point)
  105. "%?"
  106. :file-name "docs/slides/${slug}"
  107. :unnarrowed t
  108. :head
  109. "
  110. #+TITLE: ${title}
  111. #+AUTHOR: Christopher James Hayward
  112. #+EXPORT_FILE_NAME: ${slug}
  113. #+OPTIONS: toc:nil num:nil reveal_title_slide:nil
  114. #+REVEAL_ROOT: https://cdn.jsdelivr.net/npm/reveal.js
  115. #+REVEAL_THEME: serif
  116. ")))
  117. ;; Agenda
  118. ;; #+ATTR_ORG: :width 420px
  119. ;; #+ATTR_HTML: :width 420px
  120. ;; #+ATTR_LATEX: :width 420px
  121. ;; [[./docs/images/2021-02-13-example-agenda.gif]]
  122. ;; Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
  123. (unless (string-match-p "\\.gpg" org-agenda-file-regexp)
  124. (setq org-agenda-file-regexp
  125. (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
  126. org-agenda-file-regexp)))
  127. ;; Create a capture template for courses.
  128. (with-eval-after-load 'org-roam
  129. (add-to-list 'org-roam-capture-templates
  130. '("c" "Course" plain (function org-roam-capture--get-point)
  131. "%?"
  132. :file-name "docs/courses/${slug}"
  133. :unnarrowed t
  134. :head
  135. "
  136. #+TITLE: ${title}
  137. #+SUBTITLE:
  138. #+AUTHOR: Christopher James Hayward
  139. ")))
  140. ;; Configure agenda sources.
  141. (setq org-agenda-files '("~/.emacs.d/docs/"
  142. "~/.emacs.d/docs/courses/"
  143. "~/.emacs.d/docs/daily/"))
  144. ;; Open an agenda buffer with =SPC a=.
  145. (dotfiles/leader
  146. "a" '(org-agenda :which-key "Agenda"))
  147. ;; Images
  148. ;; Capture screenshots with [[https://github.com/tecosaur/screenshot][screenshot.el]].
  149. (use-package screenshot
  150. :commands (screenshot))
  151. ;; Create screencasts with =one-frame-per-action= GIF recording via [[https://github.com/takaxp/emacs-gif-screencast][emacs-gif-screencast]].
  152. ;; + Pause / Resume
  153. ;; + High Quality
  154. ;; + Optimized
  155. ;; It requires the installation of ~scrot~, ~gifsicle~, and ~convert~ from the =ImageMagick= library.
  156. (use-package gif-screencast
  157. :commands (gif-screencast-start-or-stop gif-screencast-toggle-pause)
  158. :custom (gif-screencast-output-directory (concat dotfiles/home "docs/images/")))
  159. ;; Place keybindings behind =SPC s=.
  160. ;; + Screenshot with =s=
  161. ;; + Screencast with =c=
  162. (dotfiles/leader
  163. "s" '(:ignore t :which-key "Screen")
  164. "ss" '(screenshot :which-key "Screenshot")
  165. "sc" '(gif-screencast-start-or-stop :which-key "Screencast"))
  166. ;; Grammar
  167. ;; I use [[https://github.com/bnbeckwith/writegood-mode][writegood-mode]] to find common writing problems such as cliches and poor wording. Grammarly for the peons!
  168. (use-package writegood-mode
  169. :after org
  170. :config (writegood-mode))
  171. ;; Toggle ~writegood~ mode with =SPC t w=.
  172. (dotfiles/leader
  173. "tw" '(writegood-mode :which-key "Grammar"))
  174. ;; Spelling
  175. ;; Use the built in =ispell= package to add spell checking features to buffers.
  176. (use-package ispell
  177. :after org
  178. :custom (ispell-dictionary dotfiles/lang))
  179. ;; Toggle highlighting within buffers with =SPC t s=.
  180. (dotfiles/leader
  181. "ts" '(flyspell-buffer :which-key "Spelling"))