mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
1.7 KiB
1.7 KiB
Separate tasks
(use-package doct)
(require 'org)
(defvar my/custom-task-templates
(doct `(("convert [p]aycheck"
:keys "p"
:file ,(my/agenda-file "puppet.org")
:template-file ,(my/org-file "templates/puppet/paycheck.org")))))
(defun my/run-custom-tasks ()
(interactive)
(let ((org-capture-templates my/custom-task-templates))
(call-interactively #'org-capture)))
(when my/puppet-p
(global-set-key (kbd "<f1>") #'my/run-custom-tasks))
Some Extra Bindings
(when my/puppet-p
(global-set-key (kbd "<f2>")
#'org-roam-node-find)
(global-set-key (kbd "<f3>")
#'(lambda ()
(interactive)
(find-file "~/plaintext/org/random/things_puppet_should_remember.org"))))
Add Ledger
(defun paycheck->ledger (file)
(interactive
(list (read-file-name "Paycheck file? ")))
(unless (string= "ledger.ledger"
(file-name-nondirectory
(buffer-file-name (current-buffer))))
(user-error "You're in the wrong file..."))
(unless (string= "pdf" (file-name-extension file))
(user-error "Oops, that's not a pdf file..."))
(let* ((buf (get-buffer-create "*output*"))
(res
(save-window-excursion
(shell-command (format "ledger-convert.el '%s'" file)
buf nil))))
(unless (eq res 0)
(user-error "Something went wrong with that file... Maybe ask Lambda?"))
(let ((str (with-current-buffer buf (buffer-string))))
(goto-char (point-max))
(insert "\n" str))))