add first draft for org-mode config

Signed-off-by: Frieder Schlesier <frieder@fschl.de>
This commit is contained in:
Frieder Schlesier 2023-07-17 00:09:08 +02:00
parent 414ed1d703
commit c3b02f62fd
3 changed files with 286 additions and 47 deletions

View File

@ -10,6 +10,11 @@
(tool-bar-mode -1)
(scroll-bar-mode -1)
(defvar fschl-org-file (expand-file-name "fschl-org.el" user-emacs-directory))
(when (and fschl-org-file
(file-exists-p fschl-org-file))
(load fschl-org-file nil :nomessage))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@ -60,7 +65,7 @@
("stable" . 70)
("melpa" . 0)))
'(package-selected-packages
'(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))
'(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))
'(scroll-conservatively 101)
'(scroll-margin 0)
'(scroll-preserve-screen-position t)

View File

@ -1,9 +1,57 @@
(setq org-roam-directory (file-truename "~/org-roam"))
(org-roam-db-autosync-mode)
;;; fschl-org.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*-
;; This file is generated from fschl-org.org. If you want to edit the
;; configuration, DO NOT edit fschl-org.el, edit fsch-org.org, instead.
(require 'org-projectile)
;;(add-to-list 'package-selected-packages 'org-roam)
(add-to-list 'package-selected-packages 'ox-latex)
(add-to-list 'package-selected-packages 'ox-koma-letter)
(add-to-list 'package-selected-packages 'ox-moderncv)
(package-install-selected-packages :noconfirm)
;;(setq org-roam-directory (file-truename "~/org-roam"))
;;(org-roam-db-autosync-mode)
(keymap-global-set "C-c c" #'org-capture)
(keymap-global-set "C-c l" #'org-store-link)
(global-set-key (kbd "<f8>") #'org-agenda)
(global-set-key (kbd "<f7>") #'org-cycle-agenda-files)
(setq org-default-notes-file "~/Documents/Org/tasks.org")
(setq org-agenda-files
(quote ("~/Documents/Org/tasks.org"
"~/Documents/Org/journal.org"
"~/Documents/Org/private.org"
"~/Documents/Org/projects.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-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))))
(eval-after-load 'ox '(require 'ox-koma-letter))
(eval-after-load 'ox '(require 'ox-moderncv))
(eval-after-load 'ox-koma-letter
'(progn
(add-to-list 'org-latex-classes
@ -18,22 +66,6 @@
(setq org-koma-letter-default-class "Brief-de-modern")))
(setq org-default-notes-file "~/Documents/Org/tasks.org")
(setq org-agenda-files
(quote ("~/Documents/Org/tasks.org"
"~/Documents/Org/journal.org"
"~/Documents/Org/private.org"
"~/Documents/Org/projects.org"
"~/Documents/Org/birthdays.org")))
(defun fschl/create-org-letter ()
"Create a new letter in ~/Documents/letters/ with filename and date"
(interactive)
(let ((name (read-string "Filename: ")))
(expand-file-name (format "%s.org" name) "~/Documents/letters/") ))
;; https://orgmode.org/manual/Template-elements.html
;; https://orgmode.org/manual/Template-expansion.html
(setq org-capture-templates
'(("t" "todo list item" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
@ -51,41 +83,39 @@
"* TODO %?\n SCHEDULED: %^T \n %^L \n"
:tree-type month
)
("l" "letter to Documents/letters/<datetime.org>"
entry (file fschl/create-org-letter)
"* Preamble :noexport:
# #+TITLE: ?
# #+DATE:
#+SUBJECT: Betreff des Briefs
#+LCO: Absender-Frieder
# #+LCO: Absender-Marcelle
# #+LCO: Absender-FamilieSchlesier
#+LCO: Brief-de-modern
#+STARTUP: showall
* To-address :to:
# * From :from:
* Sehr geehrte Damen und Herren,
?
* Mit freundlichen Grüßen, :closing:
Frieder Schlesier"
)
; ("l" "letter to Documents/letters/<datetime.org>"
; entry (file fschl/create-org-letter)
; "* Preamble :noexport:
;# #+TITLE: ?
;# #+DATE:
;
;#+SUBJECT: Betreff des Briefs
;
;#+LCO: Absender-Frieder
;# #+LCO: Absender-Marcelle
;# #+LCO: Absender-FamilieSchlesier
;#+LCO: Brief-de-modern
;#+STARTUP: showall
;
;* To-address :to:
;
;# * From :from:
;
;* Sehr geehrte Damen und Herren,
;?
;
;* Mit freundlichen Grüßen, :closing:
;
;Frieder Schlesier"
; )
("m" "Schedule a meeting" entry
(file+headline "~/Documents/Org/tasks.org")
"* MEETING %?\n SCHEDULED: %^T\n %a"
)
("p" "Schedule a phone call" entry
(file+headline "~/Documents/Org/tasks.org")
"* PHONE %?\n SCHEDULED: %^T\\n %a"
)
("a" "Articles: keep notes of online articles"
entry
(file+datetree "~/Documents/Org/journal.org")
@ -99,3 +129,15 @@ Frieder Schlesier"
(setq org-ref-default-bibliography '("~/Documents/references/references.bib")
org-ref-pdf-directory "~/Documents/references/"
org-ref-bibliography-notes "~/Documents/references/notes.org")
;; Tangle the code blocks to fschl-org.el on save.
(defun org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "fschl-org.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)))

192
fschl-org.org Normal file
View File

@ -0,0 +1,192 @@
#+title: Setup Fschl Org Configuration
#+PROPERTY: header-args:emacs-lisp :tangle ./fschl-org.el :mkdirp yes
* Basic configuration
** Additional Packages
#+begin_src emacs-lisp
;;; fschl-org.el -- Fschl Crafted Emacs user customization file -*- lexical-binding: t; -*-
;; This file is generated from fschl-org.org. If you want to edit the
;; configuration, DO NOT edit fschl-org.el, edit fsch-org.org, instead.
;;(add-to-list 'package-selected-packages 'org-roam)
(add-to-list 'package-selected-packages 'ox-latex)
(add-to-list 'package-selected-packages 'ox-koma-letter)
(add-to-list 'package-selected-packages 'ox-moderncv)
(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 c" #'org-capture)
(keymap-global-set "C-c l" #'org-store-link)
(global-set-key (kbd "<f8>") #'org-agenda)
(global-set-key (kbd "<f7>") #'org-cycle-agenda-files)
#+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"
"~/Documents/Org/journal.org"
"~/Documents/Org/private.org"
"~/Documents/Org/projects.org"
"~/Documents/Org/birthdays.org")))
#+end_src
Add Week to Calendar
#+begin_src emacs-lisp
(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))
#+end_src
#+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
- https://orgmode.org/manual/Template-expansion.html
*** Export Letter
#+begin_src emacs-lisp
(eval-after-load 'ox '(require 'ox-koma-letter))
(eval-after-load 'ox '(require 'ox-moderncv))
(eval-after-load 'ox-koma-letter
'(progn
(add-to-list 'org-latex-classes
'("Brief-de-modern"
"\\documentclass\[Brief-de-modern\]\{scrlttr2\}
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]"))
;; \\usepackage[english]{babel}
;; \\setkomavar{frombank}{(1234)\\,567\\,890}
(setq org-koma-letter-default-class "Brief-de-modern")))
#+end_src
*** Capture Templates
#+begin_src emacs-lisp
(setq org-capture-templates
'(("t" "todo list item" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n SCHEDULED: %^T"
:tree-type month
)
("T" "todo list item with source" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n %a \n SCHEDULED: %^T \n %^G \n"
:tree-type month
)
("r" "Todo research some website/software" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n SCHEDULED: %^T \n %^L \n"
:tree-type month
)
; ("l" "letter to Documents/letters/<datetime.org>"
; entry (file fschl/create-org-letter)
; "* Preamble :noexport:
;# #+TITLE: ?
;# #+DATE:
;
;#+SUBJECT: Betreff des Briefs
;
;#+LCO: Absender-Frieder
;# #+LCO: Absender-Marcelle
;# #+LCO: Absender-FamilieSchlesier
;#+LCO: Brief-de-modern
;#+STARTUP: showall
;
;* To-address :to:
;
;# * From :from:
;
;* Sehr geehrte Damen und Herren,
;?
;
;* Mit freundlichen Grüßen, :closing:
;
;Frieder Schlesier"
; )
("m" "Schedule a meeting" entry
(file+headline "~/Documents/Org/tasks.org")
"* MEETING %?\n SCHEDULED: %^T\n %a"
)
("p" "Schedule a phone call" entry
(file+headline "~/Documents/Org/tasks.org")
"* PHONE %?\n SCHEDULED: %^T\\n %a"
)
("a" "Articles: keep notes of online articles"
entry
(file+datetree "~/Documents/Org/journal.org")
"* %? \n%x \n %u\n- $?"
:tree-type month
:kill-buffer t
:empty-lines-before 1)
)
)
#+end_src
** TODO not sure if we actually need this
#+begin_src emacs-lisp
(setq org-ref-default-bibliography '("~/Documents/references/references.bib")
org-ref-pdf-directory "~/Documents/references/"
org-ref-bibliography-notes "~/Documents/references/notes.org")
#+end_src
** Auto-tangle on save
Whenever you edit =init.org= in Emacs and save it, it updates =init.el= in
the same directory.
See the [[https://orgmode.org/manual/Extracting-Source-Code.html][Org Manual]] for details and alternatives.
#+begin_src emacs-lisp
;; Tangle the code blocks to fschl-org.el on save.
(defun org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "fschl-org.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)))
#+end_src