Emacs : org-journal

This commit is contained in:
2023-01-14 19:52:11 +09:00
parent 245c51dbd1
commit 9d228af635

View File

@ -99,7 +99,7 @@ Emacs Configuration for emacs 29.50
install extension =modeline=.
#+begin_src javascript
// vim: set ft=js ts=4 sw=4 et:
// vim: ts=4:sw=4:et:ft=js
// vim :ts=4 :sw=4 :et :ft=js
// -*- mode: js; indent-tabs-mode: nil; tab-width: 4 -*-
// code: language=rust insertSpaces=false tabSize=4
#+end_src
@ -296,15 +296,6 @@ emacs built-in package config
;;; custom-default.el ends here
#+end_src
*** UI
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'all-the-icons)
(usr-package-install 'doom-themes)
(usr-package-install 'rainbow-delimiters)
(usr-package-install 'doom-modeline)
(usr-package-install 'visual-fill-column)
(usr-package-install 'dashboard)
#+end_src
**** Line number
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
(column-number-mode)
@ -320,6 +311,7 @@ emacs built-in package config
**** Doom themes
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'doom-themes)
(require 'doom-themes)
(disable-theme 'deeper-blue)
(if (display-graphic-p)
@ -328,6 +320,7 @@ emacs built-in package config
#+end_src
**** Rainbow Delimiters
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'rainbow-delimiters)
(require 'rainbow-delimiters)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
#+end_src
@ -369,6 +362,7 @@ emacs built-in package config
#+end_src
**** Modeline
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'doom-modeline)
(require 'doom-modeline)
(setq doom-modeline-height 15
doom-modeline-env-version t
@ -380,18 +374,20 @@ emacs built-in package config
#+end_src
**** Visual Fill Column
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'visual-fill-column)
(require 'visual-fill-column)
(defun write-room-enable ()
(setq visual-fill-column-width 100
visual-fill-column-center-text t)
visual-fill-column-center-text t)
(visual-fill-column-mode 1))
(add-hook 'org-mode-hook #'write-room-enable)
(add-hook 'markdown-mode-hook #'write-room-enable)
(add-hook 'nov-mode-hook #'write-room-enable)
(add-hook 'org-mode-hook #'write-room-enable)
(add-hook 'markdown-mode-hook #'write-room-enable)
(add-hook 'nov-mode-hook #'write-room-enable)
#+end_src
**** Dashboard
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(usr-package-install 'dashboard)
(require 'linum) ;; for dashboard seperator
;;(add-hook 'dashboard-mode page-break-lines-mode)
(require 'dashboard)
@ -436,31 +432,32 @@ emacs built-in package config
**** Others
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(setq visible-bell t)
(defun my/self-screenshot (&optional type)
"Save a screenshot of type TYPE of the current Emacs frame.
(usr-package-install 'all-the-icons)
(setq visible-bell t)
(defun my/self-screenshot (&optional type)
"Save a screenshot of type TYPE of the current Emacs frame.
As shown by the function `', type can weild the value `svg',
`png', `pdf'.
This function will output in /tmp a file beginning with \"Emacs\"
and ending with the extension of the requested TYPE."
(interactive)
(let* ((type (if type type
(intern (completing-read "Screenshot Type: "
'(png svg pdf postscript)))))
(extension (pcase type
('png ".png")
('svg ".svg")
('pdf ".pdf")
('postscript ".ps")
(otherwise (error "Cannot export screenshot of type %s" otherwise))))
(filename (make-temp-file "Emacs-" nil extension))
(data (x-export-frames nil type)))
(with-temp-file filename
(insert data))
(kill-new filename)
(rename-file filename (expand-file-name (file-name-nondirectory filename) "~"))
(message filename)))
(interactive)
(let* ((type (if type type
(intern (completing-read "Screenshot Type: "
'(png svg pdf postscript)))))
(extension (pcase type
('png ".png")
('svg ".svg")
('pdf ".pdf")
('postscript ".ps")
(otherwise (error "Cannot export screenshot of type %s" otherwise))))
(filename (make-temp-file "Emacs-" nil extension))
(data (x-export-frames nil type)))
(with-temp-file filename
(insert data))
(kill-new filename)
(rename-file filename (expand-file-name (file-name-nondirectory filename) "~"))
(message filename)))
#+end_src
**** Provide Modules
@ -470,17 +467,6 @@ emacs built-in package config
#+end_src
*** Key Bindings
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'which-key)
(usr-package-install 'general)
(usr-package-install 'evil)
(usr-package-install 'evil-collection)
(usr-package-install 'evil-nerd-commenter)
(usr-package-install 'evil-numbers)
(usr-package-install 'undo-tree)
(usr-package-install 'hydra)
#+end_src
**** Global Key
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
;; Make ESC quit prompts
@ -493,6 +479,7 @@ emacs built-in package config
**** Which keys
When you begin a keybind, whichkey will show you all keybinds you can follow the first one with in order to form a full keywords.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'which-key)
(require 'which-key)
(setq which-key-idle-delay 0.5)
(which-key-mode 1)
@ -500,6 +487,7 @@ When you begin a keybind, whichkey will show you all keybinds you can follow the
**** General
for managing keybindings.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'general)
(require 'general)
(general-auto-unbind-keys)
(general-evil-setup t)
@ -558,6 +546,10 @@ for managing keybindings.
#+end_src
**** Evil Mode
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'evil)
(usr-package-install 'evil-collection)
(usr-package-install 'evil-nerd-commenter)
(usr-package-install 'evil-numbers)
(customize-set-variable 'evil-want-integration t)
(customize-set-variable 'evil-want-keybinding nil)
(customize-set-variable 'evil-want-C-u-scroll t)
@ -599,6 +591,7 @@ for managing keybindings.
#+end_src
**** Undo Tree
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'undo-tree)
(require 'undo-tree)
(setq undo-tree-visualizer-diff t
undo-tree-visualizer-timestamps t
@ -611,6 +604,7 @@ for managing keybindings.
#+end_src
**** Hydra
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
(usr-package-install 'hydra)
(require 'hydra)
(defhydra hydra-text-scale (:timeout 4)
"scale text"
@ -644,21 +638,9 @@ for managing keybindings.
*** Completion
config from crafted-emacs
https://github.com/SystemCrafter/crafted-emacs
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'vertico)
(usr-package-install 'vertico-prescient)
(usr-package-install 'marginalia)
(usr-package-install 'orderless)
(usr-package-install 'consult)
(usr-package-install 'embark)
(usr-package-install 'embark-consult)
(usr-package-install 'corfu)
(usr-package-install 'corfu-terminal)
(usr-package-install 'cape)
#+end_src
**** Vertico
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'vertico)
(require 'vertico)
(require 'vertico-directory)
(with-eval-after-load 'evil
@ -668,15 +650,23 @@ https://github.com/SystemCrafter/crafted-emacs
(customize-set-variable 'vertico-cycle t)
(vertico-mode 1)
#+end_src
**** Prescient
simple but effective sorting and filtering for emacs.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'vertico-prescient)
(vertico-prescient-mode)
#+end_src
**** Marginalia
annotations placed at the margin of the minibuffer
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'marginalia)
(require 'marginalia)
(customize-set-variable 'marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
(marginalia-mode 1)
#+end_src
**** Consult
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'consult)
(global-set-key (kbd "C-s") 'consult-line)
(define-key minibuffer-local-map (kbd "C-r") 'consult-history)
(global-set-key (kbd "C-M-j") 'consult-buffer)
@ -685,6 +675,7 @@ annotations placed at the margin of the minibuffer
**** Orderless
orderless completion
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'orderless)
(require 'orderless)
(customize-set-variable 'completion-styles '(orderless basic))
(customize-set-variable 'completion-category-overrides '((file (style basic partial-completion))))
@ -692,6 +683,8 @@ orderless completion
**** Embark / Embark Consult
Quick Action in minibuffer
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'embark)
(usr-package-install 'embark-consult)
(require 'embark)
(require 'embark-consult)
(global-set-key [remap describe-bindings] #'embark-bindings)
@ -704,6 +697,9 @@ Quick Action in minibuffer
**** Corfu / Cape
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(usr-package-install 'corfu)
(usr-package-install 'corfu-terminal)
(usr-package-install 'cape)
;;; Corfu
(require 'corfu-popupinfo)
(require 'corfu)
@ -748,30 +744,15 @@ Quick Action in minibuffer
corfu-auto nil)
(corfu-mode)))
#+end_src
**** Prescient
simple but effective sorting and filtering for emacs.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(vertico-prescient-mode)
#+end_src
**** Provide Modules
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
(provide 'custom-completion)
;;; custom-completion.el ends here
#+end_src
*** Org Mode
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'org-contrib)
(usr-package-install 'org-superstar)
(usr-package-install 'org-attach-screenshot)
(usr-package-install 'org-download)
(usr-package-install 'valign)
(usr-package-install 'org-pdftools)
(usr-package-install 'org-roam)
(usr-package-install 'org-roam-ui)
#+end_src
**** configure org
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'org-contrib)
(setq org-directory "~/org") ; use for relative file location
;; hooks
(add-hook 'org-mode-hook #'org-indent-mode)
@ -841,60 +822,60 @@ simple but effective sorting and filtering for emacs.
#+end_src
**** Org superstar
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'org-superstar)
(add-hook 'org-mode-hook #'org-superstar-mode)
#+end_src
**** Org attach screenshot (linux)
to use org-screenshot-take
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(require 'org-attach-screenshot)
(usr-package-install 'org-attach-screenshot)
#+end_src
**** Org download
download image link
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(require 'org-download)
(usr-package-install 'org-download)
#+end_src
**** Org Journal
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'org-journal)
(setq org-journal-dir (expand-file-name "journal/" org-directory))
(setq org-journal-file-type 'weekly)
(ju/leader-key-def
"n j" '(:ignore t :which-key "Org Journal")
"n j j" '(org-journal-new-entry :which-key "new Entry")
"n j J" '(org-journal-new-scheduled-entry :which-key "New Scheduled entry")
"n j s" '(org-journal-search :which-key "Journal Search"))
#+end_src
**** Org Roam
+ TODO: Project todos
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
;;(use-package org-roam
;; :ensure t
;; :custom
;; (org-roam-directory (file-truename "~/org/roam2"))
;; :bind (("C-c n l" . org-roam-buffer-toggle)
;; ("C-c n f" . org-roam-node-find)
;; ("C-c n g" . org-roam-graph)
;; ("C-c n i" . org-roam-node-insert)
;; ("C-c n c" . org-roam-capture)
;; ;; Dailies
;; ("C-c n j" . org-roam-dailies-capture-today))
;; :config
;; ;; If you're using a vertical completion framework, you might want a more informative completion interface
;; (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
;; (org-roam-db-autosync-mode))
(usr-package-install 'org-roam)
(setq org-roam-v2-ack t)
(customize-set-variable 'org-roam-directory "~/org/roam2")
(customize-set-variable 'org-roam-completion-everywhere t)
(org-roam-db-autosync-mode)
;; Org roam ui
(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)
(ju/leader-key-def
"n r" '(:ignore t :which-key "Org Roam")
"n r u" 'org-roam-ui-open
"n r l" 'org-roam-buffer-toggle
"n r f" 'org-roam-node-find
"n r i" 'org-roam-node-insert
"n r I" 'org-roam-node-insert-immediate
"n r p" 'my/org-roam-find-project)
;;:desc "org roam refresh agenda list"
;;"oar" 'my/org-roam-refresh-agenda-list
;;:desc "org roam find tag:project"
;;"nrp" 'my/org-roam-find-project
;;:desc "org roam find with ripgrep (preview)"
;;"nrg" 'my/org-roam-rg-search)
(setq org-roam-v2-ack t)
(customize-set-variable 'org-roam-directory "~/org/roam")
(customize-set-variable 'org-roam-completion-everywhere t)
(org-roam-db-autosync-mode)
;; Org roam ui
(usr-package-install 'org-roam-ui)
(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)
(ju/leader-key-def
"n r" '(:ignore t :which-key "Org Roam")
"n r u" 'org-roam-ui-open
"n r l" 'org-roam-buffer-toggle
"n r f" 'org-roam-node-find
"n r i" 'org-roam-node-insert
"n r I" 'org-roam-node-insert-immediate
"n r p" 'my/org-roam-find-project)
;;:desc "org roam refresh agenda list"
;;"oar" 'my/org-roam-refresh-agenda-list
;;:desc "org roam find tag:project"
;;"nrp" 'my/org-roam-find-project
;;:desc "org roam find with ripgrep (preview)"
;;"nrg" 'my/org-roam-rg-search)
#+end_src
**** Valign
@ -902,11 +883,13 @@ download image link
|----------+---|
| 일이삼사 | |
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'valign)
(customize-set-variable 'valign-fancy-bar t)
#+end_src
**** Org PDF tools
get link from pdf,
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
(usr-package-install 'org-pdftools)
(add-hook 'org-mode-hook #'org-pdftools-setup-link)
#+end_src
**** Keybindings
@ -923,16 +906,9 @@ get link from pdf,
;;; custom-org.el ends here
#+end_src
*** Projects
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(usr-package-install 'magit)
(usr-package-install 'magit-todos)
(usr-package-install 'git-gutter)
;;(usr-package-install 'forge)
(usr-package-install 'hl-todo)
#+end_src
**** MAGIT
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(usr-package-install 'magit)
;;(use-package magit)
(require 'magit)
;;(magit-status magit-get-current-branch)
@ -946,17 +922,18 @@ get link from pdf,
#+end_src
**** Gitgutter
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(usr-package-install 'git-gutter)
(global-git-gutter-mode)
(setq git-gutter:update-interval 2)
#+end_src
**** Forge
Git forge
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(global-git-gutter-mode)
(setq git-gutter:update-interval 2)
#+end_src
**** Highlight TODOs
***** TODO: test
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(usr-package-install 'hl-todo)
(require 'hl-todo)
(setq hl-todo-keyword-faces
`(;; For things that need to be done, just not today.
@ -983,6 +960,7 @@ Git forge
#+end_src
**** Magit TODOs
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
(usr-package-install 'magit-todos)
(require 'magit-todos)
(add-hook 'magit-mode-hook #'magit-todos-mode)
#+end_src
@ -1036,15 +1014,10 @@ Git forge
;;; custom-workspaces.el ends here
#+end_src
*** Latex
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
(usr-package-install 'auctex)
(usr-package-install 'cdlatex)
(usr-package-install 'latex-preview-pane)
#+end_src
**** AUCTEX
writing and formatting tex file in Emacs.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
(usr-package-install 'auctex)
(with-eval-after-load 'latex
(customize-set-variable 'TeX-auto-save t)
(customize-set-variable 'TeX-parse-self t)
@ -1091,12 +1064,14 @@ writing and formatting tex file in Emacs.
**** Cdlatex
speed-up insertion of environments and math templates.
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
(usr-package-install 'cdlatex)
(add-hook 'org-mode-hook #'org-cdlatex-mode)
(add-hook 'LaTeX-mode-hook #'cdlatex-mode)
(setq cdlatex-use-dollar-to-ensure-math nil)
#+end_src
**** Preview pane
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
(usr-package-install 'latex-preview-pane)
(require 'latex-preview-pane)
#+end_src
**** Provide Modules
@ -1105,9 +1080,6 @@ speed-up insertion of environments and math templates.
;;; custom-latex.el ends here
#+end_src
*** Extra
**** Install Packages
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
#+end_src
**** Helpful
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
(usr-package-install 'helpful)
@ -1186,7 +1158,7 @@ enhanced PDF viewer on emacs
;; '(file))))
#+end_src
**** Calfw
org calendar
calendar
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
(usr-package-install 'calfw)
(usr-package-install 'calfw-org)
@ -1215,6 +1187,7 @@ org calendar
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(dot . t)
(latex . t)))
(push '("conf-unix" . conf-unix) org-src-lang-modes)
;; This is needed as of Org 9.2
@ -1258,6 +1231,11 @@ org calendar
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(setq markdown-command "multimarkdown")
#+end_src
**** Graphviz dot Mode
org mode graph drawing with graphviz
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
(usr-package-install 'graphviz-dot-mode)
#+end_src
**** Verilog Indent
LSP -> veriloter
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el