diff --git a/.config/emacs/init.el b/.config/emacs/init.el index f9dc785..6fb8e1a 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -81,7 +81,7 @@ Otherwise the startup will be very slow. " ;;;; markdown (require 'init-markdown) -;;(require 'init-org) +(require 'init-org) (require 'init-reader) ;; @@ -102,7 +102,7 @@ Otherwise the startup will be very slow. " ;; ;;(require 'init-elisp) ;;(require 'init-c) -;;(require 'init-rust) +(require 'init-rust) ;;(require 'init-python) ;;(require 'init-ruby) ;;(require 'init-shell) diff --git a/.config/emacs/lisp/init-org.el b/.config/emacs/lisp/init-org.el index 1c42952..5e23d91 100644 --- a/.config/emacs/lisp/init-org.el +++ b/.config/emacs/lisp/init-org.el @@ -4,12 +4,12 @@ (require 'init-custom) (use-package org - :ensure nil + :ensure nil ; built-in :custom-face (org-ellipsis ((t (:foreground unspecified)))) :pretty-hydra ;; See `org-structure-template-alist' ((:title (pretty-hydra-title "Org Template" 'sucicon "nf-custom-orgmode" :face 'nerd-icons-green) - :color blue :quit-key ("q" "C-g")) + :color blue :quit-key ("q" "C-g")) ("Basic" (("a" (hot-expand "" . org-tree-slide-mode)) - :hook ((org-tree-slide-play . (lambda () - (text-scale-increase 4) - (org-display-inline-images) - (read-only-mode 1))) - (org-tree-slide-stop . (lambda () - (text-scale-increase 0) - (org-remove-inline-images) - (read-only-mode -1)))) - :init (setq org-tree-slide-header nil - org-tree-slide-slide-in-effect t - org-tree-slide-heading-emphasis nil - org-tree-slide-cursor-init t - org-tree-slide-modeline-display 'outside - org-tree-slide-skip-done nil - org-tree-slide-skip-comments t - org-tree-slide-skip-outline-level 3)) - ;; support drawio - (use-package org-drawio - :commands (org-drawio-add - org-drawio-open) - :custom ((org-drawio-input-dir "./draws") - (org-drawio-output-dir "./images") - (org-drawio-output-page "0") - ;; set to t, if you want to crop the image. - (org-drawio-crop t))) -; attachment ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package org-contrib ;; to use org-screenshot-take - :defer t) - (use-package org-attach-screenshot - :defer t) - (use-package org-download - :defer t) - (use-package ob-latex-as-png - :ensure t) +; useful functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun my/org-remove-link-and-trash-linked-file () "Remove `org-mode' link at point and trash linked file." (interactive) @@ -303,40 +225,119 @@ prepended to the element after the #+HEADER: tag." (user-error "Error pasting the image, make sure you have an image in the clipboard!")))) (defun org-time-stamp-with-time() - "Insert org mode timestamp at point with current date and time" - (interactive) - (org-insert-time-stamp (current-time) t)) -; org-roam ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package org-roam - :demand t ;; ensure org-roam is loaded by default - :custom - (org-roam-directory custom-org-roam-directory) - (org-roam-node-display-template (concat "${title:*} " (propertize "${tags:*}" 'face 'org-tag))) - ;;(org-roam-completion-everywhere t) - :config - (setq org-roam-capture-templates - '(("d" "default" plain "%?" - :target - (file+head - "%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("p" "project" plain "* TODO %?" - :target - (file+head+olp - "%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n#+category: ${title}\n#+filetags: Project" - ("Tasks")) - :unnarrowed t))) - (org-roam-db-autosync-mode)) - ;; Org roam ui - (use-package org-roam-ui - :defer t - :config - (setq org-roam-ui-sync-theme t - org-roam-ui-follow t - org-roam-ui-update-on-save t - org-roam-ui-open-on-start nil)) + "Insert org mode timestamp at point with current date and time" + (interactive) + (org-insert-time-stamp (current-time) t))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Org mode improvement ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package org-journal + :straight t + :ensure t + :defer t + :config + (setq org-journal-dir (expand-file-name "journal/" org-directory)) + (setq org-journal-file-type 'weekly)) + +(use-package org-modern + :straight t + :ensure t + :defer t + :hook ((org-mode . org-modern-mode) + (org-agenda-finalize . org-modern-agenda)) + :config + (setq org-modern-table nil)) + +(use-package valign + :straight t + :ensure t + :defer t + :hook (org-mode . valign-mode) + :custom + (valign-fancy-bar t)) + + +;; Auto-toggle Org LaTeX fragments +(use-package org-fragtog + :straight t + :ensure t + :defer t + :diminish + :hook (org-mode . org-fragtog-mode)) +;; Make invisible parts of Org elements appear visible. +(use-package org-appear + :straight t + :ensure t + :defer t + :hook (org-mode . org-appear-mode) + :config + (setq org-appear-autoemphasis t + org-appear-autolinks t + org-appear-autoentities t + org-appear-autosubmarkers t)) +;; support drawio +(use-package org-drawio + :straight t + :ensure t + :defer t + :commands (org-drawio-add + org-drawio-open) + :custom ((org-drawio-input-dir "./draws") + (org-drawio-output-dir "./images") + (org-drawio-output-page "0") + ;; set to t, if you want to crop the image. + (org-drawio-crop t))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Org mode attachment ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package org-contrib ;; to use org-screenshot-take + :straight t + :ensure t + :defer t + :defer t) +(use-package org-attach-screenshot + :straight t + :ensure t + :defer t + :defer t) +(use-package org-download + :straight t + :ensure t + :defer t + :defer t) +(use-package ob-latex-as-png + :straight t + :ensure t + :defer t + :ensure t) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Org roam ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package org-roam + :straight t + :ensure t + :defer t + :demand t ;; ensure org-roam is loaded by default + :custom + (org-roam-directory custom-org-roam-directory) + (org-roam-node-display-template (concat "${title:*} " (propertize "${tags:*}" 'face 'org-tag))) + ;;(org-roam-completion-everywhere t) + :config + (setq org-roam-capture-templates + '(("d" "default" plain "%?" + :target + (file+head + "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("p" "project" plain "* TODO %?" + :target + (file+head+olp + "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n#+category: ${title}\n#+filetags: Project" + ("Tasks")) + :unnarrowed t))) ;; functions (defun my/org-roam-rg-search () "Search org-roam directory using consult-ripgrep. With live-preview." @@ -365,33 +366,45 @@ prepended to the element after the #+HEADER: tag." (unless org-note-abort (with-current-buffer (org-capture-get :buffer) (add-to-list 'org-agenda-files (buffer-file-name))))) -; Tools ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package ob-async - :config - (setq ob-async-no-async-languages-alist '("ipython"))) - (unless ON-WINDOWS - (use-package org-pdftools - :hook (org-mode . org-pdftools-setup-link))) -; Exporter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package ox-hugo - :defer t - :after ox) - (setq org-latex-minted-options '(("breaklines" "true") - ("tabsize" "4") - ("autogobble") - ("breakanywhere" "true") - ("bgcolor" "gray!40") - ("frame" "single") - ("numbers" "left"))) - (setq org-latex-listings 'minted - org-latex-packages-alist '(("" "minted")) - org-latex-pdf-process - '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -interaction nonstopmode -output-directory %o %f")) - (with-eval-after-load 'ox-latex - (add-to-list 'org-latex-classes - '("article" - "\\documentclass[11pt,a4paper]{article} + + ; database sync + (org-roam-db-autosync-mode)) +;; Org roam ui +(use-package org-roam-ui + :straight t + :ensure t + :defer t + :config + (setq org-roam-ui-sync-theme t + org-roam-ui-follow t + org-roam-ui-update-on-save t + org-roam-ui-open-on-start nil)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Org mode exporter ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package ox-hugo + :straight t + :ensure t + :defer t + :after ox) + +(setq org-latex-minted-options + '(("breaklines" "true") + ("tabsize" "4") + ("autogobble") + ("breakanywhere" "true") + ("bgcolor" "gray!40") + ("frame" "single") + ("numbers" "left"))) +(setq org-latex-listings 'minted + org-latex-packages-alist '(("" "minted")) + org-latex-pdf-process + '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "pdflatex -interaction nonstopmode -output-directory %o %f")) +(with-eval-after-load 'ox-latex + (add-to-list 'org-latex-classes + '("article" + "\\documentclass[11pt,a4paper]{article} \\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm,a4paper]{geometry} [DEFAULT-PACKAGES] \\usepackage{kotex} @@ -399,13 +412,13 @@ prepended to the element after the #+HEADER: tag." [EXTRA] \\linespread{1.1} \\hypersetup{pdfborder=0 0 0}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}"))) - (add-to-list 'org-latex-classes - '("org-plain-latex" - "\\documentclass[a4paper,11pt,titlepage]{memoir} + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}"))) + (add-to-list 'org-latex-classes + '("org-plain-latex" + "\\documentclass[a4paper,11pt,titlepage]{memoir} \\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm,a4paper]{geometry} [DEFAULT-PACKAGES] \\usepackage{kotex} @@ -413,16 +426,29 @@ prepended to the element after the #+HEADER: tag." [EXTRA] \\linespread{1.1} \\hypersetup{pdfborder=0 0 0}" - ("\\chapter{%s}" . "\\chapter*{%s}") - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))) + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) -;; support calendar -(use-package calfw) -(use-package calfw-org - :after calfw) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Org babel related ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package ob-async + :straight t + :ensure t + :config + (setq ob-async-no-async-languages-alist '("ipython"))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Tools ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(unless ON-WINDOWS + (use-package org-pdftools + :straight t + :ensure t + :defer t + :hook (org-mode . org-pdftools-setup-link))) (provide 'init-org) ;;; init-org.el ends here diff --git a/.config/emacs/lisp/init-rust.el b/.config/emacs/lisp/init-rust.el index fe46bde..185f82d 100644 --- a/.config/emacs/lisp/init-rust.el +++ b/.config/emacs/lisp/init-rust.el @@ -32,18 +32,31 @@ ;; Rust (use-package rustic + :straight t + :ensure t + :defer t :init (if ON-LINUX (setq rustic-analyzer-command '("~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rust-analyzer")) (setq rustic-analyzer-command '("~/.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin/rust-analyzer.exe"))) (setq rustic-lsp-client 'eglot)) -(use-package rust-playground) +(use-package rust-playground + :straight t + :ensure t + :defer t) (use-package toml-mode + :straight t + :ensure t :defer t :config (add-to-list 'auto-mode-alist '("/\\(Cargo.lock\\|\\.cargo/config\\)\\'" . toml-mode))) -(provide 'init-rust) +; org-babel integration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(use-package ob-rust + :straight t + :ensure t + :defer t) +(provide 'init-rust) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; init-rust.el ends here