diff --git a/emacs/init.org b/emacs/init.org index 0f05638..2d15596 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -384,17 +384,20 @@ A function to kill all buffers except the current one from [[https://www.emacswi #+BEGIN_SRC emacs-lisp (jdormit/define-prefix "b" "buffer") - (leader-def-key "bb" 'switch-to-buffer) - (leader-def-key "bd" 'kill-buffer) - (leader-def-key "bm" 'kill-other-buffers) - (leader-def-key "br" 'rename-buffer) + (leader-def-key "bb" #'switch-to-buffer) + (leader-def-key "bn" #'next-buffer) + (leader-def-key "bp" #'previous-buffer) + (leader-def-key "bd" #'kill-buffer) + (leader-def-key "bm" #'kill-other-buffers) + (leader-def-key "br" #'rename-buffer) #+END_SRC ** Frame commands #+BEGIN_SRC emacs-lisp (jdormit/define-prefix "F" "frame") - (leader-def-key "Fn" 'make-frame-command) - (leader-def-key "Fm" 'delete-other-frames) - (leader-def-key "Fd" 'delete-frame) + (leader-def-key "Fn" #'make-frame-command) + (leader-def-key "Fo" #'other-frame) + (leader-def-key "Fm" #'delete-other-frames) + (leader-def-key "Fd" #'delete-frame) #+END_SRC ** Running shell commands @@ -791,7 +794,8 @@ Literate programming! (java . t) (js . t) (dot . t) - (ditaa . t))))) + (ditaa . t) + (ledger . t))))) #+END_SRC Get rid of the confirmation prompt: @@ -1308,6 +1312,44 @@ This mode requires that [[https://github.com/ledger/ledger][ledger]] be installe (variable-pitch-mode 0)))) #+END_SRC +** Importing +#+BEGIN_SRC emacs-lisp + (defvar ledger-file (expand-file-name "~/journal.ledger")) + + (defvar bank-alist + '(("DCU Checking" . ((acct . "Assets:Checking") + (fid . "9999"))) + ("DCU Savings" . ((acct . "Assets:Savings") + (fid . "9999"))) + ("DCU Visa" . ((acct . "Liabilities:DCU Visa") + (fid . "9999"))) + ("Chase Visa" . ((acct . "Liabilities:Chase Visa"))))) + + (defun ledger-import-ofx (bank file) + (interactive + (list + (ido-completing-read+ "Bank: " + (mapcar #'car bank-alist)) + (ido-read-file-name "OFX file: "))) + (if-let ((ledger-autosync (executable-find "ledger-autosync"))) + (let* ((bank-def (alist-get bank bank-alist)) + (acct (alist-get 'acct bank-def)) + (fid (alist-get 'fid bank-def)) + (cmd (concat + ledger-autosync + (if fid (concat " --fid " fid) "") + " --account '" acct "'" + " '" file "'")) + (output (shell-command-to-string cmd))) + (find-file ledger-file) + (goto-char (point-max)) + (insert "\n") + (insert output) + (ledger-sort-region (point-min) (point-max)) + (ledger-post-align-postings (point-min) (point-max))) + (error "Unable to find ledger-autosync"))) +#+END_SRC + * PDFs #+BEGIN_SRC emacs-lisp (use-package pdf-tools