From 8db79452986505dbfafb6bd9a6743a938b982ba9 Mon Sep 17 00:00:00 2001 From: rearman Date: Fri, 8 May 2026 16:45:10 -0400 Subject: [PATCH] Move howm and org configs to the main config Fewer requires==faster load times B) --- README.org | 766 ++++++++++++++++++++++++++++++++------------------ re/re-howm.el | 71 ----- re/re-org.el | 171 ----------- 3 files changed, 497 insertions(+), 511 deletions(-) delete mode 100644 re/re-howm.el delete mode 100644 re/re-org.el diff --git a/README.org b/README.org index e782ad7..8878ef6 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,5 @@ #+TITLE: Emacs literate config +#+STARTUP: noindent #+PROPERTY: header-args emacs-lisp :tangle config.el * Header @@ -16,7 +17,7 @@ (add-to-list 'load-path (concat user-emacs-directory path))) (dolist (file '(re-pass-alike eng-paper-theme sedit-mouse)) - (require file)) + (require file)) (setq w32-recognize-altgr 'nil) @@ -27,12 +28,12 @@ "Use TRAMP to reopen the current buffer as root using doas." (interactive) (when buffer-file-name - (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name)))) + (find-alternate-file (concat "/doas:root@localhost:" buffer-file-name)))) (defun sudo () "Use TRAMP to reopen the current buffer as root using sudo." (interactive) (when buffer-file-name - (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))) #+END_SRC * Packages @@ -102,11 +103,11 @@ Make AucTeX use pdftools, prompt for master file, synctex, etc. (setq-default TeX-master nil) (add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools")) (setq TeX-auto-save t - TeX-parse-self t - TeX-PDF-mode t - TeX-source-correlate-start-server t) + TeX-parse-self t + TeX-PDF-mode t + TeX-source-correlate-start-server t) (add-hook 'TeX-after-compilation-finished-functions - #'TeX-revert-document-buffer)) + #'TeX-revert-document-buffer)) #+END_SRC ** CSV Mode #+BEGIN_SRC emacs-lisp @@ -123,15 +124,15 @@ Make markdown act more like org when I'm forced to use it (setq markdown-special-ctrl-a/e t) :bind (:map markdown-mode-map - ("M-" . markdown-demote) - ("M-" . markdown-promote) - ("M-" . markdown-move-up) - ("M-" . markdown-move-down) - ("C-M-u" . markdown-up-heading) - ("C-M-b" . markdown-outline-previous-same-level) - ("C-M-f" . markdown-outline-next-same-level) - ("C-M-p" . markdown-outline-previous) - ("C-M-n" . markdown-outline-next))) + ("M-" . markdown-demote) + ("M-" . markdown-promote) + ("M-" . markdown-move-up) + ("M-" . markdown-move-down) + ("C-M-u" . markdown-up-heading) + ("C-M-b" . markdown-outline-previous-same-level) + ("C-M-f" . markdown-outline-next-same-level) + ("C-M-p" . markdown-outline-previous) + ("C-M-n" . markdown-outline-next))) (use-package edit-indirect :after 'markdown-mode) #+END_SRC @@ -155,24 +156,24 @@ Make markdown act more like org when I'm forced to use it (use-package sly :config (setq inferior-lisp-program "sbcl" - sly-net-coding-system 'utf-8-unix - sly-command-switch-to-existing-lisp 'always) + sly-net-coding-system 'utf-8-unix + sly-command-switch-to-existing-lisp 'always) (let ((core (expand-file-name "~/sbcl.core-for-sly"))) (when (file-exists-p core) - (setq sly-lisp-implementations (list `(sbcl ("sbcl" "--core" ,core)))))) + (setq sly-lisp-implementations (list `(sbcl ("sbcl" "--core" ,core)))))) :bind (:map sly-mrepl-mode-map - (")" . (lambda () (interactive) (re/send-on-close-paren #'sly-mrepl-return))) - ("]" . (lambda () (interactive) (re/balance-and-eval-sexp #'sly-mrepl-return))) - ("C-c q" . re/sly-quit-current-lisp))) + (")" . (lambda () (interactive) (re/send-on-close-paren #'sly-mrepl-return))) + ("]" . (lambda () (interactive) (re/balance-and-eval-sexp #'sly-mrepl-return))) + ("C-c q" . re/sly-quit-current-lisp))) #+END_SRC *** Eldoc settings Sly really doesn't play well with elodc in the minibuffer, so here are some settings to make it better. #+BEGIN_SRC emacs-lisp (add-to-list 'display-buffer-alist - '("^\\*eldoc" display-buffer-in-direction - (direction . 'down) - (window-height . 4))) + '("^\\*eldoc" display-buffer-in-direction + (direction . 'down) + (window-height . 4))) (keymap-global-set "C-c d" #'eldoc) ; force eldoc to show in minibuffer (keymap-global-set "C-c D" #'eldoc-doc-buffer) ; open eldoc buffer when it's getting spammed #+END_SRC @@ -181,15 +182,15 @@ Sly really doesn't play well with elodc in the minibuffer, so here are some sett (use-package geiser :config (if (equal system-type 'windows-nt) - (setq geiser-chicken-binary '("C:/tools/chicken/bin/csi.exe" "-:c")) + (setq geiser-chicken-binary '("C:/tools/chicken/bin/csi.exe" "-:c")) (setq geiser-chicken-binary "csi -:c")) (setq scheme-program-name geiser-chicken-binary - geiser-active-implementations '(chicken)) + geiser-active-implementations '(chicken)) (add-hook 'scheme-mode-hook 'geiser-mode) :bind (:map geiser-repl-mode-map - (")" . (lambda () (interactive) (re/send-on-close-paren #'geiser-repl-maybe-send))) - ("]" . (lambda () (interactive) (re/balance-and-eval-sexp #'geiser-repl-maybe-send))))) + (")" . (lambda () (interactive) (re/send-on-close-paren #'geiser-repl-maybe-send))) + ("]" . (lambda () (interactive) (re/balance-and-eval-sexp #'geiser-repl-maybe-send))))) (use-package geiser-chicken :after 'geiser) #+END_SRC @@ -199,12 +200,11 @@ Sly really doesn't play well with elodc in the minibuffer, so here are some sett (use-package forth-mode) #+END_SRC ** ORG -Loading in org customizations from a separate file for now. Maybe tangle that file from here in the future +*** Load in the package and set bindings #+BEGIN_SRC emacs-lisp (use-package org :config (require 'org-mouse) - (require 're-org) :bind (("C-c l" . org-store-link) ("C-c a" . org-agenda) @@ -232,28 +232,256 @@ Loading in org customizations from a separate file for now. Maybe tangle that f :bind (("C-c t" . org-transclusion-mode))) #+END_SRC +*** Configuration +**** General options +#+BEGIN_SRC emacs-lisp + (with-eval-after-load 'org-mode (add-to-list 'org-export-backends 'md)) + + (setq org-startup-indented t + org-indent-indentation-per-level tab-width + org-startup-folded 'fold + org-startup-with-inline-images t + org-cycle-inline-images-display t + org-cycle-separator-lines 0 + org-blank-before-new-entry '((heading) (plain-list-item . auto)) + org-M-RET-may-split-line nil + org-treat-S-cursor-todo-selection-as-state-change nil + org-treat-insert-todo-heading-as-state-change nil + org-table-export-default-format "orgtbl-to-csv" + org-list-allow-alphabetical t + org-fold-catch-invisible-edits 'show-and-error + org-ellipsis "↴" + org-tags-column 0 + org-reverse-note-order t + org-enforce-todo-dependencies t + org-enforce-todo-checkbox-dependencies t + org-fontify-done-headline nil + org-fontify-todo-headline nil + org-goto-interface 'outline-path-completion + org-outline-path-complete-in-steps nil + org-goto-auto-isearch nil + org-special-ctrl-a/e t + org-special-ctrl-k t + org-return-follows-link t + org-yank-adjusted-subtrees t) +#+END_SRC +**** Time Clocking +#+BEGIN_SRC emacs-lisp +(org-clock-persistence-insinuate) +(setq org-clock-history-length 10 + org-clock-in-resume t + org-clock-out-remove-zero-time-clocks t + org-clock-persist t + org-clock-persist-query-resume nil + org-clock-report-include-clocking-task t + org-time-stamp-rounding-minutes '(1 1)) +#+END_SRC +**** Agenda and Capture +#+BEGIN_SRC emacs-lisp +(add-hook 'org-agenda-mode-hook #'hl-line-mode) + +(setq org-agenda-files (append '("~/org/") + (file-expand-wildcards "~/projects/*/")) + org-refile-targets '((nil :maxlevel . 9) + (org-agenda-files :maxlevel . 9)) + org-refile-use-outline-path 'file + org-refile-allow-creating-parent-nodes 'confirm + org-tag-alist '(("call" . ?c) + ("email" . ?e) + ("errand" . ?r) + ("jobpc" . ?j) + ("license" . ?l) + ("meeting" . ?m) + ("open" . ?o)) + org-tags-exclude-from-inheritance '("open") + org-todo-keywords '((sequence "TODO(t)" "WAITING(w@)" "|" "DONE(d)" "BELAYED(b@)" "GIVEN(g@)") + (sequence "MEETING(m)" "|" "MET(M)")) + org-todo-keyword-faces '(("WAITING" :foreground "#e85400" :weight bold) + ("MEETING" :foreground "#315e9a" :weight bold)) + org-agenda-restore-windows-after-quit t + org-agenda-start-on-weekday nil + org-agenda-compact-blocks t + org-agenda-span 'day + org-deadline-warning-days 30 + org-agenda-window-setup 'current-window + org-agenda-time-grid '((daily today remove-match) + (600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900) + " ――――― " + "") + org-agenda-tags-column 50 + org-agenda-skip-additional-timestamps-same-entry t + org-agenda-skip-deadline-if-done t + org-agenda-skip-scheduled-if-done t + org-agenda-prefix-format '((agenda . " %?-12t% s") + (todo . " ") + (tags . " ") + (search . " ")) + org-agenda-scheduled-leaders '("BOOKED: " "Booked %2d d. ago: ") + org-agenda-deadline-leaders '("DEADLINE: " "In %3d d.: " "%2d d. ago: ") + org-read-date-prefer-future 'time + org-agenda-custom-commands '(("f" "Maybe Someday" tags "someday" ((org-agenda-overriding-header "SOMEDAY:"))) + ("i" "Inbox" tags "inbox" ((org-agenda-overriding-header "INBOX:"))) + ("l" "Licenses" tags "license" ((org-agenda-overriding-header "LICENSES:"))) + ("n" "Next Actions" tags-todo "-recurring/TODO" ((org-agenda-overriding-header "NEXT:"))) + ("p" "JobPCs" tags "jobpc" ((org-agenda-overriding-header "JOB PCS:"))) + ("u" "Undertakings" tags "open" ((org-agenda-overriding-header "UNDERTAKINGS:"))) + ("w" "Waiting" todo "WAITING" ((org-agenda-overriding-header "WAITING:"))) + ("o" "Overview" ((agenda "") + (tags "inbox" ((org-agenda-overriding-header "\nINBOX:"))) + (tags-todo "-recurring/TODO" ((org-agenda-overriding-header "\nNEXT:") + (org-agenda-max-entries 10))) + (tags "open" ((org-agenda-overriding-header "\nUNDERTAKINGS:"))) + (todo "WAITING" ((org-agenda-overriding-header "\nWAITING:")))))) + org-agenda-start-with-log-mode t + org-agenda-log-mode-items '(closed clock state) + org-log-done 'time + org-log-into-drawer nil + org-log-state-notes-insert-after-drawers t + org-log-state-notes-into-drawer nil + org-capture-templates '(("i" "Inbox" entry + (file "gtd.org") + "* %^{Description} :inbox:\n%U\n%?" + :prepend t + :clock-in t + :clock-resume t) + ("m" "Meeting" entry + (file "gtd.org") + "* MEETING %^{Description} :meeting:\n%^{Scheduled:}T\n%?" + :prepend t + :clock-in t + :clock-resume t) + ("p" "Phone Call" entry + (file "gtd.org") + "* %^{Description} :call:\n%U\n%?" + :prepend t + :clock-in t + :clock-resume t))) +#+END_SRC +**** IDs +#+BEGIN_SRC emacs-lisp +(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id + org-id-method 'ts + org-clone-delete-id t + org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format + org-attach-id-uuid-folder-format)) + +(defun re/org-auto-generate-ids-in-file () + "Add ID properties to all headlines in the current + file which do not already have one." + (interactive) + (org-map-entries 'org-id-get-create)) + +(defun re/org-save-all () + "Save all `org-agenda-files' without user confirmation." + (interactive) + (message "Saving all org-agenda-files buffers...") + (save-some-buffers t + (lambda () + (when (member (buffer-file-name) org-agenda-files) t))) + (message "Saving all org-agenda-files buffers... done")) + +(advice-add 'org-refile :after (lambda (&rest _) (re/org-save-all))) +#+END_SRC +**** Archiving +#+BEGIN_SRC emacs-lisp +(defun re/org-archive-all () + "Archive all tasks marked `DONE' in agenda files" + (interactive) + (message "Archiving all completed tasks in org-agenda-files...") + (org-map-entries (lambda () + (org-archive-subtree) + (setq org-map-continue-from (org-element-property + :begin + (org-element-at-point)))) + "/DONE" + 'agenda) + (message "Archiving all completed tasks in org-agenda-files... done")) + +(setq org-archive-location (concat "~/org/old.org_keep::datetree/") + org-agenda-text-search-extra-files '(agenda-archives)) + +(add-to-list 'auto-mode-alist '("\\.org_keep\\'" . org-mode)) +#+END_SRC ** HOWM On-again, off-again relationship with this one +*** Load package and add bindings #+BEGIN_SRC emacs-lisp -(use-package howm - :config - (require 're-howm) - :bind - (("" . howm-menu) - ("S-" . re/howm-menu-new-frame) - :map howm-mode-map - ("C-c , k" . re/howm-create-keyword) - ("C-c , =" . howm-narrow-to-memo))) + (use-package howm + :bind + (("" . howm-menu) + ("S-" . re/howm-menu-new-frame) + :map howm-mode-map + ("C-c , k" . re/howm-create-keyword) + ("C-c , =" . howm-narrow-to-memo))) #+END_SRC +*** Config +**** General settings +#+BEGIN_SRC emacs-lisp + (setq howm-template '("= %title%cursor #inbox\n%date %file\n\n" + "= %title%cursor #meeting\n%date %file\n\nAttendees: \n" + "= @%title%cursor\n%date %file\n\n") + howm-keyword-file "~/howm/.howm-keys" + howm-history-file "~/howm/.howm-history" + howm-menu-file "~/.emacs.d/0000-00-00-000000.txt" + howm-file-name-format "%Y%m%dT%H%M%S.txt" + howm-keyword-case-fold-search t + howm-remember-insertion-format "%s" + howm-menu-todo-num 10) + + (defun re/howm-menu-new-frame (&optional arg) + "Show the howm menu in a new frame" + (interactive "P") + (re/open-with-new-frame "HOWM" #'howm-menu)) + + (defun re/howm-create-keyword () + "Reads a keyword from the minibuffer and appends it to the keywords file." + (interactive) + (append-to-file (concat (read-string "New Keyword: ") + "\n") + nil + howm-keyword-file)) +#+END_SRC +**** Menu config +#+BEGIN_SRC emacs-lisp + ;; add entries in howm-menu (press enter on the text) + (defun re/howm-menu-legend () + (cl-labels ((p (text face) (propertize text 'font-lock-face face))) + (concat (format "Top %s" howm-menu-todo-num) + " " + (p "!Deadline" howm-reminder-deadline-face) + "/" + (p "+ToDo" howm-reminder-todo-face) + "/" + (p "@Schedule" howm-reminder-schedule-face) + "/" + (p "~Defer" howm-reminder-defer-face) + "/" + (p "-Reminder" howm-reminder-normal-face) + " Entries:"))) + + (with-eval-after-load 'howm + (dolist (aldr-additions '(("\\[Mtg\\]" (lambda (&optional dummy) (howm-create 2))) + ("\\[Person\\]" (lambda (&optional dummy) (howm-create 3))))) + (add-to-list 'action-lock-default-rules aldr-additions t)) + (add-to-list 'howm-menu-allow 're/howm-menu-legend) + ;; add coloring for custom "waiting" state + (add-to-list 'howm-reminder-font-lock-keywords + `(,(howm-reminder-regexp "[w]") (0 howm-reminder-defer-face prepend)) + t)) + + (dolist (hooks '(after-save-hook howm-mode-hook)) + (add-hook hooks 'howm-mode-set-buffer-name)) +#+END_SRC + ** Trashed Shows the trash file as a dired buffer #+BEGIN_SRC emacs-lisp (use-package trashed :config (setq trashed-action-confirmer 'y-or-n-p - trashed-use-header-line t - trashed-sort-key '("Date deleted" . t) - trashed-date-format "%Y-%m-%d %H:%M:%S")) + trashed-use-header-line t + trashed-sort-key '("Date deleted" . t) + trashed-date-format "%Y-%m-%d %H:%M:%S")) #+END_SRC * Editing ** UNIX/vi-like bindings @@ -282,7 +510,7 @@ Shows the trash file as a dired buffer "Kill region if active, otherwise kill back one word." (interactive "p") (if (use-region-p) - (kill-region (region-beginning) (region-end)) + (kill-region (region-beginning) (region-end)) (backward-kill-word arg))) (keymap-global-set "C-w" #'re/kill-bword-or-region) @@ -298,7 +526,7 @@ Shows the trash file as a dired buffer Stolen from https://depp.brause.cc/dotemacs" (interactive "P") (if (use-region-p) - (comment-or-uncomment-region (region-beginning) (region-end)) + (comment-or-uncomment-region (region-beginning) (region-end)) (comment-line arg))) (keymap-global-set "M-;" #'re/comment-dwim) @@ -308,7 +536,7 @@ Shows the trash file as a dired buffer Return to initial position after. Arg works on `mark-defun'." (interactive "P") (save-excursion (mark-defun arg) - (comment-region (region-beginning) (region-end)))) + (comment-region (region-beginning) (region-end)))) (keymap-global-set "C-M-;" #'re/comment-defun) @@ -338,14 +566,14 @@ Shows the trash file as a dired buffer #+BEGIN_SRC emacs-lisp ;; Tabs (setq-default indent-tabs-mode t - tab-width 8 - backward-delete-char-untabify-method nil) + tab-width 8 + backward-delete-char-untabify-method nil) (advice-add 'indent-to :around - (lambda (orig-fun column &rest args) - (when indent-tabs-mode - (setq column (* tab-width (round column tab-width)))) - (apply orig-fun column args))) + (lambda (orig-fun column &rest args) + (when indent-tabs-mode + (setq column (* tab-width (round column tab-width)))) + (apply orig-fun column args))) (dolist (indent-level '(c-basic-offset cperl-indent-level LaTeX-indent-level)) (defvaralias indent-level 'tab-width)) @@ -361,8 +589,8 @@ Shows the trash file as a dired buffer #+BEGIN_SRC emacs-lisp ;; Buffer dealiŋ (setq-default indicate-empty-lines t - truncate-lines t - fill-column 78) + truncate-lines t + fill-column 78) (dolist (hook '(text-mode-hook LaTeX-mode-hook)) (add-hook hook #'visual-line-mode)) @@ -436,15 +664,15 @@ If in org-mode, call `org-beginning-of-line' first." (interactive "^") (let ((oldpos (point))) (if (equal major-mode 'org-mode) - (org-beginning-of-line) + (org-beginning-of-line) (progn - (when visual-line-mode (beginning-of-visual-line 1)) - (skip-syntax-forward " " (line-end-position)) - (backward-prefix-chars))) + (when visual-line-mode (beginning-of-visual-line 1)) + (skip-syntax-forward " " (line-end-position)) + (backward-prefix-chars))) (and (= oldpos (point)) - (let ((newpos (point))) - (back-to-indentation) - (and (= newpos (point)) (beginning-of-line)))))) + (let ((newpos (point))) + (back-to-indentation) + (and (= newpos (point)) (beginning-of-line)))))) (keymap-global-set " " #'re/smart-beginning-of-line) (keymap-set visual-line-mode-map "C-a" #'re/smart-beginning-of-line) @@ -456,9 +684,9 @@ If in org-mode, call `org-end-of-line' first." (interactive "^") (let ((oldpos (point))) (if (equal major-mode 'org-mode) - (org-end-of-line) + (org-end-of-line) (when visual-line-mode - (end-of-visual-line 1))) + (end-of-visual-line 1))) (and (= oldpos (point)) (move-end-of-line nil)))) (keymap-global-set " " #'re/smart-end-of-line) @@ -492,7 +720,7 @@ If in org-mode, call `org-end-of-line' first." (interactive) (when (use-region-p) (add-to-history 'search-ring - (buffer-substring (region-beginning) (region-end))) + (buffer-substring (region-beginning) (region-end))) (deactivate-mark)) (isearch-forward)) @@ -503,7 +731,7 @@ If in org-mode, call `org-end-of-line' first." (interactive) (when (use-region-p) (add-to-history 'search-ring - (buffer-substring (region-beginning) (region-end))) + (buffer-substring (region-beginning) (region-end))) (deactivate-mark)) (isearch-backward)) @@ -514,8 +742,8 @@ If in org-mode, call `org-end-of-line' first." Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transient-mark-mode" (interactive "P") (exchange-point-and-mark (if (and transient-mark-mode (not mark-active)) - (not arg) - arg))) + (not arg) + arg))) (keymap-global-set " " #'re/exchange-point-and-mark-maybe-activate) @@ -533,7 +761,7 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien (midnight-mode t) (setq clean-buffer-list-delay-general 1) (dolist (never-re '("\\` \\*tramp/.*\\'" - "\\` \\*eshell.*\\'")) + "\\` \\*eshell.*\\'")) (add-to-list 'clean-buffer-list-kill-never-regexps never-re)) (save-place-mode 1) (recentf-mode 1) @@ -545,19 +773,19 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien "Renames the current buffer and the file it is visiting." (interactive) (let ((name (buffer-name)) - (filename (buffer-file-name))) + (filename (buffer-file-name))) (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) + (error "Buffer '%s' is not visiting a file!" name) (let ((new-name (read-file-name "New name: " filename))) - (if (get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name) - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" - name - (file-name-nondirectory new-name))))))) + (if (get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name) + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" + name + (file-name-nondirectory new-name))))))) (keymap-global-set "C-x C-r" #'re/rename-current-buffer-file) @@ -567,36 +795,36 @@ Start from bottom if given a negative line number." (with-temp-buffer (insert-file-contents file-path) (if (< line-number 0) - (progn - (goto-char (point-max)) - (forward-line line-number)) + (progn + (goto-char (point-max)) + (forward-line line-number)) (progn - (goto-char (point-min)) - (forward-line (1- line-number)))) + (goto-char (point-min)) + (forward-line (1- line-number)))) (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) (defun re/get-file-modified-time (filepath) (interactive) (format-time-string "%Y-%m-%d-%H%M" - (file-attribute-modification-time (file-attributes filepath)))) + (file-attribute-modification-time (file-attributes filepath)))) (defun re/filename-inject-mod-time (filepath) (interactive) (concat (file-name-sans-extension filepath) - "_" - (re/get-file-modified-time filepath) - (file-name-extension filepath t))) + "_" + (re/get-file-modified-time filepath) + (file-name-extension filepath t))) (defun re/copy-with-mod-time (&optional filepath) (interactive) (let ((filepath (if (eq major-mode 'dired-mode) - (dired-get-filename t) - (when (null filepath) - (read-file-name "File to copy with datestring: " - default-directory - nil - t - nil))))) + (dired-get-filename t) + (when (null filepath) + (read-file-name "File to copy with datestring: " + default-directory + nil + t + nil))))) (copy-file filepath (re/filename-inject-mod-time filepath ) nil t t t))) #+END_SRC * Dired @@ -606,14 +834,14 @@ Start from bottom if given a negative line number." "In dired mode, visit the file at the cursor in the right/below/left/above window." (interactive) (let* ((file-or-dir (dired-get-file-for-visit)) ;; get the file at cursor - (buffer (find-file-noselect file-or-dir))) ;; load the file into a buffer + (buffer (find-file-noselect file-or-dir))) ;; load the file into a buffer (let ((window ;; figure out the window to use - (cond ((get-buffer-window buffer (selected-frame))) - ((window-in-direction 'right)) ;; try window in each direction - ((window-in-direction 'below)) ;; and default to right - ((window-in-direction 'left)) ;; if no window found. - ((window-in-direction 'above)) - (t (split-window (selected-window) nil 'right))))) + (cond ((get-buffer-window buffer (selected-frame))) + ((window-in-direction 'right)) ;; try window in each direction + ((window-in-direction 'below)) ;; and default to right + ((window-in-direction 'left)) ;; if no window found. + ((window-in-direction 'above)) + (t (split-window (selected-window) nil 'right))))) (window--display-buffer buffer window 'window nil) window))) @@ -621,7 +849,7 @@ Start from bottom if given a negative line number." "Open dired in a new frame." (interactive) (re/open-with-new-frame "DIRED" - #'(lambda () (interactive) (dired default-directory)))) + #'(lambda () (interactive) (dired default-directory)))) (keymap-global-set "" #'re/dired-new-frame) @@ -634,18 +862,18 @@ Start from bottom if given a negative line number." "Change sort order of dired dir." (interactive) (let ((smenu '(("name" . "-Ahl") - ("mdate" . "-Ahlt") - ("adate" . "-Ahltu") - ("size" . "-AhlS") - ("dir" . "-Ahl --group-directories-first"))) - ssortBy) + ("mdate" . "-Ahlt") + ("adate" . "-Ahltu") + ("size" . "-AhlS") + ("dir" . "-Ahl --group-directories-first"))) + ssortBy) (setq ssortBy (completing-read "Sort by (default name):" - smenu - nil - t - nil - nil - (caar smenu))) + smenu + nil + t + nil + nil + (caar smenu))) (dired-sort-other (cdr (assoc ssortBy smenu))))) (defun re/open-file-external (file) @@ -653,11 +881,11 @@ Start from bottom if given a negative line number." (interactive) (let ((process-connection-type nil)) (cond ((eq system-type 'windows-nt) - (w32-shell-execute "open" - (replace-regexp-in-string "/" "\\\\" file t t))) - ((eq system-type 'gnu/linux) - (start-process "" nil "xdg-open" file)) - (t (error "Unable to automatically open this file"))))) + (w32-shell-execute "open" + (replace-regexp-in-string "/" "\\\\" file t t))) + ((eq system-type 'gnu/linux) + (start-process "" nil "xdg-open" file)) + (t (error "Unable to automatically open this file"))))) (defun re/dired-open-externally () "Open the file at point in an external program." @@ -676,42 +904,42 @@ Start from bottom if given a negative line number." dired-kill-when-opening-new-dired-buffer t) (add-hook 'dired-mode-hook - (lambda () - (progn - (keymap-set dired-mode-map - "o" - #'re/dired-display-direction) - ;; Rename r,R+M(mv), chmod M>c, compress-to c>z - (keymap-set dired-mode-map - "z" - #'dired-do-compress-to) - (keymap-set dired-mode-map - "c" - #'dired-do-chmod) - (keymap-set dired-mode-map - "r" - #'dired-do-rename) - (keymap-set dired-mode-map - "M" - #'dired-do-rename) - ;; My add-on defuns - (keymap-set dired-mode-map - "s" - #'re/dired-sort) - (keymap-set dired-mode-map - "F" - #'re/dired-find-marked-files) - (keymap-set dired-mode-map - "M-C" - #'re/copy-with-mod-time) - (keymap-set dired-mode-map - "b" - #'re/dired-open-externally) - (keymap-set dired-mode-map - "B" - #'re/dired-open-marked-externally) - (dired-hide-details-mode t) - (hl-line-mode)))) + (lambda () + (progn + (keymap-set dired-mode-map + "o" + #'re/dired-display-direction) + ;; Rename r,R+M(mv), chmod M>c, compress-to c>z + (keymap-set dired-mode-map + "z" + #'dired-do-compress-to) + (keymap-set dired-mode-map + "c" + #'dired-do-chmod) + (keymap-set dired-mode-map + "r" + #'dired-do-rename) + (keymap-set dired-mode-map + "M" + #'dired-do-rename) + ;; My add-on defuns + (keymap-set dired-mode-map + "s" + #'re/dired-sort) + (keymap-set dired-mode-map + "F" + #'re/dired-find-marked-files) + (keymap-set dired-mode-map + "M-C" + #'re/copy-with-mod-time) + (keymap-set dired-mode-map + "b" + #'re/dired-open-externally) + (keymap-set dired-mode-map + "B" + #'re/dired-open-marked-externally) + (dired-hide-details-mode t) + (hl-line-mode)))) #+END_SRC * Bookmarks #+BEGIN_SRC emacs-lisp @@ -735,28 +963,28 @@ Start from bottom if given a negative line number." mouse-autoselect-window -0.25) (setq-default cursor-type 'hbar - cursor-in-non-selected-windows nil - mode-line-format - '("%e" - (:eval (propertize " " - 'face - (when (buffer-modified-p) - 'mode-line-highlight))) - " " - (:propertize (buffer-file-name "%f" "%b") - face - mode-line) - (vc-mode vc-mode) - mode-line-format-right-align - (:eval (number-to-string (line-number-at-pos (point-max)))) - "L @ %I%n %l,%C ")) + cursor-in-non-selected-windows nil + mode-line-format + '("%e" + (:eval (propertize " " + 'face + (when (buffer-modified-p) + 'mode-line-highlight))) + " " + (:propertize (buffer-file-name "%f" "%b") + face + mode-line) + (vc-mode vc-mode) + mode-line-format-right-align + (:eval (number-to-string (line-number-at-pos (point-max)))) + "L @ %I%n %l,%C ")) (setq prettify-symbols-alist '(("lambda" . 955) - ("delta" . 120517) - ("epsilon" . 120518) - ("->" . 8594) - ("<=" . 8804) - (">=" . 8805))) + ("delta" . 120517) + ("epsilon" . 120518) + ("->" . 8594) + ("<=" . 8804) + (">=" . 8805))) (global-prettify-symbols-mode t) #+END_SRC @@ -767,10 +995,10 @@ Start from bottom if given a negative line number." show-paren-style 'expression) (setq electric-pair-pairs '((?\" . ?\") - (?\‘ . ?\’) - (?\“ . ?\”) - (?\{ . ?\}) - (?\< . ?\>))) + (?\‘ . ?\’) + (?\“ . ?\”) + (?\{ . ?\}) + (?\< . ?\>))) #+END_SRC * Help #+BEGIN_SRC emacs-lisp @@ -793,11 +1021,11 @@ Start from bottom if given a negative line number." "Change all groups of blank lines to 1 blank line." (interactive) (save-excursion (mark-whole-buffer) - (replace-regexp "^\n+" - "\n" - nil - (region-beginning) - (region-end)))) + (replace-regexp "^\n+" + "\n" + nil + (region-beginning) + (region-end)))) ;; Cleanup on write (setq require-final-newline t) (add-hook 'before-save-hook #'re/flush-extra-lines) @@ -830,8 +1058,8 @@ Stolen from emacsredux.com." (interactive) (if (active-minibuffer-window) (if (minibufferp) - (minibuffer-keyboard-quit) - (abort-recursive-edit)) + (minibuffer-keyboard-quit) + (abort-recursive-edit)) (keyboard-quit))) (keymap-global-set " " #'re/keyboard-quit) ; Make C-g better @@ -846,7 +1074,7 @@ Stolen from emacsredux.com." Prompt for url and local dir." (interactive) (let* ((url (read-string "Repository URL: ")) - (dir (read-string "Local Dir: " (file-name-base url)))) + (dir (read-string "Local Dir: " (file-name-base url)))) (vc-git-clone url dir nil))) (defun re/vc-show-branches (&optional arg) @@ -854,14 +1082,14 @@ Prompt for url and local dir." Remotes as well when arg." (interactive "P") (let ((default-directory (if (boundp 'vc-dir-directory) - vc-dir-directory - default-directory))) + vc-dir-directory + default-directory))) (vc-git-command "*git-branches*" - nil - nil - "branch" - "--verbose" - (when arg "--remotes")) + nil + nil + "branch" + "--verbose" + (when arg "--remotes")) (pop-to-buffer "*git-branches*") (goto-char (point-min)) (special-mode))) @@ -872,16 +1100,16 @@ Allows separate fetch in addition to pull. Only care about git. With arg, ask for remote, otherwise fetch all." (interactive "P") (let* ((default-directory (if (boundp 'vc-dir-directory) - vc-dir-directory - default-directory))) + vc-dir-directory + default-directory))) (vc-git-command "*vc-fetch*" - nil - nil - "fetch" - (if arg - (read-string "Fetch From: " "origin") - "--all") - "--verbose") + nil + nil + "fetch" + (if arg + (read-string "Fetch From: " "origin") + "--all") + "--verbose") (pop-to-buffer "*vc-fetch*") (goto-char (point-min)) (special-mode))) @@ -896,17 +1124,17 @@ With arg, ask for remote, otherwise fetch all." (setq vc-git-root-log-format `("%d %h %ai %an: %s" - ;; The first shy group matches the characters drawn by --graph. - ;; We use numbered groups because `log-view-message-re' wants the - ;; revision number to be group 1. - ,(concat "^\\(?:[*/\\|]+\\)\\(?:[*/\\| ]+\\)?" - "\\(?2: ([^)]+) \\)?\\(?1:[0-9a-z]+\\) " - "\\(?4:[0-9]\\{4\\}-[0-9-]\\{4\\}[0-9\s+:-]\\{16\\}\\) " - "\\(?3:.*?\\):") - ((1 'log-view-message) - (2 'change-log-list nil lax) - (3 'change-log-name) - (4 'change-log-date)))) + ;; The first shy group matches the characters drawn by --graph. + ;; We use numbered groups because `log-view-message-re' wants the + ;; revision number to be group 1. + ,(concat "^\\(?:[*/\\|]+\\)\\(?:[*/\\| ]+\\)?" + "\\(?2: ([^)]+) \\)?\\(?1:[0-9a-z]+\\) " + "\\(?4:[0-9]\\{4\\}-[0-9-]\\{4\\}[0-9\s+:-]\\{16\\}\\) " + "\\(?3:.*?\\):") + ((1 'log-view-message) + (2 'change-log-list nil lax) + (3 'change-log-name) + (4 'change-log-date)))) (setq backup-directory-alist `((".*" . "~/emacs-backups/")) backup-by-copying t @@ -919,9 +1147,9 @@ With arg, ask for remote, otherwise fetch all." (keymap-global-set "C-x v f" #'re/vc-fetch) (add-hook 'vc-dir-mode-hook - (lambda () - (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches) - (keymap-set vc-dir-mode-map "f" #'re/vc-fetch))) + (lambda () + (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches) + (keymap-set vc-dir-mode-map "f" #'re/vc-fetch))) #+END_SRC * Any Lisp Repl #+BEGIN_SRC emacs-lisp @@ -953,13 +1181,13 @@ With arg, ask for remote, otherwise fetch all." Either delete, move forward, or add as many ')' as needed." (let ((distance (re/sexp-unbalanced-count))) (cond ((re/sexp-need-paren-p) - (if (looking-at ")") - (progn - (forward-char) - (re/balance-sexp)) - (insert-char 41 distance))) - ((re/sexp-drop-paren-p) - (backward-delete-char distance))))) + (if (looking-at ")") + (progn + (forward-char) + (re/balance-sexp)) + (insert-char 41 distance))) + ((re/sexp-drop-paren-p) + (backward-delete-char distance))))) (defmacro re/balance-and-eval-sexp (executor) "Balance the sexp before point, then call `executor'. @@ -979,35 +1207,35 @@ For a non-repl, use `newline' or similar." (dolist (hook *re/lisp-mode-hooks*) (add-hook hook - (lambda () - (when (bound-and-true-p acme-mouse-mode) (acme-mouse-mode -1)) - (sedit-mouse-mode 1) - (keymap-set lisp-mode-shared-map "C-M-z" #'eval-region) - (keymap-set lisp-mode-shared-map - "C-M-S-q" - #'sedit-auto-prettify-sexp) - (keymap-set lisp-mode-shared-map - "]" - (re/balance-and-eval-sexp #'sedit-auto-prettify-sexp)) - (keymap-set lisp-interaction-mode-map - "]" - (re/balance-and-eval-sexp #'eval-print-last-sexp))))) + (lambda () + (when (bound-and-true-p acme-mouse-mode) (acme-mouse-mode -1)) + (sedit-mouse-mode 1) + (keymap-set lisp-mode-shared-map "C-M-z" #'eval-region) + (keymap-set lisp-mode-shared-map + "C-M-S-q" + #'sedit-auto-prettify-sexp) + (keymap-set lisp-mode-shared-map + "]" + (re/balance-and-eval-sexp #'sedit-auto-prettify-sexp)) + (keymap-set lisp-interaction-mode-map + "]" + (re/balance-and-eval-sexp #'eval-print-last-sexp))))) #+END_SRC * IELM #+BEGIN_SRC emacs-lisp ;; IELM (add-hook 'ielm-mode-hook - (lambda () - (keymap-set inferior-emacs-lisp-mode-map - "C-l" - #'comint-clear-buffer) - (let ((eval-function #'ielm-send-input)) - (keymap-set inferior-emacs-lisp-mode-map - ")" - (re/send-on-close-paren eval-function)) - (keymap-set inferior-emacs-lisp-mode-map - "]" - (re/balance-and-eval-sexp eval-function))))) + (lambda () + (keymap-set inferior-emacs-lisp-mode-map + "C-l" + #'comint-clear-buffer) + (let ((eval-function #'ielm-send-input)) + (keymap-set inferior-emacs-lisp-mode-map + ")" + (re/send-on-close-paren eval-function)) + (keymap-set inferior-emacs-lisp-mode-map + "]" + (re/balance-and-eval-sexp eval-function))))) #+END_SRC * Eshell #+BEGIN_SRC emacs-lisp @@ -1015,15 +1243,15 @@ For a non-repl, use `newline' or similar." (keymap-global-set "C-c e" #'eshell) (add-hook 'eshell-mode-hook - (lambda () - (keymap-set eshell-mode-map "C-d" #'eshell-quit-or-delete-char) - (let ((eval-function #'eshell-send-input)) - (keymap-set eshell-mode-map - ")" - (re/send-on-close-paren eval-function)) - (keymap-set eshell-mode-map - "]" - (re/balance-and-eval-sexp eval-function))))) + (lambda () + (keymap-set eshell-mode-map "C-d" #'eshell-quit-or-delete-char) + (let ((eval-function #'eshell-send-input)) + (keymap-set eshell-mode-map + ")" + (re/send-on-close-paren eval-function)) + (keymap-set eshell-mode-map + "]" + (re/balance-and-eval-sexp eval-function))))) (defun eshell-quit-or-delete-char (arg) "Delete char if at one, quit eshell if on empty prompt. @@ -1043,23 +1271,23 @@ Stolen from https://depp.brause.cc/dotemacs" "Line up argument lists by tabs, not spaces. Stolen from https://kernel.org/doc/html/v4.10/process/coding-style.html" (let* ((anchor (c-langelem-pos c-syntactic-element)) - (column (c-langelem-2nd-pos c-syntactic-element)) - (offset (- (1+ column) anchor)) - (steps (floor offset c-basic-offset))) + (column (c-langelem-2nd-pos c-syntactic-element)) + (offset (- (1+ column) anchor)) + (steps (floor offset c-basic-offset))) (* (max steps 1) c-basic-offset))) (add-hook 'c-mode-common-hook - (lambda () - (c-add-style "linux-tabs-only" - '("linux" (c-offsets-alist - (arglist-cont-nonempty - c-lineup-gcc-asm-reg - re/c-lineup-arglist-tabs-only)))))) + (lambda () + (c-add-style "linux-tabs-only" + '("linux" (c-offsets-alist + (arglist-cont-nonempty + c-lineup-gcc-asm-reg + re/c-lineup-arglist-tabs-only)))))) (add-hook 'c-mode-hook - (lambda () - (setq c-backspace-function 'backward-delete-char) - (c-set-style "linux-tabs-only"))) + (lambda () + (setq c-backspace-function 'backward-delete-char) + (c-set-style "linux-tabs-only"))) #+END_SRC * Auto-Revert #+BEGIN_SRC emacs-lisp diff --git a/re/re-howm.el b/re/re-howm.el deleted file mode 100644 index aff9e5e..0000000 --- a/re/re-howm.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; re-howm.el -*- lexical-binding: t; -*- -;; This file is not part of GNU Emacs - -;;; Code: - -(setq howm-template-list '("= %title%cursor #inbox\n%date %file\n\n" - "= %title%cursor #meeting\n%date %file\n\nAttendees: \n" - "= @%title%cursor\n%date %file\n\n") - howm-template howm-template-list - howm-keyword-file "~/howm/.howm-keys" - howm-history-file "~/howm/.howm-history" - howm-menu-file "~/.emacs.d/0000-00-00-000000.txt" - howm-file-name-format "%Y%m%dT%H%M%S.txt" - howm-keyword-case-fold-search t - howm-remember-insertion-format "%s" - howm-menu-todo-num 10) - -(defun re/howm-menu-new-frame (&optional arg) - "Show the howm menu in a new frame" - (interactive "P") - (re/open-with-new-frame "HOWM" #'howm-menu)) - -(defun re/howm-create-keyword () - "Reads a keyword from the minibuffer and appends it to the keywords file." - (interactive) - (append-to-file (concat (read-string "New Keyword: ") - "\n") - nil - howm-keyword-file)) - -;; Menu tweaks - -;; add entries in howm-menu (press enter on the text) -(dolist (aldr-additions '(("\\[Mtg\\]" - (lambda (&optional dummy) - (howm-create 2))) - ("\\[Person\\]" - (lambda (&optional dummy) - (howm-create 3))))) - (add-to-list 'action-lock-default-rules - aldr-additions - t)) - -(defun re/howm-menu-legend () - (cl-labels ((p (text face) (propertize text 'font-lock-face face))) - (concat (format "Top %s" howm-menu-todo-num) - " " - (p "!Deadline" howm-reminder-deadline-face) - "/" - (p "+ToDo" howm-reminder-todo-face) - "/" - (p "@Schedule" howm-reminder-schedule-face) - "/" - (p "~Defer" howm-reminder-defer-face) - "/" - (p "-Reminder" howm-reminder-normal-face) - " Entries:"))) - -(add-to-list 'howm-menu-allow 're/howm-menu-legend) - -;; add coloring for custom "waiting" state -(add-to-list 'howm-reminder-font-lock-keywords - `(,(howm-reminder-regexp "[w]") - (0 howm-reminder-defer-face prepend)) - t) - -(dolist (hooks '(after-save-hook howm-mode-hook)) - (add-hook hooks 'howm-mode-set-buffer-name)) - -(provide 're-howm) -;;; re-howm.el ends here diff --git a/re/re-org.el b/re/re-org.el deleted file mode 100644 index ccc1b3d..0000000 --- a/re/re-org.el +++ /dev/null @@ -1,171 +0,0 @@ -;;; re-org.el --- org-mode bespokeniŋ -*- lexical-binding: t; -*- -;; This file is not part of GNU Emacs - -;;; Code: - -;; General options -(add-to-list 'org-export-backends 'md) - -(setq org-startup-indented t - org-indent-indentation-per-level tab-width - org-startup-folded 'fold - org-startup-with-inline-images t - org-cycle-inline-images-display t - org-cycle-separator-lines 0 - org-blank-before-new-entry '((heading) (plain-list-item . auto)) - org-M-RET-may-split-line nil - org-treat-S-cursor-todo-selection-as-state-change nil - org-treat-insert-todo-heading-as-state-change nil - org-table-export-default-format "orgtbl-to-csv" - org-list-allow-alphabetical t - org-fold-catch-invisible-edits 'show-and-error - org-ellipsis "↴" - org-tags-column 0 - org-reverse-note-order t - org-enforce-todo-dependencies t - org-enforce-todo-checkbox-dependencies t - org-fontify-done-headline nil - org-fontify-todo-headline nil - org-goto-interface 'outline-path-completion - org-outline-path-complete-in-steps nil - org-goto-auto-isearch nil - org-special-ctrl-a/e t - org-special-ctrl-k t - org-return-follows-link t - org-yank-adjusted-subtrees t) - -;; Time Clocking -(org-clock-persistence-insinuate) -(setq org-clock-history-length 10 - org-clock-in-resume t - org-clock-out-remove-zero-time-clocks t - org-clock-persist t - org-clock-persist-query-resume nil - org-clock-report-include-clocking-task t - org-time-stamp-rounding-minutes '(1 1)) - -;; Agenda and capture -(add-hook 'org-agenda-mode-hook #'hl-line-mode) - -(setq org-agenda-files (append '("~/org/") - (file-expand-wildcards "~/projects/*/")) - org-refile-targets '((nil :maxlevel . 9) - (org-agenda-files :maxlevel . 9)) - org-refile-use-outline-path 'file - org-refile-allow-creating-parent-nodes 'confirm - org-tag-alist '(("call" . ?c) - ("email" . ?e) - ("errand" . ?r) - ("jobpc" . ?j) - ("license" . ?l) - ("meeting" . ?m) - ("open" . ?o)) - org-tags-exclude-from-inheritance '("open") - org-todo-keywords '((sequence "TODO(t)" "WAITING(w@)" "|" "DONE(d)" "BELAYED(b@)" "GIVEN(g@)") - (sequence "MEETING(m)" "|" "MET(M)")) - org-todo-keyword-faces '(("WAITING" :foreground "#e85400" :weight bold) - ("MEETING" :foreground "#315e9a" :weight bold)) - org-agenda-restore-windows-after-quit t - org-agenda-start-on-weekday nil - org-agenda-compact-blocks t - org-agenda-span 'day - org-deadline-warning-days 30 - org-agenda-window-setup 'current-window - org-agenda-time-grid '((daily today remove-match) - (600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900) - " ――――― " - "") - org-agenda-tags-column 50 - org-agenda-skip-additional-timestamps-same-entry t - org-agenda-skip-deadline-if-done t - org-agenda-skip-scheduled-if-done t - org-agenda-prefix-format '((agenda . " %?-12t% s") - (todo . " ") - (tags . " ") - (search . " ")) - org-agenda-scheduled-leaders '("BOOKED: " "Booked %2d d. ago: ") - org-agenda-deadline-leaders '("DEADLINE: " "In %3d d.: " "%2d d. ago: ") - org-read-date-prefer-future 'time - org-agenda-custom-commands '(("f" "Maybe Someday" tags "someday" ((org-agenda-overriding-header "SOMEDAY:"))) - ("i" "Inbox" tags "inbox" ((org-agenda-overriding-header "INBOX:"))) - ("l" "Licenses" tags "license" ((org-agenda-overriding-header "LICENSES:"))) - ("n" "Next Actions" tags-todo "-recurring/TODO" ((org-agenda-overriding-header "NEXT:"))) - ("p" "JobPCs" tags "jobpc" ((org-agenda-overriding-header "JOB PCS:"))) - ("u" "Undertakings" tags "open" ((org-agenda-overriding-header "UNDERTAKINGS:"))) - ("w" "Waiting" todo "WAITING" ((org-agenda-overriding-header "WAITING:"))) - ("o" "Overview" ((agenda "") - (tags "inbox" ((org-agenda-overriding-header "\nINBOX:"))) - (tags-todo "-recurring/TODO" ((org-agenda-overriding-header "\nNEXT:") - (org-agenda-max-entries 10))) - (tags "open" ((org-agenda-overriding-header "\nUNDERTAKINGS:"))) - (todo "WAITING" ((org-agenda-overriding-header "\nWAITING:")))))) - org-agenda-start-with-log-mode t - org-agenda-log-mode-items '(closed clock state) - org-log-done 'time - org-log-into-drawer nil - org-log-state-notes-insert-after-drawers t - org-log-state-notes-into-drawer nil - org-capture-templates '(("i" "Inbox" entry - (file "gtd.org") - "* %^{Description} :inbox:\n%U\n%?" - :prepend t - :clock-in t - :clock-resume t) - ("m" "Meeting" entry - (file "gtd.org") - "* MEETING %^{Description} :meeting:\n%^{Scheduled:}T\n%?" - :prepend t - :clock-in t - :clock-resume t) - ("p" "Phone Call" entry - (file "gtd.org") - "* %^{Description} :call:\n%U\n%?" - :prepend t - :clock-in t - :clock-resume t))) - -;;; IDs -(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id - org-id-method 'ts - org-clone-delete-id t - org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format - org-attach-id-uuid-folder-format)) - -(defun re/org-auto-generate-ids-in-file () - "Add ID properties to all headlines in the current - file which do not already have one." - (interactive) - (org-map-entries 'org-id-get-create)) - -(defun re/org-save-all () - "Save all `org-agenda-files' without user confirmation." - (interactive) - (message "Saving all org-agenda-files buffers...") - (save-some-buffers t - (lambda () - (when (member (buffer-file-name) org-agenda-files) t))) - (message "Saving all org-agenda-files buffers... done")) - -(advice-add 'org-refile :after (lambda (&rest _) (re/org-save-all))) - -;; Archiving (use re/org-archive-all periodically) -(defun re/org-archive-all () - "Archive all tasks marked `DONE' in agenda files" - (interactive) - (message "Archiving all completed tasks in org-agenda-files...") - (org-map-entries (lambda () - (org-archive-subtree) - (setq org-map-continue-from (org-element-property - :begin - (org-element-at-point)))) - "/DONE" - 'agenda) - (message "Archiving all completed tasks in org-agenda-files... done")) - -(setq org-archive-location (concat "~/org/old.org_keep::datetree/") - org-agenda-text-search-extra-files '(agenda-archives)) - -(add-to-list 'auto-mode-alist '("\\.org_keep\\'" . org-mode)) - -(provide 're-org) -;;; re-org.el ends here -- 2.39.5