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.

160 lines
5.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Org
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle org.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. Organize your plain-life in plain-text. The hallmark feature of Emacs, ~org-mode~[fn:1] is the king of markup languages. It has rich feature support for project management, scheduling, development, and writing. It's hard to convey everything within its capabilities.
  9. * Setup
  10. Define a custom hook when ~org-mode~[fn:1] is enabled to customize the experience:
  11. + Enable ~org-indent-mode~ to indent and align text with the parent heading
  12. + Enable ~visual-line-mode~ to allow text to overflow and wrap to the next visual line
  13. + Enable ~variable-pitch-mode~ to support multiple font-pitches and monospaced fonts
  14. #+begin_src emacs-lisp
  15. (defun dotfiles/org-mode-hook ()
  16. (org-indent-mode) ;; Indent and align text.
  17. (visual-line-mode 1) ;; Allow text to overflow line.
  18. (variable-pitch-mode 1)) ;; Enable monospaced fonts.
  19. #+end_src
  20. * Config
  21. Force ~straight~ to ignore the local version of ~org-mode~[fn:1], instead downloading the most recent version available.
  22. #+begin_src emacs-lisp
  23. (straight-use-package '(org :local-repo nil))
  24. #+end_src
  25. Setup the default babel languages and structure templates, and apply customizations:
  26. + Setup ~org-mode-hook~ with our custom hook
  27. + Setup ~org-ellipsis~ to show headlines with hidden contents
  28. + Setup ~org-log-*~ for event logging
  29. + Setup ~org-src-*~ for source blocks
  30. + Setup ~org-todo-keyword~ sequence
  31. #+begin_src emacs-lisp
  32. (use-package org
  33. :hook (org-mode . dotfiles/org-mode-hook)
  34. :custom (org-ellipsis " ▾")
  35. (org-log-done 'time)
  36. (org-log-into-drawer t)
  37. (org-return-follows-link t)
  38. (org-image-actual-width nil)
  39. (org-directory dotfiles/home)
  40. (org-src-fontify-natively t)
  41. (org-src-tab-acts-natively t)
  42. (org-src-preserve-indentation t)
  43. (org-confirm-babel-evaluate nil)
  44. (org-todo-keywords '((sequence "TODO" "START" "WAIT" "DONE")))
  45. :config (require 'org-tempo) ;; Required for structure templates.
  46. (add-to-list 'org-structure-template-alist '("s" . "src"))
  47. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  48. (add-to-list 'org-structure-template-alist '("e" . "example"))
  49. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  50. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
  51. (org-babel-do-load-languages 'org-babel-load-languages '((shell . t)
  52. (emacs-lisp . t))))
  53. #+end_src
  54. ** Pomodoro
  55. Adds support for the Pomodoro workflow in Emacs through the ~org-pomodoro~[fn:4] package. Some workflows benefit from thje option to work a few minutes of *overtime* to finish a task before taking a break. With this workflow, a break notification is sent at the end of the pomodoro timer, but the break starts when calling =M-x org-pomodoro=.
  56. #+begin_src emacs-lisp
  57. (use-package org-pomodoro
  58. :after org
  59. :custom (org-pomodoro-manual-break t) ;; Enable the 'overtime' workflow.
  60. (org-pomodoro-keep-killed-time t)) ;; Track abandoned timers.
  61. #+end_src
  62. ** Flashcards
  63. Create study flashcards using ~org-drill~[fn:2], an extension for ~org-mode~. It uses a spaced repititon algorithm to conduct interactive drill sesslions using ~org-mode~ buffers as sources of facts to be memorized. Each drill can be restricted to topics in the current buffer, one of several, all agenda files, or a single topic across all buffers.
  64. #+begin_src emacs-lisp
  65. (use-package org-drill
  66. :after org)
  67. #+end_src
  68. ** Headline stars
  69. Make the headline stars a bit more *super* with ~org-superstar-mode~[fn:3]. Only enable this inside of a window system, as the effect can be distracting on the TTY.
  70. #+begin_src emacs-lisp
  71. (use-package org-superstar
  72. :when (window-system)
  73. :after org
  74. :hook (org-mode . org-superstar-mode))
  75. #+end_src
  76. * Methods
  77. Define some custom methods for use in the rest of the configuration.
  78. ** Tangle directory
  79. Build all of the ~org~ files within a given directory, recursively. This is used in CI.
  80. #+begin_src emacs-lisp
  81. (defun dotfiles/tangle (dir)
  82. "Recursively tangle the Org files within a directory."
  83. (interactive)
  84. (let ((org-files (directory-files-recursively dir "org")))
  85. (dolist (f org-files)
  86. (org-babel-tangle-file f))))
  87. #+end_src
  88. ** Force symbolic links
  89. Function that takes in a system and configuration file path, checks to see if the system file doesn't exist, or doesn't point to the configuration file, deleting it for the latter, then creating a symbolic link to the configuration file in place.
  90. #+begin_src emacs-lisp
  91. (defun dotfiles/symlink (src tgt)
  92. "Forces a symlink from `src' to `tgt'."
  93. (interactive)
  94. (let ((sys-file (expand-file-name tgt))
  95. (dot-file (expand-file-name src)))
  96. (when (or (not (file-exists-p sys-file))
  97. (not (equal (file-symlink-p sys-file) dot-file)))
  98. (delete-file sys-file)
  99. (make-symbolic-link dot-file sys-file))))
  100. #+end_src
  101. * Shortcuts
  102. Place ~org-mode~[fn:1] extension bindings behind =SPC o=.
  103. + Drill with =d=
  104. + Drill with =d=
  105. + Resume with =r=
  106. + Pomodoro with =p=
  107. #+begin_src emacs-lisp
  108. (dotfiles/leader
  109. "o" '(:ignore t :which-key "Org")
  110. "od" '(:ignore t :which-key "Drill")
  111. "odd" '(org-drill :which-key "Drill")
  112. "odc" '(org-drill-cram :which-key "Cram")
  113. "odr" '(org-drill-resume :which-key "Resume")
  114. "op" '(org-pomodoro :which-key "Pomodoro"))
  115. #+end_src
  116. * Footnotes
  117. [fn:1] https://orgmode.org
  118. [fn:2] https://orgmode.org/worg/org-contrib/org-drill.html
  119. [fn:3] https://github.com/integral-dw/org-superstar-mode
  120. [fn:4] https://github.com/marcinkoziej/org-pomodoro