update packages
This commit is contained in:
@@ -304,11 +304,17 @@ an alist (ACCOUNT-ELEMENT . NODE)."
|
||||
(match-string 2) (match-string 3) (match-string 4)
|
||||
(match-string 5) (match-string 6)
|
||||
(= (line-end-position) (match-end 0)))))
|
||||
(;; Transaction comments
|
||||
(eq 'comment (car (cdr (ledger-context-at-point))))
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(setq start (point)))
|
||||
(setq collection (cons 'nullary #'ledger-comments-list)))
|
||||
(;; Payees
|
||||
(eq 'transaction
|
||||
(save-excursion
|
||||
(prog1 (ledger-thing-at-point)
|
||||
(setq start (point)))))
|
||||
(save-excursion
|
||||
(prog1 (ledger-thing-at-point)
|
||||
(setq start (point)))))
|
||||
(setq collection (cons 'nullary #'ledger-payees-list)))
|
||||
(;; Accounts
|
||||
(save-excursion
|
||||
@@ -322,10 +328,10 @@ an alist (ACCOUNT-ELEMENT . NODE)."
|
||||
(- (match-beginning 0) end)))
|
||||
realign-after t
|
||||
collection (cons 'nullary
|
||||
(if ledger-complete-in-steps
|
||||
(lambda ()
|
||||
(ledger-complete-account-next-steps start end))
|
||||
#'ledger-accounts-list)))))
|
||||
(if ledger-complete-in-steps
|
||||
(lambda ()
|
||||
(ledger-complete-account-next-steps start end))
|
||||
#'ledger-accounts-list)))))
|
||||
(when collection
|
||||
(let ((prefix (buffer-substring-no-properties start end)))
|
||||
(list start end
|
||||
@@ -352,6 +358,20 @@ an alist (ACCOUNT-ELEMENT . NODE)."
|
||||
(defun ledger-trim-trailing-whitespace (str)
|
||||
(replace-regexp-in-string "[ \t]*$" "" str))
|
||||
|
||||
(defun ledger-comments-list ()
|
||||
"Collect comments from the buffer."
|
||||
(let ((comments '()))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
;; FIXME: This only catches comments at beginning of lines and starting
|
||||
;; with some spaces (so "transaction comments"). There can also be
|
||||
;; comments after payees or prices too, as well as comments outside of
|
||||
;; transactions (the latter should be completed over separately).
|
||||
;; TODO: Unify this regex with `ledger-comment-regex'
|
||||
(while (re-search-forward "^[ \t]+\\(?1:;.+\\)$" nil t)
|
||||
(push (match-string-no-properties 1) comments)))
|
||||
(sort (delete-dups comments) #'string-lessp)))
|
||||
|
||||
(defun ledger-fully-complete-xact ()
|
||||
"Completes a transaction if there is another matching payee in the buffer.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user