(write_entry): Added filename to Emacs output, in preperation for
multi-file support.
This commit is contained in:
parent
d79b1b6a48
commit
0bd520e5d7
2 changed files with 26 additions and 17 deletions
10
emacs.cc
10
emacs.cc
|
|
@ -4,6 +4,16 @@ namespace ledger {
|
||||||
|
|
||||||
void format_emacs_transactions::write_entry(entry_t& entry)
|
void format_emacs_transactions::write_entry(entry_t& entry)
|
||||||
{
|
{
|
||||||
|
int idx = entry.src_idx;
|
||||||
|
|
||||||
|
for (strings_list::iterator i = entry.journal->sources.begin();
|
||||||
|
i != entry.journal->sources.end();
|
||||||
|
i++)
|
||||||
|
if (! idx--) {
|
||||||
|
out << "\"" << *i << "\" ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
out << (((unsigned long)entry.beg_pos) + 1) << " ";
|
out << (((unsigned long)entry.beg_pos) + 1) << " ";
|
||||||
|
|
||||||
switch (entry.state) {
|
switch (entry.state) {
|
||||||
|
|
|
||||||
33
ledger.el
33
ledger.el
|
|
@ -232,7 +232,7 @@ Return the difference in the format of a time value."
|
||||||
(inhibit-read-only t)
|
(inhibit-read-only t)
|
||||||
cleared)
|
cleared)
|
||||||
(with-current-buffer ledger-buf
|
(with-current-buffer ledger-buf
|
||||||
(goto-char where)
|
(goto-char (cdr where))
|
||||||
(setq cleared (ledger-toggle-current 'pending)))
|
(setq cleared (ledger-toggle-current 'pending)))
|
||||||
(if cleared
|
(if cleared
|
||||||
(add-text-properties (line-beginning-position)
|
(add-text-properties (line-beginning-position)
|
||||||
|
|
@ -244,7 +244,7 @@ Return the difference in the format of a time value."
|
||||||
(forward-line)))
|
(forward-line)))
|
||||||
|
|
||||||
(defun ledger-auto-reconcile (balance date)
|
(defun ledger-auto-reconcile (balance date)
|
||||||
(interactive "sReconcile to balance (negative for a liability): \nsStatement date: ")
|
(interactive "sReconcile to balance (negative for a liability): \nsStatement date (default: now): ")
|
||||||
(let ((buffer ledger-buf)
|
(let ((buffer ledger-buf)
|
||||||
(account ledger-acct) cleared)
|
(account ledger-acct) cleared)
|
||||||
;; attempt to auto-reconcile in the background
|
;; attempt to auto-reconcile in the background
|
||||||
|
|
@ -275,7 +275,7 @@ Return the difference in the format of a time value."
|
||||||
(let ((inhibit-redisplay t))
|
(let ((inhibit-redisplay t))
|
||||||
(dolist (pos cleared)
|
(dolist (pos cleared)
|
||||||
(while (and (not (eobp))
|
(while (and (not (eobp))
|
||||||
(/= pos (get-text-property (point) 'where)))
|
(/= pos (cdr (get-text-property (point) 'where))))
|
||||||
(forward-line))
|
(forward-line))
|
||||||
(unless (eobp)
|
(unless (eobp)
|
||||||
(ledger-reconcile-toggle))))
|
(ledger-reconcile-toggle))))
|
||||||
|
|
@ -308,7 +308,7 @@ Return the difference in the format of a time value."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((where (get-text-property (point) 'where)))
|
(let ((where (get-text-property (point) 'where)))
|
||||||
(with-current-buffer ledger-buf
|
(with-current-buffer ledger-buf
|
||||||
(goto-char where)
|
(goto-char (cdr where))
|
||||||
(ledger-delete-current-entry))
|
(ledger-delete-current-entry))
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(goto-char (line-beginning-position))
|
(goto-char (line-beginning-position))
|
||||||
|
|
@ -319,7 +319,7 @@ Return the difference in the format of a time value."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((where (get-text-property (point) 'where)))
|
(let ((where (get-text-property (point) 'where)))
|
||||||
(switch-to-buffer-other-window ledger-buf)
|
(switch-to-buffer-other-window ledger-buf)
|
||||||
(goto-char where)))
|
(goto-char (cdr where))))
|
||||||
|
|
||||||
(defun ledger-reconcile-save ()
|
(defun ledger-reconcile-save ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
@ -337,7 +337,7 @@ Return the difference in the format of a time value."
|
||||||
(face (get-text-property (point) 'face)))
|
(face (get-text-property (point) 'face)))
|
||||||
(if (eq face 'bold)
|
(if (eq face 'bold)
|
||||||
(with-current-buffer ledger-buf
|
(with-current-buffer ledger-buf
|
||||||
(goto-char where)
|
(goto-char (cdr where))
|
||||||
(ledger-toggle-current 'cleared))))
|
(ledger-toggle-current 'cleared))))
|
||||||
(forward-line 1)))
|
(forward-line 1)))
|
||||||
(ledger-reconcile-save))
|
(ledger-reconcile-save))
|
||||||
|
|
@ -355,21 +355,20 @@ Return the difference in the format of a time value."
|
||||||
(error (buffer-string)))
|
(error (buffer-string)))
|
||||||
(read (current-buffer)))))))
|
(read (current-buffer)))))))
|
||||||
(dolist (item items)
|
(dolist (item items)
|
||||||
(dolist (xact (nthcdr 5 item))
|
(dolist (xact (nthcdr 6 item))
|
||||||
(let ((beg (point)))
|
(let ((beg (point))
|
||||||
|
(where (with-current-buffer buf
|
||||||
|
(cons (nth 0 item)
|
||||||
|
(copy-marker (nth 1 item))))))
|
||||||
(insert (format "%s %-30s %-25s %15s\n"
|
(insert (format "%s %-30s %-25s %15s\n"
|
||||||
(format-time-string "%m/%d" (nth 2 item))
|
(format-time-string "%m/%d" (nth 3 item))
|
||||||
(nth 4 item) (nth 0 xact) (nth 1 xact)))
|
(nth 5 item) (nth 0 xact) (nth 1 xact)))
|
||||||
(if (nth 1 item)
|
(if (nth 2 item)
|
||||||
(set-text-properties beg (1- (point))
|
(set-text-properties beg (1- (point))
|
||||||
(list 'face 'bold
|
(list 'face 'bold
|
||||||
'where
|
'where where))
|
||||||
(with-current-buffer buf
|
|
||||||
(copy-marker (nth 0 item)))))
|
|
||||||
(set-text-properties beg (1- (point))
|
(set-text-properties beg (1- (point))
|
||||||
(list 'where
|
(list 'where where))))))
|
||||||
(with-current-buffer buf
|
|
||||||
(copy-marker (nth 0 item)))))))))
|
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
(toggle-read-only t)))
|
(toggle-read-only t)))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue