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.

212 lines
6.0 KiB

4 years ago
4 years ago
  1. #+TITLE: Writing
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle writing.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export :comments org
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. #+ATTR_ORG: :width 420px
  9. #+ATTR_HTML: :width 420px
  10. #+ATTR_LATEX: :width 420px
  11. [[../docs/images/2021-02-13-example-roam.png]]
  12. I am using *Org mode*[fn:1] extensively throughout my writing. Most of the improvements are done in the [[file:core.org][Core]] module, but all of the management, encryption, synchronization, and organization of all of my writing happens here.
  13. * Improvements
  14. Real time checking and one-shot methods to check and correct common spelling and grammatical errors.
  15. ** Spelling
  16. Configure *InteractiveSpell*[fn:6] as a backend with *FlySpell*[fn:7] for real time checking and highlighting.
  17. #+begin_src emacs-lisp
  18. (use-package ispell
  19. :after org
  20. :custom (ispell-dictionary dotfiles/lang))
  21. #+end_src
  22. Toggle highlighting within buffers with =SPC t s=.
  23. #+begin_src emacs-lisp
  24. (dotfiles/leader
  25. "ts" '(flyspell-buffer :which-key "Spelling"))
  26. #+end_src
  27. ** Grammar
  28. I use *Writegood*[fn:8] to find common writing problems such as cliches and poor wording. Grammarly for the peons!
  29. #+begin_src emacs-lisp
  30. (use-package writegood-mode
  31. :after org
  32. :config (writegood-mode))
  33. #+end_src
  34. Toggle *Writegood* mode with =SPC t w=.
  35. #+begin_src emacs-lisp
  36. (dotfiles/leader
  37. "tw" '(writegood-mode :which-key "Grammar"))
  38. #+end_src
  39. * Knowledge base
  40. Download and install *Org roam*[fn:4], a plain text knowledge management system for Emacs built on top of *Org mode*[fn:1].
  41. + Notes can be arbitrarily referenced
  42. + Contexts created by linking topics and notes
  43. #+begin_src emacs-lisp
  44. (use-package org-roam
  45. :hook (after-init . org-roam-mode)
  46. :custom (org-roam-directory org-directory)
  47. (org-roam-capture-templates '())
  48. (org-roam-dailies-capture-templates '()))
  49. #+end_src
  50. Configure custom keybindings behind =SPC r=.
  51. + Find with =f=
  52. + Insert with =i=
  53. + Buffer with =b=
  54. + Capture with =c=
  55. #+begin_src emacs-lisp
  56. (dotfiles/leader
  57. "r" '(:ignore t :which-key "Roam")
  58. "ri" '(org-roam-insert :which-key "Insert")
  59. "rf" '(org-roam-find-file :which-key "Find")
  60. "rc" '(org-roam-capture :which-key "Capture")
  61. "rb" '(org-roam-buffer-toggle-display :which-key "Buffer"))
  62. #+end_src
  63. ** Web visualizer
  64. Including the extension *Org roam server*[fn:5] will run a web application that visualizes the *Org roam*[fn:4] database. Available whenever the editor is running at https://localhost:8080. The image at the top of this page is an example of the application running.
  65. #+begin_src emacs-lisp
  66. (use-package org-roam-server
  67. :hook (org-roam-mode . org-roam-server-mode))
  68. #+end_src
  69. ** Daily note taking
  70. Use the =daily= note feature of *Org roam*[fn:4] to capture daily notes. Create the default capture template with some preconfigured headers.
  71. #+begin_src emacs-lisp
  72. (with-eval-after-load 'org-roam
  73. (add-to-list 'org-roam-dailies-capture-templates
  74. '("d" "Default" entry (function org-roam-capture--get-point)
  75. "* %?"
  76. :file-name "docs/daily/%<%Y-%m-%d>"
  77. :head
  78. "
  79. ,#+TITLE: %<%Y-%m-%d>
  80. ,#+AUTHOR: Christopher James Hayward
  81. ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  82. ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  83. ")))
  84. #+end_src
  85. Place keybindings behind =SPC r d=.
  86. + Date with =d=
  87. + Today with =t=
  88. + Tomorrow with =m=
  89. + Yesterday with =y=
  90. #+begin_src emacs-lisp
  91. (dotfiles/leader
  92. "rd" '(:ignore t :which-key "Dailies")
  93. "rdd" '(org-roam-dailies-find-date :which-key "Date")
  94. "rdt" '(org-roam-dailies-find-today :which-key "Today")
  95. "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  96. "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  97. #+end_src
  98. ** Capture templates
  99. + Capture template for generic documents
  100. #+begin_src emacs-lisp
  101. (with-eval-after-load 'org-roam
  102. (add-to-list 'org-roam-capture-templates
  103. '("d" "Default" entry (function org-roam-capture--get-point)
  104. "%?"
  105. :file-name "docs/${slug}"
  106. :unnarrowed t
  107. :head
  108. "
  109. ,#+TITLE: ${title}
  110. ,#+AUTHOR: Christopher James Hayward
  111. ,#+EMAIL: chris@chrishayward.xyz
  112. ")))
  113. #+end_src
  114. Custom capture template for courses.
  115. + Capture a new buffer with =SPC r c c=
  116. #+begin_src emacs-lisp
  117. (with-eval-after-load 'org-roam
  118. (add-to-list 'org-roam-capture-templates
  119. '("c" "Course" plain (function org-roam-capture--get-point)
  120. "%?"
  121. :file-name "docs/courses/${slug}"
  122. :unnarrowed t
  123. :head
  124. "
  125. ,#+TITLE: ${title}
  126. ,#+SUBTITLE:
  127. ,#+AUTHOR: Christopher James Hayward
  128. ,#+EMAIL: chris@chrishayward.xyz
  129. ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  130. ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  131. ")))
  132. #+end_src
  133. ** Agenda integration
  134. #+ATTR_ORG: :width 420px
  135. #+ATTR_HTML: :width 420px
  136. #+ATTR_LATEX: :width 420px
  137. [[../docs/images/2021-02-13-example-agenda.gif]]
  138. More capture templates for *Org roam*[fn:4] are defined here in the context of specific domains and topics.
  139. + Configure agenda sources
  140. #+begin_src emacs-lisp
  141. (setq org-agenda-files '("~/.emacs.d/"
  142. "~/.emacs.d/docs/"
  143. "~/.emacs.d/docs/courses/"
  144. "~/.emacs.d/docs/daily/"
  145. "~/.emacs.d/docs/notes/"
  146. "~/.emacs.d/docs/posts/"
  147. "~/.emacs.d/docs/slides/"
  148. "~/.emacs.d/hosts/"
  149. "~/.emacs.d/modules/"))
  150. #+end_src
  151. + Open an agenda buffer with =SPC a=
  152. #+begin_src emacs-lisp
  153. (dotfiles/leader
  154. "a" '(org-agenda :which-key "Agenda"))
  155. #+end_src
  156. * Resources
  157. [fn:1] https://orgmode.org
  158. [fn:4] https://github.com/org-roam/org-roam
  159. [fn:5] https://github.com/org-roam/org-roam-server
  160. [fn:6] https://emacswiki.org/emacs/InteractiveSpell
  161. [fn:7] https://emacswiki.org/emacs/FlySpell
  162. [fn:8] https://github.com/bnbeckwith/writegood-mode