emacs.d/bundle/bundle--org.el

561 lines
23 KiB
EmacsLisp
Raw Normal View History

2021-12-15 14:14:10 +01:00
(use-package org
2021-12-17 19:23:22 +01:00
:ensure nil
2024-08-17 11:01:42 +02:00
:hook ((org-mode . turn-on-auto-fill))
2021-12-17 19:23:22 +01:00
:init (org-clock-persistence-insinuate)
:bind
(("C-c l" . org-store-link)
("C-c a" . org-agenda)
("C-c c" . org-capture)
("C-c b" . org-switchb))
2021-12-15 14:14:10 +01:00
:init
(org-babel-lob-ingest "~/.emacs.d/library-of-babel.org")
(setq org-capture-templates '())
2021-12-15 14:14:10 +01:00
:custom
2023-01-22 20:04:28 +01:00
(abbrev-suggest t)
2024-08-02 17:49:00 +02:00
(org-hide-block-startup t)
2022-01-24 09:01:40 +01:00
(org-hide-emphasis-markers nil)
2021-12-15 14:14:10 +01:00
(org-default-notes-file "notes.org")
(org-insert-mode-line-in-empty-file t)
(org-adapt-indentation nil)
(org-agenda-prefix-format
'((agenda . " %i %-12:c%?-12t%-6e% s")
(todo . " %i %-12:c %-6e")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(org-agenda-dim-blocked-tasks nil)
(org-agenda-inhibit-startup nil)
2022-10-31 08:05:37 +01:00
(org-agenda-span 14)
2021-12-15 14:14:10 +01:00
(org-agenda-start-on-weekday 1)
(org-agenda-include-diary t)
(org-clock-out-remove-zero-time-clocks t)
(org-clock-persist t)
(org-clock-rounding-minutes 30)
(org-confirm-babel-evaluate nil)
(org-duration-format (quote h:mm))
(org-export-dispatch-use-expert-ui nil)
(org-export-default-language "en")
(org-export-with-smart-quotes t)
(org-export-with-emphasize t)
(org-export-with-special-strings t)
(org-export-with-fixed-width t)
(org-export-with-timestamps nil)
(org-export-preserve-breaks nil)
(org-export-with-sub-superscripts nil)
(org-export-with-archived-trees nil)
(org-export-with-author t)
(org-export-with-broken-links t)
(org-export-with-clocks nil)
(org-export-with-creator nil)
(org-export-with-drawers nil)
(org-export-with-date t)
2023-06-12 19:56:36 +02:00
(org-export-with-entities t)
(org-export-with-email t)
(org-export-with-footnotes t)
(org-export-headline-levels 3)
(org-export-with-inlinetasks nil)
(org-export-with-section-numbers t)
(org-export-with-planning nil)
(org-export-with-priority nil)
(org-export-with-properties nil)
(org-export-with-statistics-cookies nil)
(org-export-with-tags nil)
(org-export-with-tasks nil)
(org-export-with-latex t)
(org-export-time-stamp-file nil)
(org-export-with-title t)
(org-export-with-toc t)
(org-export-with-todo-keywords nil)
(org-export-with-tables t)
(org-export-date-timestamp-format "%a, %d %b %Y %R %z")
(org-export-backends '(ascii html latex md odt texinfo))
2022-11-20 10:33:24 +01:00
(org-global-properties '(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00")))
2021-12-15 14:14:10 +01:00
(org-html-doctype "html5")
(org-html-html5-fancy t)
(org-log-done (quote time))
(org-refile-targets '((nil :maxlevel . 3)))
(org-startup-folded t)
(org-startup-truncated nil)
(org-src-fontify-natively t)
(org-src-tab-acts-natively t)
(org-src-window-setup 'other-window)
(org-time-stamp-rounding-minutes '(30 30))
(org-todo-keywords
2022-02-21 08:54:02 +01:00
'((sequence "TODO" "DOING(!)" "DONE(!)")
2022-05-06 20:28:37 +02:00
(sequence "RECRUIT" "INTERVIEW" "QDA" "DOC" "REVIEW")))
2021-12-15 14:14:10 +01:00
(org-use-property-inheritance nil)
2022-12-18 18:19:14 +01:00
(org-attach-store-link-p 'attached)
2023-09-30 09:11:00 +02:00
(org-agenda-custom-commands
'(("p" "Projects"
((tags "PROJECT")))))
2023-10-04 12:22:36 +02:00
(org-latex-packages-alist
'(("" "listings")
("" "booktabs")
("AUTO" "polyglossia" t ("xelatex" "lualatex"))
("" "grffile")
("" "unicode-math")
2023-12-13 21:30:14 +01:00
("" "xcolor")
2023-12-14 19:34:59 +01:00
("expansion,protrusion=true" "microtype")))
2023-10-04 12:22:36 +02:00
;; Define the process to convert Org to PDF using XeLaTeX
2023-12-14 12:45:21 +01:00
(org-latex-pdf-process '("latexmk -lualatex -shell-escape -quiet -f %f"))
2023-10-04 12:22:36 +02:00
;; Set the compiler to XeLaTeX
2023-12-14 13:16:44 +01:00
(org-latex-compiler "lualatex")
2023-10-04 12:22:36 +02:00
(org-latex-tables-booktabs t)
(org-latex-images-centered t)
2023-12-14 19:34:59 +01:00
;; Enable listings and other table-related features
(org-latex-listings t)
2023-10-04 12:22:36 +02:00
;; Customize the appearance of listings (source code blocks)
(org-latex-listings-options
2024-02-14 09:36:44 +01:00
'(("basicstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3
("showstringspaces" "false")
("keywordstyle" "\\color[rgb]{0.23, 0.26, 0.32}\\textbf") ; nord1
("commentstyle" "\\color[rgb]{0.26, 0.30, 0.37}") ; nord2
("stringstyle" "\\color[rgb]{0.18, 0.20, 0.25}") ; nord0
("frame" "single")
("numbers" "left")
("numbersep" "5pt")
("numberstyle" "\\ttfamily\\color[rgb]{0.30, 0.34, 0.42}") ; nord3
("keepspaces" "true")
("showspaces" "false")
("showstringspaces" "false")
("showtabs" "false")
("breaklines" "true")
("breakatwhitespace" "false")
("tabsize" "2")
("columns" "fullflexible")))
2023-10-04 12:22:36 +02:00
(org-latex-inputenc-alist '((\"utf8\" . \"utf8x\")))
2021-12-15 14:14:10 +01:00
:config
2023-10-07 16:14:08 +02:00
(if (eq system-type 'windows-nt)
2023-10-04 12:22:36 +02:00
(setq org-babel-python-command "python")
(setq org-babel-python-command "python3"))
2023-03-25 10:31:04 +01:00
(setq time-stamp-active t
2023-10-19 15:43:47 +02:00
time-stamp-start "#\\+[dD][aA][tT][eE]: [\t]*"
2023-03-25 10:31:04 +01:00
time-stamp-end "$"
2023-12-14 19:38:31 +01:00
time-stamp-inserts t
2024-02-19 12:05:54 +01:00
time-stamp-format "[%Y-%m-%d %H:%M]")
2023-03-25 10:31:04 +01:00
(add-hook 'before-save-hook 'time-stamp nil)
2023-10-02 09:42:55 +02:00
;; (when (eq system-type 'windows-nt)
;; (setq org-babel-sqlite3-command "c:/msys64/ucrt64/bin/sqlite3.exe"))
2021-12-15 14:14:10 +01:00
(org-babel-do-load-languages
'org-babel-load-languages
2024-08-03 15:25:12 +02:00
'((emacs-lisp . t)
(lisp . t)
(gnuplot . t)
(python . t)
(sqlite . t)
(shell . t)
(plantuml . t)
(C . t)
(js . t)
(scheme . t)))
2022-05-06 19:31:15 +02:00
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-log-mode-colorize-block ()
"Set different line spacing based on clock time duration."
(save-excursion
(let* ((colors (cl-case (alist-get 'background-mode (frame-parameters))
('light (list "#d8dee9" "#e5e9f0" "#eceff4"))
('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead"))))
pos
duration)
(nconc colors colors)
(goto-char (point-min))
(while (setq pos (next-single-property-change (point) 'duration))
(goto-char pos)
(when (and (not (equal pos (point-at-eol)))
(setq duration (org-get-at-bol 'duration)))
;; larger duration bar height
(let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30))))
(ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
(overlay-put ov 'face `(:background ,(car colors) :foreground "black"))
(setq colors (cdr colors))
(overlay-put ov 'line-height line-height)
(overlay-put ov 'line-spacing (1- line-height))))))))
(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block))
2023-10-04 12:22:36 +02:00
;; Define custom LaTeX class with specific formatting
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("koma-general"
"\\documentclass[a4paper,10pt,captions=tableheading,twoside=false]{scrartcl}
2023-12-14 13:17:02 +01:00
\\linespread{1.25}
2023-12-14 19:30:00 +01:00
% ~/.emacs.d/texmf/tex/latex/mycustomstyles/
\\usepackage{komageneral}"
2023-10-04 12:22:36 +02:00
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(setq org-latex-default-class "koma-general"))
2023-09-25 16:48:58 +02:00
(setq org-html-protect-char-alist
'(("&" . "&amp;")
("<" . "&lt;")
(">" . "&gt;")
(":lambda:" . "&#955;")
(":python:" . "&#128013;")
(":whale:" . "&#128051;")
(":turtle:" . "&#x1f422;")
(":dash:" . "&#x1f4a8;")
(":party:" . "&#129395;")
(":see-no-evil:" . "&#128584;")
(":cloud:" . "&#9729;&#65039;")
(":abacus:" . "&#129518;")
(":desktop:" . "&#128421;&#65039;")
(":rocket:" . "&#128640;")
(":unicorn:" . "&#129412;")
(":recycling:" . "&#9851;")
(":crystalball:" . "&#128302;")
(":photography:" . "&#128247;")
(":money:" . "&#128181;")
(":-)" . "&#x1f60a;")
(":-(" . "&#x1f61e;")))
2023-09-28 15:18:06 +02:00
(defun mk/link-to-current-task ()
"Return an Org link to the current clocked-in task, if any, or prompt for manual entry."
(if (org-clock-is-active)
(with-current-buffer (marker-buffer org-clock-marker)
(save-excursion
(goto-char org-clock-marker)
2023-09-28 16:03:43 +02:00
(format ":TASK_ID: [[id:%s][%s]]" (org-id-get) (org-get-heading t t))))
2023-09-28 15:18:06 +02:00
(let ((manual-id (read-string "Enter Task ID (leave empty if not applicable): ")))
(unless (string-empty-p manual-id)
2024-04-06 12:07:09 +02:00
(format ":TASK_ID: [[id:%s][Task]]\n" manual-id)))))
2023-09-28 15:18:06 +02:00
2023-09-29 19:49:24 +02:00
;; Note Capture Template
;; Purpose: To capture general notes. These notes can optionally be linked to a currently clocked-in task.
;; Fields: Heading, optional task link, initial content, and a timestamp.
(add-to-list 'org-capture-templates
2024-04-06 12:07:09 +02:00
`("n" "Note" entry (file "notes.org")
2023-09-29 19:49:24 +02:00
,(concat "* %? :NOTE:\n"
":PROPERTIES:\n"
2024-04-06 12:07:09 +02:00
":ID: %(org-id-new)\n"
"%(mk/link-to-current-task)"
2023-09-29 19:49:24 +02:00
":END:\n"
"Entered on: %U\n")))
;; Task Capture Template
;; Purpose: To capture tasks and automatically assign a unique ID to each task.
;; Fields: Heading, unique ID, timestamp, and link to where the capture was made.
(add-to-list 'org-capture-templates
2023-09-28 15:18:06 +02:00
`("t" "Task" entry (file "agenda/tasks.org")
2023-10-09 14:55:22 +02:00
,(format "* TODO %%? :TASK:\n:PROPERTIES:\n:ID: %s\n:Project: %%^{Project}\n:END:\nEntered on %%U\n" (org-id-new))))
2023-09-28 15:18:06 +02:00
2023-09-29 19:49:24 +02:00
;; Journal Capture Template
;; Purpose: To capture end-of-day reflections.
;; Fields: Heading, timestamp, and prompts for what went well, what could be improved, and focus for tomorrow.
2023-09-25 16:39:13 +02:00
(add-to-list 'org-capture-templates
2023-09-28 15:18:06 +02:00
'("j" "Journal" entry (file+olp+datetree "agenda/journal.org")
2024-01-28 16:08:37 +01:00
"* %T - End of Day Reflection :JOURNAL:\n- Was ist heute gut gelaufen?\n %?\n- Was könnte verbessert werden?\n \n- Worauf konzentriere ich mich morgen?\n "
2023-09-25 16:39:13 +02:00
:empty-lines 1))
2023-09-28 15:18:06 +02:00
2023-09-29 19:49:24 +02:00
;; Appointment Capture Template
;; Purpose: To capture important events and appointments.
;; Fields: Heading, timestamp.
(add-to-list 'org-capture-templates
2023-10-09 15:30:54 +02:00
'("a" "Appointment" entry (file "agenda/appt.org")
"* %? \n%^{Date}t\n"))
2023-09-28 15:38:49 +02:00
2023-09-29 19:49:24 +02:00
;; Meeting Capture Template
;; Purpose: To capture meeting notes and automatically start a clock for time tracking.
;; Fields: Topic, timestamp, and additional notes.
(add-to-list 'org-capture-templates
2023-09-25 16:39:13 +02:00
'("m" "Meeting" entry (file "agenda/meetings.org")
"* %^{Topic} \n%T\n%?"
:clock-in t
:empty-lines 1))
2023-09-28 15:38:49 +02:00
2023-09-29 19:49:24 +02:00
;; Log Capture Template
;; Purpose: To capture activities in a chronological order and automatically start a clock for time tracking.
;; Fields: Timestamp, activity description.
(add-to-list 'org-capture-templates
2024-03-13 16:49:00 +01:00
'("l" "Log" entry (file+olp+datetree "logbook.org")
2023-09-25 16:39:13 +02:00
"* %T - %^{Activity} :LOG:\n%?"
:clock-in t
:empty-lines 1))
2023-09-29 19:49:24 +02:00
;; UTM Parameters Capture Template
;; Purpose: To capture UTM parameters for marketing tracking.
;; Fields: Campaign name, source, medium, term, and content.
2023-09-08 16:38:57 +02:00
(add-to-list 'org-capture-templates
'("u" "UTM Parameters" entry (file+headline "utm.org" "UTM Parameters")
"* %^{Campaign Name}\n:PROPERTIES:\n:Source: %^{utm_source}\n:Medium: %^{utm_medium}\n:Term: %^{utm_term}\n:Content: %^{utm_content}\n:END:\n"))
2023-09-29 19:49:24 +02:00
;; Bookmark Capture Template
;; Purpose: To capture bookmarks with tags and a timestamp.
;; Fields: URL, tags, timestamp.
2023-09-14 17:45:45 +02:00
(add-to-list 'org-capture-templates
'("b" "Bookmark" table-line (file+headline "bookmarks.org" "Bookmarks")
2023-09-25 16:39:13 +02:00
"| %^{URL} | %^{Tags} | %u |" :prepend t))
2023-09-14 17:45:45 +02:00
2023-09-29 19:49:24 +02:00
;; Code Snippet Capture Template
;; Purpose: To capture code snippets and specify the programming language.
;; Fields: Code snippet, language specification.
2023-09-25 16:39:13 +02:00
(add-to-list 'org-capture-templates
'("c" "Code Snippet" entry (file+headline "code.org" "Snippets")
"* %?\n#+begin_src %^{language}\n%i\n#+end_src"))
2023-09-14 17:45:45 +02:00
2023-09-29 19:49:24 +02:00
;; Capture Templates for Interviews
;;
;; The following capture templates are designed to facilitate the collection
;; of questions and insights for user interviews. Given the importance of
;; user-centered design in experience architecture, these templates aim to
;; streamline the preparation process for interviews.
;; Interview Sub-menu
;;
;; This entry serves as a sub-menu for all interview-related capture templates.
(add-to-list 'org-capture-templates
'("i" "Interviews"))
;; How Might We (HMW) Template
;;
;; This template is designed to capture "How Might We" questions that are often
;; used to frame problems and opportunities in user interviews. These questions
;; can be crucial for guiding the interview in a direction that yields
;; actionable insights.
2023-09-28 15:18:06 +02:00
(add-to-list 'org-capture-templates
2023-09-29 19:49:24 +02:00
'("ih" "How Might We" entry (file+headline "interviews.org" "HMW Questions")
2023-10-17 14:50:17 +02:00
"* WKW/HMW %? :HMW:\n%U\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Context: %^{Context}\n:END:"))
2023-09-14 17:45:45 +02:00
2023-09-29 19:49:24 +02:00
;; Interview Question Template
;;
;; Use this template to quickly capture questions that you intend to ask during
;; user interviews. The template prompts for the topic of the interview and
;; the project it is associated with, allowing for easy categorization and
;; retrieval later.
2023-09-29 17:29:22 +02:00
(add-to-list 'org-capture-templates
2023-09-29 19:49:24 +02:00
'("iq" "Interview Question" entry (file+headline "interviews.org" "Interview Questions")
2023-09-29 17:29:22 +02:00
"* %^{Interview Topic} :INTERVIEW:\n:PROPERTIES:\n:Project: %^{Project Name}\n:Date: %T\n:END:\n- %?\n"))
2023-09-30 11:47:00 +02:00
;; User Interview Quotes Capture Template
;; Purpose: To capture important quotes from user interviews.
;; Fields: Quote, Interviewee, Timestamp in Video, Project, Context
(add-to-list 'org-capture-templates
'("io" "Quote from User Interview" entry (file+headline "interviews.org" "Quotes")
"* %^{Quote} :QUOTE:\n:PROPERTIES:\n:Interviewee: %^{Interviewee}\n:Timestamp: %^{Timestamp in Video}\n:Project: %^{Project}\n:Context: %^{Context}\n:END:\n"))
2023-09-29 19:49:24 +02:00
;; Capture Templates for Project Management and Achievements
;;
;; These templates are designed to facilitate the tracking of project details
;; and individual achievements. Given the focus on agile methodologies and
;; continuous improvement, these templates aim to provide a structured way
;; to capture essential information.
;; Project Template
;;
;; This template captures the essential details of a new project. It prompts
;; for the project name, start date, and end date, and provides sections for
;; outlining the project's objectives and challenges. Each project is assigned
;; a unique ID for easy referencing.
2023-09-29 17:29:22 +02:00
(add-to-list 'org-capture-templates
2023-09-30 09:11:00 +02:00
`("p" "Project" entry (file "agenda/projects.org")
2023-09-29 17:29:22 +02:00
,(format "* %%^{Project Name} :PROJECT:\n:PROPERTIES:\n:ID: %s\n:Start Date: %%T\n:End Date: %%^{End Date}\n:END:\n** Objective\n%%?\n** Challenges\n- [ ] %%^{Challenge 1}\n- [ ] %%^{Challenge 2}\n" (org-id-new))))
2023-09-29 19:49:24 +02:00
;; Achievement Template
;;
;; This template is designed to capture individual achievements. It prompts for
;; the title of the achievement, the project it is associated with, and the date.
;; Additionally, it provides fields for describing the achievement, its impact,
;; and any associated tasks. This can be particularly useful for end-of-year
;; reviews or for maintaining a portfolio of accomplishments.
2023-09-29 12:34:21 +02:00
(add-to-list 'org-capture-templates
2023-10-04 12:22:36 +02:00
`("v" "Achievement" entry (file+olp+datetree "achievements.org")
2023-09-29 19:49:24 +02:00
,(concat "* %^{Achievement Title} :ACHIEVEMENT:\n"
":PROPERTIES:\n"
":Project: %^{Project}\n"
":Date: %T\n"
":END:\n"
"- Description: %?\n"
"- Impact: %^{Impact}\n"
"- Associated Tasks: %^{Tasks}\n")))
2023-09-29 12:34:21 +02:00
2023-09-30 09:11:00 +02:00
(add-to-list 'org-capture-templates
'("A" "Accounting"))
;; Expense Tracking
;; Purpose: To capture individual expenses for accounting in a table.
;; Fields: Amount, Category, Note, Date
(add-to-list 'org-capture-templates
'("Ae" "Expense" table-line (file+headline "accounting.org" "Expenses")
"| %U | %^{Amount} | %^{Category} | %? |"))
;; Income Tracking
;; Purpose: To capture instances of income for accounting in a table.
;; Fields: Amount, Source, Date
(add-to-list 'org-capture-templates
'("Ai" "Income" table-line (file+headline "accounting.org" "Income")
"| %U | %^{Amount} | %^{Source} | %? |"))
;; Invoice Tracking
;; Purpose: To capture invoices sent for services or products in a table.
;; Fields: Client, Amount, Due Date
(add-to-list 'org-capture-templates
'("AI" "Invoice" table-line (file+headline "accounting.org" "Invoices")
"| %T | %^{Client} | %^{Amount} | %^{Due Date} | %? |"))
;; Budget Planning
;; Purpose: To capture budget plans for personal or business accounting in a table.
;; Fields: Estimated Income, Estimated Expenses
(add-to-list 'org-capture-templates
`("Ab" "Budget" table-line (file+headline "accounting.org" "Budget")
,(concat "| " (format-time-string "%Y") " | " (format-time-string "%B") " | %^{Estimated Income} | %^{Estimated Expenses} | %? |")))
;; Investment Tracking
;; Purpose: To capture investment details for accounting in a table.
;; Fields: Type, Amount, Notes
(add-to-list 'org-capture-templates
'("Av" "Investment" table-line (file+headline "accounting.org" "Investments")
"| %U | %^{Type} | %^{Amount} | %? |"))
2023-09-30 10:04:50 +02:00
;; Stock Recommendation Capture Template
;; Purpose: To capture stock recommendations for potential investment.
;; Fields: Stock Symbol, Recommender, Notes, Date
(add-to-list 'org-capture-templates
'("s" "Stock Recommendation" entry (file+headline "stocks.org" "Stock Recommendations")
2023-10-02 09:41:08 +02:00
"* %^{Stock Name} :STOCK:\n:PROPERTIES:\n:Date: %T\n:WKN: %^{WKN}\n:ISIN: %^{ISIN}\n:END:\n%?"))
2023-09-30 10:04:50 +02:00
2024-01-11 21:00:00 +01:00
(add-to-list 'org-capture-templates
'("B" "Bücherliste" table-line
(file+headline "books.org" "Meine Bücherliste")
"| %^{Buchtitel} | %^{Autor} | %^{Status||Geplant|In Bearbeitung|Fertig} | %U |" :kill-buffer t))
2023-09-28 16:52:40 +02:00
(require 'request)
(defun fetch-gitlab-issue-and-capture ()
(interactive)
(let ((project-id (read-string "Enter GitLab Project ID: "))
(issue-id (read-string "Enter GitLab Issue ID: "))
(gitlab-token (getenv "GITLAB_TOKEN")))
(unless gitlab-token
(error "GITLAB_TOKEN environment variable not set"))
(request
2023-09-29 19:49:24 +02:00
(format "https://code.siemens.com/api/v4/projects/%s/issues/%s" project-id issue-id)
:headers `(("Private-Token" . ,gitlab-token))
:parser 'json-read
:success (cl-function
(lambda (&key data &allow-other-keys)
(org-capture nil "g")
(let ((title (assoc-default 'title data))
(description (assoc-default 'description data)))
(insert (format "%s\n%s" title description))))))))
2023-09-28 16:52:40 +02:00
(add-to-list 'org-capture-templates
'("g" "GitLab Issue" entry (file "gitlab_issues.org")
"* %?"))
2023-09-29 19:49:24 +02:00
;; (global-set-key (kbd "C-c g") 'fetch-gitlab-issue-and-capture)
2023-09-28 16:52:40 +02:00
2022-05-06 19:31:15 +02:00
(use-package org-roam
:after org
:init
2023-10-04 12:22:36 +02:00
(setq org-roam-db-autosync-mode t)
2022-05-06 19:31:15 +02:00
(setq org-roam-v2-ack t)
(setq org-roam-db-location "~/org-roam.db")
2022-05-06 19:31:15 +02:00
(require 'org-roam-dailies)
:bind (("C-c r l" . org-roam-buffer-toggle)
("C-c r f" . org-roam-node-find)
("C-c r g" . org-roam-graph)
("C-c r i" . org-roam-node-insert)
("C-c r c" . org-roam-capture)
("C-c r j" . org-roam-dailies-map)
:map org-roam-dailies-map
("t" . org-roam-dailies-capture-today)
("y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow)
:map org-mode-map
2022-05-06 20:28:37 +02:00
("C-M-i" . completion-at-point))
:custom
(org-roam-completion-everywhere nil)
2022-05-06 20:28:37 +02:00
(org-roam-dailies-capture-templates
'(("d" "default" entry "* %<%R> %?"
:if-new (file+head "%<%F>.org" "#+title: %<%F>\n"))))
(org-roam-capture-templates
'(("d" "default" plain
"%?"
2023-12-11 19:09:20 +01:00
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
2022-05-06 20:28:37 +02:00
:unnarrowed t)
2023-12-11 19:09:20 +01:00
("r" "Research" plain
"* Hypothesis:\n%?\n* Methodology:\n* Results:\n* Conclusions:\n"
:if-new (file+head "research/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("m" "Meeting" plain
"* Participants:\n%?\n* Discussion topics:\n* Action points:\n"
:if-new (file+head "meetings/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("p" "Project" plain
"* Goals:\n%?\n* Milestones:\n* Resources:\n"
:if-new (file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
2023-12-11 19:10:32 +01:00
("l" "Literature" plain
2023-12-11 19:09:20 +01:00
"* Authors:\n%?\n* Main theses:\n* Own thoughts:\n"
2023-12-11 19:10:32 +01:00
:if-new (file+head "literature/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
2022-05-06 20:28:37 +02:00
:unnarrowed t))))
2021-12-15 17:29:07 +01:00
2021-12-15 17:32:59 +01:00
(use-package org-tree-slide
2021-12-17 16:29:49 +01:00
:bind ("<f5>" . org-tree-slide-mode)
2021-12-15 17:32:59 +01:00
:custom
(org-image-actual-width nil))
2021-12-15 17:40:15 +01:00
(use-package org-web-tools
2022-05-06 19:31:15 +02:00
:defer t
2021-12-15 17:40:15 +01:00
:custom (org-web-tools-pandoc-sleep-time 0.4))
2022-05-06 20:28:37 +02:00
;; (use-package ob-go
;; :after org)
2022-05-06 19:31:15 +02:00
(use-package ox-reveal
:after org)
2023-01-07 11:25:47 +01:00
;; (use-package ox-pandoc
;; :after org
;; :custom
;; (org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex"))))
2022-12-11 13:38:40 +01:00
2022-05-06 19:31:15 +02:00
;; (defun me/write-readme-md-on-save ()
;; ;; when README.org, also write README.md on save
;; (when (string-match "README" (buffer-file-name))
;; (make-local-variable 'after-save-hook)
;; (add-hook 'after-save-hook
;; (lambda () (let ((outfile (org-export-output-file-name ".md")))
;; (org-export-to-file 'md outfile))))))
2022-01-13 20:01:00 +01:00
;; (add-hook 'org-mode-hook 'me/write-readme-md-on-save)
2022-08-12 21:04:13 +02:00
2023-09-13 10:00:11 +02:00
;; (use-package ob-go
;; :after org
;; :config
;; (append '((go . t)) org-babel-load-languages))
2022-08-12 21:04:13 +02:00
(use-package ob-http
:after org
:config
(append '((http . t)) org-babel-load-languages))
;; (use-package ob-racket
;; :after org
;; :pin manual
;; :config
;; (append '((racket . t) (scribble . t)) org-babel-load-languages))
2023-01-29 09:33:07 +01:00
2023-09-13 10:00:11 +02:00
;; (use-package ox-rss
;; :after org)
2023-10-23 18:11:11 +02:00
;; (use-package ob-restclient
;; :after org
;; :config
;; (append '((restclient . t)) org-babel-load-languages))
(defun mk/extract-headlines-by-tag (tag)
2024-03-01 11:03:38 +01:00
"Extract headlines and their content from current buffer by TAG."
(interactive "sEnter tag: ")
2024-03-01 11:03:38 +01:00
(save-excursion
2024-03-07 09:10:48 +01:00
(let ((result-buffer (generate-new-buffer (concat "*Extracted Headlines " tag "*"))))
(with-current-buffer result-buffer
(org-mode)
2024-03-07 09:10:48 +01:00
(insert "* Extracted Headlines by Tag: " tag " *\n\n"))
2024-03-05 19:06:08 +01:00
(org-element-map (org-element-parse-buffer) 'headline
(lambda (headline)
(when (member tag (org-element-property :tags headline))
(with-current-buffer result-buffer
(insert (org-element-interpret-data headline) "\n")))))
2024-03-01 11:03:38 +01:00
(pop-to-buffer result-buffer))))