diff --git a/README.org b/README.org index 7e2c351..4383ed7 100644 --- a/README.org +++ b/README.org @@ -1,10 +1,10 @@ * Fschl Emacs -A new start in 2023, initial bootstrap with ~crafted-emacs v2beta~. +A new start in 2023, initial bootstrap with ~crafted-emacs~. ** Early setup -1. clone crafted emacs to =~/src/crafted-emacs=, use branch /craftedv2beta/ +1. clone crafted emacs to =~/src/crafted-emacs= 2. create the directory links #+begin_src bash mkdir ~/.config/crafted-emacs-configdir diff --git a/custom.el b/custom.el index d8210f5..c44c0ff 100644 --- a/custom.el +++ b/custom.el @@ -1,61 +1,39 @@ -;;; custom.el --- fschl-crafted-emacs-config -*- lexical-binding: t; -*- +;;; custom.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*- + ;; This file is generated from custom.org. If you want to edit the + ;; configuration, DO NOT edit custom.el, edit custom.org, instead. ;; Copyright (C) 2023 fschl ;; Author: fschl ;; Keywords: tools, docs -;; basic stuff. we need some more space -(menu-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) -(fset 'yes-or-no-p 'y-or-n-p) ;; shorten yes-no answers - +;; Tangle the code blocks to config.el on save. (defun org-babel-tangle-config () - "Tangle all Org-mode files in `user-emacs-directory` after save." - (let ((user-emacs-dir (expand-file-name user-emacs-directory)) - (buffer-file (expand-file-name (buffer-file-name)))) - (when (and (string-equal (file-name-extension (buffer-file-name)) "org") - (string-equal (file-name-directory (buffer-file-name)) user-emacs-dir)) - (let ((default-directory user-emacs-dir) - (org-confirm-babel-evaluate nil)) - (org-babel-tangle-file (buffer-file-name)))))) + (when (string-equal (buffer-file-name) + (expand-file-name "init.org" user-emacs-directory)) + ;; Dynamic scoping to the rescue + (let ((org-confirm-babel-evaluate nil)) + (org-babel-tangle)))) (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'org-babel-tangle-config))) - -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(default ((t (:height 80))))) - - (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(LaTeX-electric-left-right-brace t) - '(Man-notify-method 'aggressive) - '(TeX-auto-save t) - '(TeX-electric-math '("$" . "$")) - '(TeX-electric-sub-and-superscript t) - '(TeX-parse-self t) - '(bookmark-save-flag 1 t) + '(Man-notify-method 'aggressive t) + '(bookmark-save-flag 1) '(completion-category-overrides '((file (styles partial-completion)))) '(completion-cycle-threshold 3) + '(completion-styles '(orderless basic)) '(completions-detailed t) '(corfu-auto t) - '(corfu-auto-delay 0.0) '(corfu-auto-prefix 2) '(corfu-cycle t) - '(corfu-echo-documentation 0.25 t) '(dired-auto-revert-buffer t) '(dired-dwim-target t) - '(dired-listing-switches "-alh") '(ediff-window-setup-function 'ediff-setup-windows-plain t) '(eglot-autoshutdown t t) '(eshell-scroll-to-bottom-on-input 'this t) @@ -65,16 +43,16 @@ '(evil-want-C-i-jump nil) '(evil-want-integration t) '(evil-want-keybinding nil) + '(fancy-splash-image "/home/fschl/src/crafted-emacs/system-crafters-logo.png") '(fast-but-imprecise-scrolling t) '(global-auto-revert-non-file-buffers t) '(ibuffer-movement-cycle nil) '(ibuffer-old-time 24) '(kill-do-not-save-duplicates t) - '(load-prefer-newer t) - '(markdown-enable-html t) - '(markdown-enable-math t) + '(load-prefer-newer t t) + '(marginalia-annotators + '(marginalia-annotators-heavy marginalia-annotators-light nil) t) '(org-hide-emphasis-markers t) - '(org-latex-compiler "xelatex") '(org-link-descriptive t) '(org-mouse-1-follows-link t) '(org-return-follows-link t) @@ -84,12 +62,7 @@ ("stable" . 70) ("melpa" . 0))) '(package-selected-packages - '(auctex pandoc-mode markdown-mode combobulate treesit-auto ibuffer-project aggressive-indent editorconfig tree-sitter-langs tree-sitter-ispell tree-sitter-indent tree-sitter eglot magit helpful elisp-demos all-the-icons org-appear denote evil-nerd-commenter evil-collection evil vertico orderless marginalia embark-consult embark corfu-terminal corfu consult cape)) - '(reftex-plug-into-AUCTeX t) - '(safe-local-variable-values - '((vc-prepare-patches-separately) - (diff-add-log-use-relative-names . t) - (vc-git-annotate-switches . "-w"))) + '(ob-rust rustic cargo ox-koma-letter ox-latex auctex pandoc-mode markdown-mode ibuffer-project aggressive-indent editorconfig treesit-auto helpful elisp-demos all-the-icons org-appear denote evil-nerd-commenter evil-collection evil vertico orderless marginalia embark-consult embark corfu-terminal corfu consult cape)) '(scroll-conservatively 101) '(scroll-margin 0) '(scroll-preserve-screen-position t) @@ -97,5 +70,10 @@ '(switch-to-buffer-obey-display-actions t) '(tab-always-indent 'complete) '(vertico-cycle t) - '(xref-show-definitions-function 'xref-show-definitions-completing-read t)) - + '(xref-show-definitions-function 'xref-show-definitions-completing-read)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/fschl-org.el b/fschl-org.el index ef7a814..563ac52 100644 --- a/fschl-org.el +++ b/fschl-org.el @@ -1,40 +1,36 @@ ;;; fschl-org.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*- + ;; This file is generated from the .org-file with the same name. If you want to edit the ;; configuration, DO NOT edit this .el-file, edit .org, instead. -;;(add-to-list 'package-selected-packages 'org-roam) +;; see variable `org-roam-database-connector` +;(add-to-list 'package-selected-packages 'emacsql-sqlite-builtin) +;(add-to-list 'package-selected-packages 'emacsql-sqlite) +;(add-to-list 'package-selected-packages 'org-roam) +;(add-to-list 'package-selected-packages 'org-roam-ui) +(add-to-list 'package-selected-packages 'denote) (add-to-list 'package-selected-packages 'ox-latex) (add-to-list 'package-selected-packages 'ox-koma-letter) (package-install-selected-packages :noconfirm) -;;(setq org-roam-directory (file-truename "~/org-roam")) -;;(org-roam-db-autosync-mode) +(setq org-default-notes-file "~/Documents/Org/inbox.org") +(keymap-global-set "C-c o c" #'org-capture) +(keymap-global-set "C-c o l" #'org-store-link) +(keymap-global-set "C-c o a" #'org-agenda) -(keymap-global-set "C-c r r" #'org-capture) -(keymap-global-set "C-c r l" #'org-store-link) -(keymap-global-set "C-c r a" #'org-agenda) (keymap-global-set "" #'org-cycle-agenda-files) +;(keymap-global-set "" #'find-file org-default-notes-file) -(setq org-default-notes-file "~/Documents/Org/tasks.org") (setq org-agenda-files - (quote ("~/Documents/Org/tasks.org" + (quote ("~/Documents/Org/inbox.org" "~/Documents/Org/journal.org" "~/Documents/Org/private.org" "~/Documents/Org/projects.org" + "~/Documents/Org/tasks.org" "~/Documents/Org/birthdays.org"))) - -(setq calendar-week-start-day 1) -(setq calendar-intermonth-text - '(propertize - (format "%2d" - (car - (calendar-iso-from-absolute - (calendar-absolute-from-gregorian (list month day year))))) - 'font-lock-face 'font-lock-warning-face)) - -(setq calendar-intermonth-header - (propertize "KW" ; or e.g. "Wk" - 'font-lock-face 'font-lock-keyword-face)) +(setq org-refile-targets '(("~/Documents/Org/projects.org" :maxlevel . 3) + ("~/Documents/Org/journal.org" :level . 1) + ("~/Documents/Org/private.org" :maxlevel . 2))) (setq org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") @@ -49,6 +45,19 @@ ("MEETING" :foreground "forest green" :weight bold) ("PHONE" :foreground "forest green" :weight bold)))) +(setq calendar-week-start-day 1) +(setq calendar-intermonth-text + '(propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian (list month day year))))) + 'font-lock-face 'font-lock-warning-face)) + +(setq calendar-intermonth-header + (propertize "KW" ; or e.g. "Wk" + 'font-lock-face 'font-lock-keyword-face)) + (eval-after-load 'ox '(require 'ox-koma-letter)) (eval-after-load 'ox '(require 'ox-moderncv)) (eval-after-load 'ox '(require 'ox-awesomecv)) @@ -74,12 +83,12 @@ (setq org-capture-templates '(("t" "todo list item" entry - (file+olp+datetree "~/Documents/Org/tasks.org") + (file+olp+datetree "~/Documents/Org/inbox.org") "* TODO %?\n SCHEDULED: %^T" :tree-type month ) ("T" "todo list item with source" entry - (file+olp+datetree "~/Documents/Org/tasks.org") + (file+olp+datetree "~/Documents/Org/inbox.org") "* TODO %?\n %a \n SCHEDULED: %^T \n %^G \n" :tree-type month ) @@ -114,16 +123,16 @@ \ Frieder Schlesier") ("m" "Schedule a meeting" entry - (file+headline "~/Documents/Org/tasks.org") + (file+headline "~/Documents/Org/inbox.org") "* MEETING %?\n SCHEDULED: %^T\n %a" ) ("p" "Schedule a phone call" entry - (file+headline "~/Documents/Org/tasks.org") + (file+headline "~/Documents/Org/inbox.org") "* PHONE %?\n SCHEDULED: %^T\\n %a" ) ("a" "Articles: keep notes of online articles" entry - (file+datetree "~/Documents/Org/journal.org") + (file+olp+datetree "~/Documents/Org/journal.org") "* %? \n%x \n %u\n- $?" :tree-type month :kill-buffer t @@ -131,6 +140,41 @@ Frieder Schlesier") ) ) +;; active Babel languages +(org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (emacs-lisp . t) + (dot . t))) + +(setq org-directory "~/Documents/Org/denotes/") + (use-package denote + :bind + ("C-c n n" . 'denote) + ("C-c n f" . 'denote-open-or-create) + ;; ("C-c n f" . 'my/project-org-file-file) + ("C-c n k" . 'denote-keywords-add) ;; update file name automatically + ("C-c n K" . 'denote-keywords-remove) ;; update file name automatically + ("C-c n u" . 'denote-rename-file-using-front-matter) + ("C-c n l" . 'denote-link-find-backlink) + ("C-c n r" . 'my/denote-random-note) + :init + (setq denote-directory (expand-file-name org-directory)) + :config + (setq denote-known-keywords '("emacs")) + (setq denote-prompts '(subdirectory title)) + (setq denote-excluded-directories-regexp ".attachment") + + ;; Makes the denote links different from usual link. + (set-face-attribute 'denote-faces-link + nil :foreground "magenta" :inherit 'link) + + ;; Remove the date and the identifier. They are duplicated with the file name. + ;; I want to remove filetags too but denote-keyword-* need that. + (setq denote-org-front-matter "#+title: %1$s\n#+filetags: %3$s\n") + + (add-hook 'dired-mode-hook #'denote-dired-mode)) + (use-package ox-awesomecv :load-path "~/src/org-cv/" :init (require 'ox-awesomecv)) diff --git a/fschl-org.org b/fschl-org.org index 845224c..22c0e75 100644 --- a/fschl-org.org +++ b/fschl-org.org @@ -5,38 +5,61 @@ ** Additional Packages #+begin_src emacs-lisp ;;; fschl-org.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*- + ;; This file is generated from the .org-file with the same name. If you want to edit the ;; configuration, DO NOT edit this .el-file, edit .org, instead. - ;;(add-to-list 'package-selected-packages 'org-roam) + ;; see variable `org-roam-database-connector` + ;(add-to-list 'package-selected-packages 'emacsql-sqlite-builtin) + ;(add-to-list 'package-selected-packages 'emacsql-sqlite) + ;(add-to-list 'package-selected-packages 'org-roam) + ;(add-to-list 'package-selected-packages 'org-roam-ui) + (add-to-list 'package-selected-packages 'denote) (add-to-list 'package-selected-packages 'ox-latex) (add-to-list 'package-selected-packages 'ox-koma-letter) (package-install-selected-packages :noconfirm) #+end_src -** Configure Org-Roam -#+begin_src emacs-lisp -;;(setq org-roam-directory (file-truename "~/org-roam")) -;;(org-roam-db-autosync-mode) -#+end_src ** Setup Org-mode Key Map #+begin_src emacs-lisp -(keymap-global-set "C-c r r" #'org-capture) -(keymap-global-set "C-c r l" #'org-store-link) -(keymap-global-set "C-c r a" #'org-agenda) -(keymap-global-set "" #'org-cycle-agenda-files) + (setq org-default-notes-file "~/Documents/Org/inbox.org") + (keymap-global-set "C-c o c" #'org-capture) + (keymap-global-set "C-c o l" #'org-store-link) + (keymap-global-set "C-c o a" #'org-agenda) + + (keymap-global-set "" #'org-cycle-agenda-files) + (keymap-global-set "" #'find-file org-default-notes-file) #+end_src ** Setup Agenda Files #+begin_src emacs-lisp - (setq org-default-notes-file "~/Documents/Org/tasks.org") (setq org-agenda-files - (quote ("~/Documents/Org/tasks.org" + (quote ("~/Documents/Org/inbox.org" "~/Documents/Org/journal.org" "~/Documents/Org/private.org" "~/Documents/Org/projects.org" + "~/Documents/Org/tasks.org" "~/Documents/Org/birthdays.org"))) + (setq org-refile-targets '(("~/Documents/Org/projects.org" :maxlevel . 3) + ("~/Documents/Org/journal.org" :level . 1) + ("~/Documents/Org/private.org" :maxlevel . 2))) +#+end_src + +*** Custom TODO keywords +#+begin_src emacs-lisp + (setq org-todo-keywords + (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") + (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")))) +(setq org-todo-keyword-faces + (quote (("TODO" :foreground "red" :weight bold) + ("NEXT" :foreground "blue" :weight bold) + ("DONE" :foreground "forest green" :weight bold) + ("WAITING" :foreground "orange" :weight bold) + ("HOLD" :foreground "magenta" :weight bold) + ("CANCELLED" :foreground "forest green" :weight bold) + ("MEETING" :foreground "forest green" :weight bold) + ("PHONE" :foreground "forest green" :weight bold)))) #+end_src *** Add Week to Calendar @@ -56,22 +79,6 @@ 'font-lock-face 'font-lock-keyword-face)) #+end_src -*** Custom TODO keywords -#+begin_src emacs-lisp - (setq org-todo-keywords - (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") - (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")))) -(setq org-todo-keyword-faces - (quote (("TODO" :foreground "red" :weight bold) - ("NEXT" :foreground "blue" :weight bold) - ("DONE" :foreground "forest green" :weight bold) - ("WAITING" :foreground "orange" :weight bold) - ("HOLD" :foreground "magenta" :weight bold) - ("CANCELLED" :foreground "forest green" :weight bold) - ("MEETING" :foreground "forest green" :weight bold) - ("PHONE" :foreground "forest green" :weight bold)))) -#+end_src - ** Setup Capture Templates - https://orgmode.org/manual/Template-elements.html @@ -107,12 +114,12 @@ #+begin_src emacs-lisp (setq org-capture-templates '(("t" "todo list item" entry - (file+olp+datetree "~/Documents/Org/tasks.org") + (file+olp+datetree "~/Documents/Org/inbox.org") "* TODO %?\n SCHEDULED: %^T" :tree-type month ) ("T" "todo list item with source" entry - (file+olp+datetree "~/Documents/Org/tasks.org") + (file+olp+datetree "~/Documents/Org/inbox.org") "* TODO %?\n %a \n SCHEDULED: %^T \n %^G \n" :tree-type month ) @@ -147,16 +154,16 @@ \ Frieder Schlesier") ("m" "Schedule a meeting" entry - (file+headline "~/Documents/Org/tasks.org") + (file+headline "~/Documents/Org/inbox.org") "* MEETING %?\n SCHEDULED: %^T\n %a" ) ("p" "Schedule a phone call" entry - (file+headline "~/Documents/Org/tasks.org") + (file+headline "~/Documents/Org/inbox.org") "* PHONE %?\n SCHEDULED: %^T\\n %a" ) ("a" "Articles: keep notes of online articles" entry - (file+datetree "~/Documents/Org/journal.org") + (file+olp+datetree "~/Documents/Org/journal.org") "* %? \n%x \n %u\n- $?" :tree-type month :kill-buffer t @@ -165,7 +172,108 @@ ) #+end_src -** TeX and research +** extra + +#+begin_src emacs-lisp + ;; active Babel languages + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (emacs-lisp . t) + (dot . t))) +#+end_src +* Configure =Org-Roam= :noexport: +#+begin_src emacs-lisp :tangle no + ;; ;; Setting the storage directory: + ;; ;; Stores org-roam data in a subdirectory under the emacs directory + ;; (customize-set-variable 'org-roam-database-connector "sqlite-builtin") + ;; (customize-set-variable 'org-roam-directory (file-truename "~/org-roam")) + + (use-package org-roam + :ensure t + :load-path "~/src/org-roam/" + :custom + (org-roam-directory (file-truename "~/org-roam/")) + :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) + (setq 'org-roam-database-connector "sqlite-builtin") + + ;; ;; If you're using a vertical completion framework, you might want a + ;; ;; more informative completion interface: + ;; (when (or (bound-and-true-p fido-vertical-mode) + ;; (bound-and-true-p icomplete-vertical-mode) + ;; (bound-and-true-p vertico)) + ;; (customize-set-variable 'org-roam-node-display-template + ;; (concat "${title:*} " + ;; (propertize "${tags:10}" 'face 'org-tag)))) + ) + + ;; ;; suggested keymap based on example from project documentation + ;; (keymap-global-set "C-c r l" #'org-roam-buffer-toggle) + ;; (keymap-global-set "C-c r f" #'org-roam-node-find) + ;; (keymap-global-set "C-c r g" #'org-roam-graph) + ;; (keymap-global-set "C-c r i" #'org-roam-node-insert) + ;; (keymap-global-set "C-c r c" #'org-roam-capture) + ;; ;(keymap-global-set "C-c r j" . org-roam-dailies-capture-today) + ;; ;(org-roam-db-autosync-mode) +#+end_src + +** And =org-roam-ui= :noexport: +#+begin_src emacs-lisp :tangle no + (use-package org-roam-ui + :after org-roam + ;; normally we'd recommend hooking orui after org-roam, but since + ;; org-roam does not have a hookable mode anymore, you're advised to + ;; pick something yourself if you don't care about startup time, use + ;; :hook (after-init . org-roam-ui-mode) + :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 t)) +#+end_src + +* Denote +#+begin_src emacs-lisp +(setq org-directory "~/Documents/Org/denotes/") + (use-package denote + :bind + ("C-c n n" . 'denote) + ("C-c n f" . 'denote-open-or-create) + ;; ("C-c n f" . 'my/project-org-file-file) + ("C-c n k" . 'denote-keywords-add) ;; update file name automatically + ("C-c n K" . 'denote-keywords-remove) ;; update file name automatically + ("C-c n u" . 'denote-rename-file-using-front-matter) + ("C-c n l" . 'denote-link-find-backlink) + ("C-c n r" . 'my/denote-random-note) + :init + (setq denote-directory (expand-file-name org-directory)) + :config + (setq denote-known-keywords '("emacs")) + (setq denote-prompts '(subdirectory title)) + (setq denote-excluded-directories-regexp ".attachment") + + ;; Makes the denote links different from usual link. + (set-face-attribute 'denote-faces-link + nil :foreground "magenta" :inherit 'link) + + ;; Remove the date and the identifier. They are duplicated with the file name. + ;; I want to remove filetags too but denote-keyword-* need that. + (setq denote-org-front-matter "#+title: %1$s\n#+filetags: %3$s\n") + + (add-hook 'dired-mode-hook #'denote-dired-mode)) +#+end_src +* TeX and research - Write a CV in org-mode: https://titan-c.gitlab.io/org-cv/ cloned to Path =~/src/org-cv=