From 54615284058e805b58e49f444a18ca3debc6090b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 27 Feb 2019 20:58:11 -0500 Subject: [PATCH 1/2] Implement ledger import --- emacs/init.org | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/emacs/init.org b/emacs/init.org index 8ee5eeb..0b58152 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -791,7 +791,8 @@ Literate programming! (java . t) (js . t) (dot . t) - (ditaa . t))))) + (ditaa . t) + (ledger . t))))) #+END_SRC Get rid of the confirmation prompt: @@ -1306,6 +1307,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 From 928c549feaada5d112d5a2982cdee1a4f3dc47bd Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 2 Mar 2019 12:45:46 -0500 Subject: [PATCH 2/2] Update buffer and frame keybindings --- emacs/init.org | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 0b58152..66644c0 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