diff options
author | Craig Earls <enderw88@gmail.com> | 2013-06-03 16:39:36 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-06-03 16:39:36 -0700 |
commit | c23c994b2204d52ee5b2a947556045be79607239 (patch) | |
tree | 37a1e2f0b0a7deea88b6e533f202cd73f1221574 /lisp/ldg-post.el | |
parent | cb6f4b98900b0b2f0d4167a37a0153fb290f998e (diff) | |
download | fork-ledger-c23c994b2204d52ee5b2a947556045be79607239.tar.gz fork-ledger-c23c994b2204d52ee5b2a947556045be79607239.tar.bz2 fork-ledger-c23c994b2204d52ee5b2a947556045be79607239.zip |
Fix Bug 966 Auto Indent conflicts with undo. Removed the auto-indent function and added an indent xact function
Diffstat (limited to 'lisp/ldg-post.el')
-rw-r--r-- | lisp/ldg-post.el | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el index d83dc5ab..693b9e0e 100644 --- a/lisp/ldg-post.el +++ b/lisp/ldg-post.el @@ -31,11 +31,6 @@ "Options for controlling how Ledger-mode deals with postings and completion" :group 'ledger) -(defcustom ledger-post-auto-adjust-postings t - "If non-nil, adjust account and amount to columns set below" - :type 'boolean - :group 'ledger-post) - (defcustom ledger-post-account-alignment-column 4 "The column Ledger-mode attempts to align accounts to." :type 'integer @@ -141,6 +136,11 @@ at beginning of account" (goto-char (match-beginning 2))) (current-column)))) +(defun ledger-post-align-xact (pos) + (interactive "d") + (let ((bounds (ledger-find-xact-extents pos))) + (ledger-post-align-postings (car bounds) (cadr bounds)))) + (defun ledger-post-align-postings (&optional beg end) "Align all accounts and amounts within region, if there is no region align the posting on the current line." @@ -198,16 +198,6 @@ region align the posting on the current line." (setq inhibit-modification-hooks nil)))) -(defun ledger-post-maybe-align (beg end len) - "Align amounts only if point is in a posting. -BEG, END, and LEN control how far it can align." - (if ledger-post-auto-adjust-postings - (save-excursion - (goto-char beg) - (when (<= end (line-end-position)) - (goto-char (line-beginning-position)) - (if (looking-at ledger-post-line-regexp) - (ledger-post-align-postings)))))) (defun ledger-post-edit-amount () "Call 'calc-mode' and push the amount in the posting to the top of stack." @@ -248,7 +238,6 @@ BEG, END, and LEN control how far it can align." (defun ledger-post-setup () "Configure `ledger-mode' to auto-align postings." - (add-hook 'after-change-functions 'ledger-post-maybe-align t t) (add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil)) t t)) |