diff options
author | Craig Earls <enderw88@gmail.com> | 2013-04-06 07:35:02 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-04-06 07:35:02 -0700 |
commit | 8b32a733a79c7f15883ecd414b61c417d44182ee (patch) | |
tree | 854d4d9f05db0d89a9b9e55351d4edbaf794c9d8 /lisp | |
parent | 896d1cc3ec22659f296efa03c962abe69e5dd6e1 (diff) | |
parent | f80fb99039e60869ae8497914baa25ca079e5483 (diff) | |
download | fork-ledger-8b32a733a79c7f15883ecd414b61c417d44182ee.tar.gz fork-ledger-8b32a733a79c7f15883ecd414b61c417d44182ee.tar.bz2 fork-ledger-8b32a733a79c7f15883ecd414b61c417d44182ee.zip |
Merge branch 'next' into ledger-mode-automatic-transactions
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-fonts.el | 11 | ||||
-rw-r--r-- | lisp/ldg-post.el | 43 |
2 files changed, 25 insertions, 29 deletions
diff --git a/lisp/ldg-fonts.el b/lisp/ldg-fonts.el index d83e7f9b..cb7a81c0 100644 --- a/lisp/ldg-fonts.el +++ b/lisp/ldg-fonts.el @@ -50,7 +50,7 @@ :group 'ledger-faces) (defface ledger-font-other-face - `((t :foreground "#657b83" :weight bold)) + `((t :foreground "#657b83" )) "Default face for other transactions" :group 'ledger-faces) @@ -126,15 +126,12 @@ (,ledger-account-pending-regex 2 'ledger-font-posting-account-pending-face) ; Works (,ledger-account-any-status-regex 2 - 'ledger-font-posting-account-face)) ; Works + 'ledger-font-posting-account-face) ; Works + (,ledger-other-entries-regex 1 + 'ledger-font-other-face)) "Expressions to highlight in Ledger mode.") -;; (defvar ledger-font-lock-keywords -;; `( (,ledger-other-entries-regex 1 -;; ledger-font-other-face)) -;; "Expressions to highlight in Ledger mode.") - (provide 'ldg-fonts) ;;; ldg-fonts.el ends here diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el index 18a70b1a..338264f5 100644 --- a/lisp/ldg-post.el +++ b/lisp/ldg-post.el @@ -160,7 +160,7 @@ region align the posting on the current line." (end-region (if end end (if mark-first (point) (mark)))) - acc-col amt-offset acc-adjust + acct-start-column acct-end-column acct-adjust amt-width (lines-left 1)) ;; Condition point and mark to the beginning and end of lines (goto-char end-region) @@ -171,29 +171,28 @@ region align the posting on the current line." (line-beginning-position))) ;; This is the guts of the alignment loop - (while (and (or (setq acc-col (ledger-next-account (line-end-position))) + (while (and (or (setq acct-start-column (ledger-next-account (line-end-position))) lines-left) (< (point) end-region)) - (when acc-col - (when (/= (setq acc-adjust (- ledger-post-account-alignment-column acc-col)) 0) - (if (> acc-adjust 0) - (insert (make-string acc-adjust ? )) - (delete-char acc-adjust))) - (when (setq amt-offset (ledger-next-amount (line-end-position))) - (let* ((amt-adjust (- ledger-post-amount-alignment-column - amt-offset - (current-column) - 2))) - (if (/= amt-adjust 0) - (if (> amt-adjust 0) - (insert (make-string amt-adjust ? )) - (let ((curpoint (point))) - (beginning-of-line) - (ledger-next-account (line-end-position)) - (when (> (+ curpoint amt-adjust) - (match-end 2)) - (goto-char curpoint) - (delete-char amt-adjust)))))))) + (when acct-start-column + (setq acct-end-column (save-excursion + (goto-char (match-end 2)) + (current-column))) + (when (/= (setq acct-adjust (- ledger-post-account-alignment-column acct-start-column)) 0) + (setq acct-end-column (+ acct-end-column acct-adjust)) ;;adjust the account ending column + (if (> acct-adjust 0) + (insert (make-string acct-adjust ? )) + (delete-char acct-adjust))) + (when (setq amt-width (ledger-next-amount (line-end-position))) + (if (/= 0 (setq amt-adjust (- (if (> (- ledger-post-amount-alignment-column amt-width) + (+ 2 acct-end-column)) + ledger-post-amount-alignment-column ;;we have room + (+ acct-end-column 2 amt-width)) + amt-width + (current-column)))) + (if (> amt-adjust 0) + (insert (make-string amt-adjust ? )) + (delete-char amt-adjust))))) (forward-line) (setq lines-left (not (eobp)))) (setq inhibit-modification-hooks nil)))) |