From 18a255d5f434b0a08c81a6055934eb4621823a84 Mon Sep 17 00:00:00 2001 From: Inhji Date: Mon, 26 Feb 2024 23:32:58 +0545 Subject: [PATCH] add org-drill, org export settings --- config/dot_config/doom/config.el | 36 +- config/dot_config/doom/config.html | 515 +++++++++++++++++++++++++++++ config/dot_config/doom/config.org | 64 +++- config/dot_config/doom/init.el | 4 +- config/dot_config/doom/packages.el | 1 + config/dot_config/doom/style.css | 5 + 6 files changed, 604 insertions(+), 21 deletions(-) create mode 100644 config/dot_config/doom/config.html create mode 100644 config/dot_config/doom/style.css diff --git a/config/dot_config/doom/config.el b/config/dot_config/doom/config.el index 9413d2c..bbe7342 100644 --- a/config/dot_config/doom/config.el +++ b/config/dot_config/doom/config.el @@ -34,8 +34,8 @@ :config (setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default (setq heaven-and-hell-themes - '((light . doom-feather-light) - (dark . doom-feather-dark))) ;; Themes can be the list: (dark . (tsdh-dark wombat)) + '((light . leuven) + (dark . doom-monokai-octagon))) ;; Themes can be the list: (dark . (tsdh-dark wombat)) ;; Optionall, load themes without asking for confirmation. (setq heaven-and-hell-load-theme-no-confirm t) :hook (after-init . heaven-and-hell-init-hook) @@ -50,6 +50,31 @@ (add-to-list 'org-modules 'org-habit) +(after! org ( + ;; TOC Links will lead to errors when attempting + ;; to export to HTML + setq org-export-exclude-tags '("toc"))) + +(defun my-org-inline-css-hook (exporter) + "Insert custom inline css" + (when (eq exporter 'html) + (let* ((dir (ignore-errors (file-name-directory (buffer-file-name)))) + (path (concat dir "style.css")) + (fallback-style (or (null dir) (null (file-exists-p path)))) + (final (if fallback-style "~/.config/doom/style.css" path))) ;; <- set your own style file path + (setq org-html-head-include-default-style t) + (setq org-html-head (concat + "\n"))))) + +;; Org Export +(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook) + (after! org (setq +org-capture-notes-file (org-path "Notes.org") +org-capture-todo-file (org-path "Todo.org") +org-capture-journal-file (org-path "Journal.org") @@ -64,6 +89,10 @@ (file+headline +org-capture-notes-file "Inbox") "* %u %?\n" :prepend t) + ("w", "Nepali" entry + (file+headline +org-capture-notes-file "Nepali/Vocabulary") + "* " :prepend t) + ("j" "Journal entries") ("jj" "Daily Journal" entry @@ -103,6 +132,9 @@ :config (setq org-auto-tangle-default nil) :hook (org-mode . org-auto-tangle-mode)) +(after! org-drill + (setq org-drill-scope 'agenda)) + (after! doom-modeline (setq doom-modeline-battery t) (setq doom-modeline-major-mode-icon t)) diff --git a/config/dot_config/doom/config.html b/config/dot_config/doom/config.html new file mode 100644 index 0000000..2d09db9 --- /dev/null +++ b/config/dot_config/doom/config.html @@ -0,0 +1,515 @@ + + + + + + + +Emacs Config + + + + + + +
+

Emacs Config

+ +
+

1. Keybindings

+
+

+These keybindings extend the default doom bindings, either because the defaults were confusing to me or because the binding did not yet exist. +

+ + + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescriptionState
F12Show Org-AgendaN
Ctrl-Alt-+Increase Font Size 
Ctrl-#Toggle Line Comment 
F6Toggle Light/Dark Theme 
Ctrl-c F6Load Default Theme 
DELUp DirectoryDired
+
+
+
+

2. Base Config

+
+
+
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
+
+;; Basic User Settings
+(setq user-full-name "Jonathan Jenne"
+      user-mail-address "johnnie@posteo.de")
+
+;; Default Shell
+;; Useful if default system shell is not bash
+(setq shell-file-name (executable-find "bash"))
+
+;; Display Line numbers
+(setq display-line-numbers-type t)
+
+;; General Keybindings
+(map! :n "<f12>" #'org-agenda-list)
+(map! "C-M-+" #'doom/increase-font-size)
+(map! "C-#" #'comment-line)
+(evil-define-key 'normal dired-mode-map
+  (kbd "DEL") 'dired-up-directory)
+
+
+
+
+

2.1. Hooks

+
+
+
;; Org Mode
+(add-hook 'org-mode-hook #'org-modern-mode)
+(add-hook 'org-mode-hook #'hl-todo-mode)
+
+;; Org Agenda
+(add-hook 'org-agenda-finalize-hook #'org-modern-agenda)
+
+;; Modeline
+(add-hook 'doom-after-init-hook #'display-battery-mode)
+(add-hook 'doom-after-init-hook #'display-time-mode)
+
+
+
+
+
+
+

3. Themes

+
+
+
(use-package! heaven-and-hell
+  :ensure t
+  :config
+  (setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default
+  (setq heaven-and-hell-themes
+        '((light . leuven)
+          (dark . doom-monokai-octagon))) ;; Themes can be the list: (dark . (tsdh-dark wombat))
+  ;; Optionall, load themes without asking for confirmation.
+  (setq heaven-and-hell-load-theme-no-confirm t)
+  :hook (after-init . heaven-and-hell-init-hook)
+  :bind (("C-c <f6>" . heaven-and-hell-load-default-theme)
+         ("<f6>" . heaven-and-hell-toggle-theme)))
+
+
+
+
+
+

4. Org Mode

+
+
+
+

4.1. General Settings

+
+
+
(setq +user-org-path "~/Notes/Org")
+(defun org-path (filename) (expand-file-name filename +user-org-path))
+
+(after! org (setq org-directory +user-org-path
+                  org-src-tab-acts-natively t))
+
+(add-to-list 'org-modules 'org-habit)
+
+
+
+
+
+

4.2. Org Export

+
+
+
+
+(after! org (
+             ;; TOC Links will lead to errors when attempting
+             ;; to export to HTML
+             setq org-export-exclude-tags '("toc")))
+
+(defun my-org-inline-css-hook (exporter)
+  "Insert custom inline css"
+  (when (eq exporter 'html)
+    (let* ((dir (ignore-errors (file-name-directory (buffer-file-name))))
+           (path (concat dir "style.css"))
+           (fallback-style (or (null dir) (null (file-exists-p path))))
+           (final (if fallback-style "~/.config/doom/style.css" path))) ;; <- set your own style file path
+      (setq org-html-head-include-default-style t)
+      (setq org-html-head (concat
+                           "<style type=\"text/css\">\n"
+                           "<!--/*--><![CDATA[/*><!--*/\n"
+                           (with-temp-buffer
+                             (insert-file-contents final)
+                             (buffer-string))
+                           "/*]]>*/-->\n"
+                           "</style>\n")))))
+
+;; Org Export
+(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook)
+
+
+
+
+
+
+

4.3. Org Agenda

+
+
+
(after! org (setq
+             org-agenda-show-all-dates nil
+             org-agenda-span 4
+             org-agenda-start-day "+0d"
+             org-agenda-spillover-skip-function '(org-agenda-skip-entry-if 'todo 'done)
+             org-agenda-time-grid
+             '((daily today require-timed)
+               (800 1000 1200 1400 1600 1800 2000)
+               " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
+             org-agenda-current-time-string
+             "◀── now ──────────────────────────────────────────────── \\o/"
+             org-agenda-block-separator ?─
+             ;; Consider all org files part of the org-agenda
+             org-agenda-files (list +user-org-path)))
+
+
+
+
+
+
+

5. Packages

+
+
+
+

5.1. hl-todo

+
+
+
(after! hl-todo (setq hl-todo-keyword-faces '(("TODO" warning bold)
+                                              ("FIXME" error bold)
+                                              ("EXAMPLE" font-lock-keyword-face bold)
+                                              ("HACK" font-lock-constant-face bold)
+                                              ("DEPRECATED" font-lock-doc-face bold)
+                                              ("NOTE" success bold)
+                                              ("BUG" error bold)
+                                              ("XXX" font-lock-constant-face bold))))
+
+
+
+
+
+

5.2. org-auto-tangle

+
+
+
(use-package! org-auto-tangle
+  :defer t
+  :config (setq org-auto-tangle-default nil)
+  :hook (org-mode . org-auto-tangle-mode))
+
+
+
+
+
+

5.3. org-drill

+
+
+
(after! org-drill
+  (setq org-drill-scope 'agenda))
+
+
+
+
+
+

5.4. doom-modeline

+
+
+
(after! doom-modeline
+  (setq doom-modeline-battery t)
+  (setq doom-modeline-major-mode-icon t))
+
+
+
+
+
+

5.5. evil-snipe

+
+
+
(after! evil-snipe (setq evil-snipe-scope 'whole-visible))
+
+
+
+
+
+
+
+

Author: Jonathan Jenne / Inhji

+

Created: 2024-02-26 Mo 23:29

+
+ + diff --git a/config/dot_config/doom/config.org b/config/dot_config/doom/config.org index fbb4973..ef23d3f 100644 --- a/config/dot_config/doom/config.org +++ b/config/dot_config/doom/config.org @@ -10,16 +10,20 @@ - [[#themes][Themes]] - [[#org-mode][Org Mode]] - [[#general-settings][General Settings]] + - [[#org-export][Org Export]] - [[#org-capture][Org Capture]] - [[#org-agenda][Org Agenda]] - [[#packages][Packages]] - [[#hl-todo][hl-todo]] - [[#org-auto-tangle][org-auto-tangle]] + - [[#org-drill][org-drill]] - [[#doom-modeline][doom-modeline]] - [[#evil-snipe][evil-snipe]] * Keybindings +These keybindings extend the default doom bindings, either because the defaults were confusing to me or because the binding did not yet exist. + | Key | Description | State | |------------+-------------------------+-------| | F12 | Show Org-Agenda | N | @@ -53,8 +57,6 @@ (kbd "DEL") 'dired-up-directory) #+end_src -#+RESULTS: - ** Hooks #+begin_src emacs-lisp ;; Org Mode @@ -76,8 +78,8 @@ :config (setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default (setq heaven-and-hell-themes - '((light . doom-feather-light) - (dark . doom-feather-dark))) ;; Themes can be the list: (dark . (tsdh-dark wombat)) + '((light . leuven) + (dark . doom-monokai-octagon))) ;; Themes can be the list: (dark . (tsdh-dark wombat)) ;; Optionall, load themes without asking for confirmation. (setq heaven-and-hell-load-theme-no-confirm t) :hook (after-init . heaven-and-hell-init-hook) @@ -95,6 +97,38 @@ org-src-tab-acts-natively t)) (add-to-list 'org-modules 'org-habit) +#+end_src + +** Org Export + +#+begin_src emacs-lisp + + +(after! org ( + ;; TOC Links will lead to errors when attempting + ;; to export to HTML + setq org-export-exclude-tags '("toc"))) + +(defun my-org-inline-css-hook (exporter) + "Insert custom inline css" + (when (eq exporter 'html) + (let* ((dir (ignore-errors (file-name-directory (buffer-file-name)))) + (path (concat dir "style.css")) + (fallback-style (or (null dir) (null (file-exists-p path)))) + (final (if fallback-style "~/.config/doom/style.css" path))) ;; <- set your own style file path + (setq org-html-head-include-default-style t) + (setq org-html-head (concat + "\n"))))) + +;; Org Export +(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook) + #+end_src ** Org Capture :toc: #+begin_src emacs-lisp @@ -112,6 +146,10 @@ (file+headline +org-capture-notes-file "Inbox") "* %u %?\n" :prepend t) + ("w", "Nepali" entry + (file+headline +org-capture-notes-file "Nepali/Vocabulary") + "* " :prepend t) + ("j" "Journal entries") ("jj" "Daily Journal" entry @@ -140,9 +178,6 @@ org-agenda-files (list +user-org-path))) #+end_src -#+RESULTS: -| ~/Notes/Org | - * Packages ** hl-todo #+begin_src emacs-lisp @@ -156,16 +191,6 @@ ("XXX" font-lock-constant-face bold)))) #+end_src -#+RESULTS: -| TODO | warning | bold | -| FIXME | error | bold | -| EXAMPLE | font-lock-keyword-face | bold | -| HACK | font-lock-constant-face | bold | -| DEPRECATED | font-lock-doc-face | bold | -| NOTE | success | bold | -| BUG | error | bold | -| XXX | font-lock-constant-face | bold | - ** org-auto-tangle #+begin_src emacs-lisp (use-package! org-auto-tangle @@ -173,6 +198,11 @@ :config (setq org-auto-tangle-default nil) :hook (org-mode . org-auto-tangle-mode)) #+end_src +** org-drill +#+begin_src emacs-lisp +(after! org-drill + (setq org-drill-scope 'agenda)) +#+end_src ** doom-modeline #+begin_src emacs-lisp (after! doom-modeline diff --git a/config/dot_config/doom/init.el b/config/dot_config/doom/init.el index dfcf3a0..2f3695e 100644 --- a/config/dot_config/doom/init.el +++ b/config/dot_config/doom/init.el @@ -59,7 +59,7 @@ ;;(format +onsave) ; automated prettiness ;;god ; run Emacs commands without modifier keys ;;lispy ; vim for lisp, for people who don't like vim - ;;multiple-cursors ; editing in many places at once + multiple-cursors ; editing in many places at once ;;objed ; text object editing for the innocent ;;parinfer ; turn lisp into python, sort of ;;rotate-text ; cycle region at point between text candidates @@ -155,7 +155,7 @@ ;;nix ; I hereby declare "nix geht mehr!" ;;ocaml ; an objective camel org ; organize your plain life in plain text - php ; perl's insecure younger brother + ;; php ; perl's insecure younger brother ;;plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional ;;python ; beautiful is better than ugly diff --git a/config/dot_config/doom/packages.el b/config/dot_config/doom/packages.el index 47545b0..481a63d 100644 --- a/config/dot_config/doom/packages.el +++ b/config/dot_config/doom/packages.el @@ -13,6 +13,7 @@ (package! org-modern) (package! org-auto-tangle) (package! org-habit-stats) +(package! org-drill) (package! catppuccin-theme) (package! heaven-and-hell) diff --git a/config/dot_config/doom/style.css b/config/dot_config/doom/style.css new file mode 100644 index 0000000..695e161 --- /dev/null +++ b/config/dot_config/doom/style.css @@ -0,0 +1,5 @@ +/* Fallback Org Export Styles */ + +body { + font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif !important; +}