summaryrefslogtreecommitdiff
path: root/lisp/ledger-post.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ledger-post.el')
-rw-r--r--lisp/ledger-post.el53
1 files changed, 15 insertions, 38 deletions
diff --git a/lisp/ledger-post.el b/lisp/ledger-post.el
index ac040bb2..87e998cf 100644
--- a/lisp/ledger-post.el
+++ b/lisp/ledger-post.el
@@ -82,7 +82,6 @@ point at beginning of the commodity."
(- (or (match-end 4)
(match-end 3)) (point)))))
-
(defun ledger-next-account (&optional end)
"Move point to the beginning of the next account, or status marker (!*), as long as it is not past END.
Return the column of the beginning of the account and leave point
@@ -110,37 +109,35 @@ region align the posting on the current line."
(not (use-region-p)))
(set-mark (point)))
- (let* ((inhibit-modification-hooks t)
+ (let ((inhibit-modification-hooks t)
(mark-first (< (mark) (point)))
- (begin-region (if beg
- beg
- (if mark-first (mark) (point))))
- (end-region (if end
- end
- (if mark-first (point) (mark))))
acct-start-column acct-end-column acct-adjust amt-width amt-adjust
(lines-left 1))
+
+ (unless beg (setq beg (if mark-first (mark) (point))))
+ (unless end (setq end (if mark-first (mark) (point))))
;; Condition point and mark to the beginning and end of lines
- (goto-char end-region)
- (setq end-region (line-end-position))
- (goto-char begin-region)
+ (goto-char end)
+ (setq end (line-end-position))
+ (goto-char beg)
(goto-char
- (setq begin-region
+ (setq beg
(line-beginning-position)))
- (untabify begin-region end-region)
+ (untabify beg end)
- (goto-char end-region)
- (setq end-region (line-end-position))
- (goto-char begin-region)
+ ;; if untabify actually changed anything, then our begin and end are not correct.
+ (goto-char end)
+ (setq end (line-end-position))
+ (goto-char beg)
(goto-char
- (setq begin-region
+ (setq beg
(line-beginning-position)))
;; This is the guts of the alignment loop
(while (and (or (setq acct-start-column (ledger-next-account (line-end-position)))
lines-left)
- (< (point) end-region))
+ (< (point) end))
(when acct-start-column
(setq acct-end-column (save-excursion
(goto-char (match-end 2))
@@ -164,8 +161,6 @@ region align the posting on the current line."
(setq lines-left (not (eobp))))
(setq inhibit-modification-hooks nil))))
-
-
(defun ledger-post-edit-amount ()
"Call 'calc-mode' and push the amount in the posting to the top of stack."
(interactive)
@@ -186,24 +181,6 @@ region align the posting on the current line."
(insert " "))
(calc))))))
-(defun ledger-post-prev-xact ()
- "Move point to the previous transaction."
- (interactive)
- (backward-paragraph)
- (when (re-search-backward ledger-xact-line-regexp nil t)
- (goto-char (match-beginning 0))
- (re-search-forward ledger-post-line-regexp)
- (goto-char (match-end ledger-regex-post-line-group-account))))
-
-(defun ledger-post-next-xact ()
- "Move point to the next transaction."
- (interactive)
- (when (re-search-forward ledger-xact-line-regexp nil t)
- (goto-char (match-beginning 0))
- (re-search-forward ledger-post-line-regexp)
- (goto-char (match-end ledger-regex-post-line-group-account))))
-
-
(provide 'ledger-post)