diff --git a/home/emacs/modules/custom-feed-config.el b/home/emacs/modules/custom-feed-config.el index e3ade092..75324a90 100644 --- a/home/emacs/modules/custom-feed-config.el +++ b/home/emacs/modules/custom-feed-config.el @@ -1,6 +1,6 @@ (setq elfeed-db-directory "~/.elfeed/db/" elfeed-enclosure-default-dir "~/.elfeed/enclosures/" - rmh-elfeed-org-files (list "elfeed.org")) + rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-db-directory) "elfeed.org")) (when (require 'elfeed nil :noerror) (add-hook 'elfeed-search-mode-hook #'elfeed-update) diff --git a/home/emacs/modules/custom-org-config.el b/home/emacs/modules/custom-org-config.el index 67f26365..87b07cd5 100644 --- a/home/emacs/modules/custom-org-config.el +++ b/home/emacs/modules/custom-org-config.el @@ -1,5 +1,6 @@ +(let) (setq org-directory "~/Org" - org-journal-dir "~/Org/journal/" + org-journal-dir (expand-file-name "journal" org-directory) org-journal-file-type 'daily org-journal-file-format "%Y%m%d.org" org-agenda-files '("~/Org/") @@ -11,27 +12,37 @@ org-refile-use-outline-path t org-refile-allow-creating-parent-nodes t org-refile-targets '((nil :maxlevel . 3) - (org-agenda-files :maxlevel . 3))) + (org-agenda-files :maxlevel . 3)) + ;; Without this, completers like ivy/helm are only given the first level of + ;; each outline candidates. i.e. all the candidates under the "Tasks" heading + ;; are just "Tasks/". This is unhelpful. We want the full path to each refile + ;; target! e.g. FILE/Tasks/heading/subheading + org-refile-use-outline-path 'file + org-outline-path-complete-in-steps nil + org-default-notes-file (expand-file-name "notes.org" org-directory)) -(defun my/org-move-done-tasks-to-bottom () - "Sort all tasks in the topmost heading by TODO state." - (interactive) - (save-excursion - (while (org-up-heading-safe)) - (org-sort-entries nil ?o)) +(let ((project-template "#+title: ${title}\n#+category: ${title}\n* Goals\n\n* [%] Tasks\n\n* Notes\n\n* References\n")) + (setq org-capture-templates + '(("n" "Note" entry + (file+headline "notes.org" "Inbox") + "* %u %?\n%i\n%a" + :prepend t + :empty-lines 1) + ("t" "Task" entry + (file+headline "todo.org" "Inbox") + "* TODO %?\n%i\n%a" + :prepend t + :emptry-lines 1) + ))) - ;; Reset the view of TODO items - (org-overview) - (org-show-entry) - (org-show-children)) - -(when (require 'org nil :noerror) - (add-hook - 'org-mode-hook - (lambda () (add-hook - 'before-save-hook - #'my/org-move-done-tasks-to-bottom - nil - 'local)))) +(when (require 'hydra nil :noerror) + (defhydra org (global-map "C-c o") + "Org-Mode" + ("a" org-agenda) + ("c" org-capture) + ("j c" calendar) + ("j j" org-journal-new-entry) + ("j n" org-journal-new-date-entry) + ("j s" org-journal-new-scheduled-entry))) (provide 'custom-org-config) diff --git a/home/emacs/modules/ref-defaults-config.el b/home/emacs/modules/ref-defaults-config.el deleted file mode 100644 index 9b529e9b..00000000 --- a/home/emacs/modules/ref-defaults-config.el +++ /dev/null @@ -1,240 +0,0 @@ -;;; custom-defaults.el -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 -;; SPDX-License-Identifier: MIT - -;; Author: System Crafters Community - -;; Commentary - -;; General Crafted Emacs endorsed defaults -;; -;; Some of these settings were inspired by the following: -;; - Charles Choi: "Surprise and Emacs Defaults" -;; http://yummymelon.com/devnull/surprise-and-emacs-defaults.html -;; - Mickey Petersen: "Mastering Emacs", -;; especially "Demystifying Emacs’s Window Manager" -;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager - -;;; Code: - - -;;; Buffers - -;; Revert Dired and other buffers -(customize-set-variable 'global-auto-revert-non-file-buffers t) - -;; Revert buffers when the underlying file has changed -(global-auto-revert-mode 1) - -;; Make dired do something intelligent when two directories are shown -;; in separate dired buffers. Makes copying or moving files between -;; directories easier. The value `t' means to guess the default -;; target directory. -(customize-set-variable 'dired-dwim-target t) - -;; automatically update dired buffers on revisiting their directory -(customize-set-variable 'dired-auto-revert-buffer t) - -;; scroll eshell buffer to the bottom on input, but only in "this" -;; window. -(customize-set-variable 'eshell-scroll-to-bottom-on-input 'this) - -;; pop up dedicated buffers in a different window. -(customize-set-variable 'switch-to-buffer-in-dedicated-window 'pop) -;; treat manual buffer switching (C-x b for example) the same as -;; programmatic buffer switching. -(customize-set-variable 'switch-to-buffer-obey-display-actions t) - -;; prefer the more full-featured built-in ibuffer for managing -;; buffers. -(keymap-global-set " " #'ibuffer-list-buffers) -;; turn off forward and backward movement cycling -(customize-set-variable 'ibuffer-movement-cycle nil) -;; the number of hours before a buffer is considered "old" by -;; ibuffer. -(customize-set-variable 'ibuffer-old-time 24) - - - -;;; Completion settings - -;; Turn on the best completion-mode available: -;; - in version 28 or later, turn on `fido-vertical-mode' -;; - in earlier versions, if the additional package `icomplete-vertical' is -;; present, turn it on. -;; - otherwise turn on `icomplete-mode' -;; -;; Note: If you also use `custom-completion-config' and have `vertico' -;; installed, all of these modes will be turned off in favour of -;; `vertico'. -(if (version< emacs-version "28") - (if (locate-library "icomplete-vertical") - (icomplete-vertical-mode 1) - (icomplete-mode 1)) - (fido-vertical-mode 1)) - -;; No matter which completion mode is used: -(customize-set-variable 'tab-always-indent 'complete) -(customize-set-variable 'completion-cycle-threshold 3) -(customize-set-variable 'completion-category-overrides - '((file (styles . (partial-completion))))) -(customize-set-variable 'completions-detailed t) - -;; use completion system instead of popup window -(customize-set-variable 'xref-show-definitions-function - #'xref-show-definitions-completing-read) - - -;;; Editing - -;; Typed text replaces the selection if the selection is active, -;; pressing delete or backspace deletes the selection. -(delete-selection-mode) - -;; Use spaces instead of tabs -(setq-default indent-tabs-mode nil) - -;; Do not save duplicates in kill-ring -(customize-set-variable 'kill-do-not-save-duplicates t) - -;; Better support for files with long lines -(setq-default bidi-paragraph-direction 'left-to-right) -(setq-default bidi-inhibit-bpa t) -(global-so-long-mode 1) - -;; define a key to define the word at point. -(keymap-set global-map "M-#" #'dictionary-lookup-definition) - -;; Show dictionary definition on the left -(add-to-list 'display-buffer-alist - '("^\\*Dictionary\\*" - (display-buffer-in-side-window) - (side . left) - (window-width . 70))) - -;; turn on spell checking, if available. -(with-eval-after-load 'ispell - (when (executable-find ispell-program-name) - (add-hook 'text-mode-hook #'flyspell-mode) - (add-hook 'prog-mode-hook #'flyspell-prog-mode))) - - - -;;; Navigation - -;; add hydra to facilitate remembering the keys and actions for dumb-jump -(when (and (require 'hydra nil :noerror) - (require 'dumb-jump nil :noerror)) - (defhydra dumb-jump-hydra (:color blue :columns 3) - "Dumb Jump" - ("j" dumb-jump-go "Go") - ("o" dumb-jump-go-other-window "Other window") - ("e" dumb-jump-go-prefer-external "Go external") - ("x" dumb-jump-go-prefer-external-other-window "Go external other window") - ("i" dumb-jump-go-prompt "Prompt") - ("l" dumb-jump-quick-look "Quick look") - ("b" dumb-jump-back "Back")) - ;; not a great key as a mnemonic, but easy to press quickly - (keymap-set dumb-jump-mode-map "C-M-y" #'dumb-jump-hydra/body)) - -;; use xref -(with-eval-after-load 'dumb-jump - (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) - - - -;;; Persistence between sessions - -;; Turn on recentf mode -(add-hook 'after-init-hook #'recentf-mode) - -;; Enable savehist-mode for command history -(savehist-mode 1) - -;; save the bookmarks file every time a bookmark is made or deleted -;; rather than waiting for Emacs to be killed. Useful especially when -;; Emacs is a long running process. -(customize-set-variable 'bookmark-save-flag 1) - - - -;;; Window management -(defgroup custom-windows '() - "Window related configuration for Crafted Emacs." - :tag "Crafted Windows" - :group 'crafted) - -(defcustom custom-windows-prefix-key "C-c w" - "Configure the prefix key for window movement bindings. - -Movement commands provided by `windmove' package, `winner-mode' -also enables undo functionality if the window layout changes." - :group 'custom-windows - :type 'string) - -;; Turning on `winner-mode' provides an "undo" function for resetting -;; your window layout. We bind this to `C-c w u' for winner-undo and -;; `C-c w r' for winner-redo (see below). -(winner-mode 1) - -(define-prefix-command 'custom-windows-key-map) - -(keymap-set 'custom-windows-key-map "u" 'winner-undo) -(keymap-set 'custom-windows-key-map "r" 'winner-redo) -(keymap-set 'custom-windows-key-map "n" 'windmove-down) -(keymap-set 'custom-windows-key-map "p" 'windmove-up) -(keymap-set 'custom-windows-key-map "b" 'windmove-left) -(keymap-set 'custom-windows-key-map "f" 'windmove-right) - -(keymap-global-set custom-windows-prefix-key 'custom-windows-key-map) - -;; Make scrolling less stuttered -(setq auto-window-vscroll nil) -(customize-set-variable 'fast-but-imprecise-scrolling t) -(customize-set-variable 'scroll-conservatively 101) -(customize-set-variable 'scroll-margin 0) -(customize-set-variable 'scroll-preserve-screen-position t) - -;; open man pages in their own window, and switch to that window to -;; facilitate reading and closing the man page. -(customize-set-variable 'Man-notify-method 'aggressive) - -;; keep the Ediff control panel in the same frame -(customize-set-variable 'ediff-window-setup-function - 'ediff-setup-windows-plain) - -;; Window configuration for special windows. -(add-to-list 'display-buffer-alist - '("\\*Help\\*" - (display-buffer-reuse-window display-buffer-pop-up-window) - (inhibit-same-window . t))) - -(add-to-list 'display-buffer-alist - '("\\*Completions\\*" - (display-buffer-reuse-window display-buffer-pop-up-window) - (inhibit-same-window . t) - (window-height . 10))) - - -;;; Miscellaneous - -;; Load source (.el) or the compiled (.elc or .eln) file whichever is -;; newest -(customize-set-variable 'load-prefer-newer t) - -;; Make shebang (#!) file executable when saved -(add-hook 'after-save-hook - #'executable-make-buffer-file-executable-if-script-p) - -;; Turn on repeat mode to allow certain keys to repeat on the last -;; keystroke. For example, C-x [ to page backward, after pressing this -;; keystroke once, pressing repeated [ keys will continue paging -;; backward. `repeat-mode' is exited with the normal C-g, by movement -;; keys, typing, or pressing ESC three times. -(unless (version< emacs-version "28") - (repeat-mode 1)) - - -(provide 'custom-defaults-config) -;;; custom-defaults-config.el ends here