dotfiles/home/default/.config/doom/config.el

344 lines
12 KiB
EmacsLisp
Raw Normal View History

2023-06-18 07:14:39 -04:00
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
(setq user-full-name "John Doe"
user-mail-address "john@doe.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
2023-06-29 10:12:35 -04:00
(setq doom-variable-pitch-font (font-spec :family "Libertinus Serif" :size 13))
;;(setq doom-variable-pitch-font (font-spec :family "DejaVu Serif" :size 13))
2023-06-18 07:14:39 -04:00
;;
2023-06-18 07:14:39 -04:00
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
;(setq doom-theme 'doom-tomorrow-night)
2023-06-29 10:12:35 -04:00
;(setq doom-theme 'doom-one)
;(setq doom-theme 'doom-wilmersdorf)
2023-07-02 05:41:21 -04:00
;(setq doom-theme 'doom-plain-dark)
;(setq doom-theme 'doom-feather-dark)
;(setq doom-theme 'doom-monokai-ristretto)
2023-06-29 10:12:35 -04:00
;(setq doom-theme 'doom-plain)
(setq doom-theme 'doom-flatwhite)
2023-06-18 07:14:39 -04:00
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/notebook/")
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;; (after! PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
(after! org
2023-06-18 07:14:39 -04:00
;;; agenda files
2023-06-29 10:12:35 -04:00
(setq org-agenda-files '("~/housekeeping/calendar.org"
"~/notebook/ag/"
"~/notebook/refile.org"
"~/notebook/notes/events/birthdays.org"))
2023-06-18 07:14:39 -04:00
(setq org-log-done 'time)
(use-package! org-journal
:init
(setq org-journal-dir "~/diary"
org-journal-date-prefix "#+TITLE: "
org-journal-time-prefix "+ "
org-journal-date-format "%a, %Y-%m-%d"
org-journal-file-format "%Y-%m-%d.org"
)
)
(use-package! org-books
:init
(setq org-books-file "~/notebook/readinglist.org")
)
;; NOTIFICATIONS CONFIGURATION REFERENCE
;;; note : it's probably better to add this after
;;; setting org-agenda-files.
;;; use this under (!after org ...
;;; else it would't work
;
;(use-package! org-wild-notifier
; :defer t
; :init
; (add-hook 'doom-post-init-hook (org-wild-notifier-mode))
; :config
; (setq alert-default-style 'libnotify)
;;; set to libnotify or notifications or osx-notifier
; (setq org-wild-notifier-alert-time '(60 30))
;;; alert time defaults to '(10) if not set
; (setq org-wild-notifier-keyword-whitelist nil))
; (setq org-wild-notifier-keyword-blacklist '("DONE"))
2023-06-29 10:12:35 -04:00
2023-06-18 07:14:39 -04:00
(use-package! org-wild-notifier
:defer t
:init
(add-hook 'doom-post-init-hook (org-wild-notifier-mode))
:config
(setq alert-default-style 'libnotify)
2023-06-29 10:12:35 -04:00
(setq org-wild-notifier-alert-time '(10 0))
2023-06-18 07:14:39 -04:00
(setq org-wild-notifier-keyword-whitelist nil))
(setq org-wild-notifier-keyword-blacklist '("DONE"))
2023-08-04 11:32:05 -04:00
;; org-roam configurations
2023-08-04 11:32:05 -04:00
(use-package! org-roam
:ensure t
:custom
(setq org-roam-directory "~/notebook/roam/")
:config
(org-roam-setup))
(setq org-roam-capture-templates
'(("d" "default" plain "%?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)
;; main things
("l" "literature" plain "%?"
:if-new
(file+head "literature/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("p" "permanent" plain "%?"
:if-new
(file+head "permanent/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("f" "fleeting" plain "%?"
:if-new
(file+head "fleeting/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
;; other categories
("r" "reference" plain "%?"
:if-new
(file+head "reference/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("a" "article" plain "%?"
:if-new
(file+head "articles/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+filetags: :article:\n")
:immediate-finish t
:unnarrowed t)))
;(cl-defmethod org-roam-node-type ((node org-roam-node))
; "Return the TYPE of NODE."
; (condition-case nil
; (file-name-nondirectory
; (directory-file-name
; (file-name-directory
; (file-relative-name (org-roam-node-file node) org-roam-directory))))
; (error "")))
;(setq org-roam-node-display-template
; (concat "${type:15} ${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
;;; org-capture stuff
;;; examples: file:~/.emacs.d/modules/lang/org/config.el
; my location of the todo.org file
(setq +org-capture-todo-file "ag/todo.org")
(defvar +org-capture-refile-file "refile.org")
(setq +org-capture-refile-file
(expand-file-name +org-capture-refile-file org-directory))
; refile.org at the root of org-directory
;(add-to-list 'org-capture-templates
; '(("s" "Slipbox" entry (file "braindump/org/inbox.org")
; "* %?\n")
; ("t" "Personal todo" entry
; (file+headline +org-capture-todo-file "Inbox")
; "* [ ] %?\n%i\n%a" :prepend t)
; )
(setq org-capture-templates
'(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "todo")
"* [ ] %?\n%i\n%a" :prepend t)
("T" "Personal todo (no link)" entry
(file+headline +org-capture-todo-file "todo")
"* [ ] %?\n" :prepend t)
;;; i never use this
;("n" "Personal notes" entry
;(file+headline +org-capture-notes-file "Inbox")
;"* %u %?\n%i\n%a" :prepend t)
("r" "Personal refile file" entry
(file +org-capture-refile-file)
"* %u %?\n%i\n%a" :prepend t)
;; using org-journal atm, i will likely never use this
;("j" "Journal" entry
;(file+olp+datetree +org-capture-journal-file)
;"* %U %?\n%i\n%a" :prepend t)
;; Will use {project-root}/{todo,notes,changelog}.org, unless a
;; {todo,notes,changelog}.org file is found in a parent directory.
;; Uses the basename from `+org-capture-todo-file',
;; `+org-capture-changelog-file' and `+org-capture-notes-file'.
("p" "Templates for projects")
("pt" "Project-local todo" entry ; {project-root}/todo.org
(file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("pn" "Project-local notes" entry ; {project-root}/notes.org
(file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t)
("pc" "Project-local changelog" entry ; {project-root}/changelog.org
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
;; reference for function: [[file:~/.emacs.d/modules/lang/org/autoload/org-capture.el::defun +org--capture-central-file (file project]]
;; Will use {org-directory}/{+org-capture-projects-file} and store
;; these under {ProjectName}/{Tasks,Notes,Changelog} headings. They
;; support `:parents' to specify what headings to put them under, e.g.
;; :parents ("Projects")
("o" "Centralized templates for projects")
("ot" "Project todo" entry
(function +org-capture-central-project-todo-file)
"* TODO %?\n %i\n %a"
:heading "Tasks"
:prepend nil)
("on" "Project notes" entry
(function +org-capture-central-project-notes-file)
"* %U %?\n %i\n %a"
:heading "Notes"
:prepend t)
("oc" "Project changelog" entry
(function +org-capture-central-project-changelog-file)
"* %U %?\n %i\n %a"
:heading "Changelog"
:prepend t)
;; org books / general logging
("b" "Book log / General log (org)" item (function org-books-visit-book-log)
"- %U %?" :prepend t)
;; zettelkasten
("s" "Slipbox" entry (file "roam/inbox.org")
"* %U %?\n")
("S" "Slipbox link" entry (file "roam/inbox.org")
"* %U %?\n %i\n %a")))
(setq org-attach-directory "~/notebook/images/attach/")
2023-06-18 07:14:39 -04:00
)
;;; end of (!after org ...
;;; for testing
(defun org-wild-notifier-debug ()
"Collect debug information for org-wild-notifier"
(interactive)
(save-window-excursion
(let ((org-agenda-use-time-grid nil)
(org-agenda-compact-blocks t)
(org-agenda-window-setup 'current-window)
(org-agenda-buffer-name nil)
(org-agenda-buffer-tmp-name org-wild-notifier--agenda-buffer-name))
(org-agenda-list 2)
(message "registered events: %s \n blacklist: %s \n whitelist: %s \n"
(org-wild-notifier--retrieve-events)
org-wild-notifier-keyword-blacklist
org-wild-notifier-keyword-whitelist)
(message "filtered events: %s"
(->> (org-wild-notifier--retrieve-events)
(-map 'org-wild-notifier--check-event)))
(kill-buffer))))
(defun org-wild-notifier-alert-test ()
(interactive)
(alert "test")
)
;;; end
2023-06-29 10:12:35 -04:00
(defun agenda/hide-daily-schedule-1 (&optional arg)
(interactive "P")
(let ((org-agenda-tag-filter-preset '("-habits")))
(org-agenda arg "a")))
(bind-key "<f5>" 'agenda/hide-daily-schedule-1)
;;; termux specific
;(setq browse-url-browser-function 'browse-url-generic
; browse-url-generic-program "termux-open")
(defun jethro/org-archive-done-tasks ()
"Archive all done tasks."
(interactive)
(org-map-entries 'org-archive-subtree "/DONE" 'file))
(require 'org-download)
(setq-default
org-download-method 'directory
;; org-download-screenshot-method "grimshot save window %s"
;; org-download-screenshot-method "wl-paste -t image/png > '%s'"
;; below script is available on dotfiles: ../.local/bin
org-download-screenshot-method "convert-paste-png.sh '%s'"
org-download-image-dir "~/notebook/images/org-download"
org-download-heading-lvl nil
org-download-timestamp "%Y%m%d-%H%M%S_")
(add-hook 'dired-mode-hook 'org-download-enable)