update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -184,26 +184,18 @@ an alist (ACCOUNT-ELEMENT . NODE)."
(nconc root (list node)))
(setq root (cdr node))))))))
(defun ledger-complete-account-next-steps ()
"Return a list of next steps for the account prefix at point."
;; FIXME: This function is called from `ledger-complete-at-point' which
;; already knows the bounds of the account name to complete. Computing it
;; again here is wasteful.
(let* ((current (buffer-substring
(save-excursion
(unless (eq 'posting (ledger-thing-at-point))
(error "Not on a posting line"))
(point))
(point)))
(defun ledger-complete-account-next-steps (start end)
"Return a list of next steps for the account prefix between START and END."
(let* ((current (buffer-substring start end))
(elements (and current (split-string current ":")))
(root (ledger-accounts-tree))
(prefix nil))
(while (cdr elements)
(let ((xact (assoc (car elements) root)))
(if xact
(let ((entry (assoc (car elements) root)))
(if entry
(setq prefix (concat prefix (and prefix ":")
(car elements))
root (cdr xact))
root (cdr entry))
(setq root nil elements nil)))
(setq elements (cdr elements)))
(setq root (delete (list (car elements) t) root))
@@ -314,9 +306,9 @@ an alist (ACCOUNT-ELEMENT . NODE)."
(= (line-end-position) (match-end 0)))))
(;; 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
@@ -330,9 +322,10 @@ an alist (ACCOUNT-ELEMENT . NODE)."
(- (match-beginning 0) end)))
realign-after t
collection (cons 'nullary
(if ledger-complete-in-steps
#'ledger-complete-account-next-steps
#'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

View File

@@ -65,7 +65,7 @@
(and (zerop exit-code)
(with-current-buffer ledger-output-buffer
(goto-char (point-min))
(not (and (> (buffer-size) 1) (looking-at (regexp-quote "While")))))))
(not (and (> (buffer-size) 1) (looking-at-p (regexp-quote "While")))))))
(defun ledger-exec-ledger (input-buffer &optional output-buffer &rest args)
"Run Ledger using INPUT-BUFFER.

View File

@@ -1,6 +1,7 @@
(define-package "ledger-mode" "20241114.1751" "Helper code for use with the \"ledger\" command-line tool"
;; -*- no-byte-compile: t; lexical-binding: nil -*-
(define-package "ledger-mode" "20250317.529"
"Helper code for use with the \"ledger\" command-line tool."
'((emacs "25.1"))
:commit "15b7d29f2539f9e9671ab3c062bd5165e5b80ae8")
;; Local Variables:
;; no-byte-compile: t
;; End:
:url "https://github.com/ledger/ledger-mode"
:commit "d9b664820176bf294fbca5ee99c91920862cf37d"
:revdesc "d9b664820176")

View File

@@ -4,6 +4,8 @@
;; This file is not part of GNU Emacs.
;; Package-Version: 20250317.529
;; Package-Revision: d9b664820176
;; Package-Requires: ((emacs "25.1"))
;; This is free software; you can redistribute it and/or modify it under

View File

@@ -32,8 +32,8 @@
"Move point to beginning of next xact."
;; make sure we actually move to the next xact, even if we are the
;; beginning of one now.
(if (looking-at ledger-payee-any-status-regex)
(forward-line))
(when (looking-at-p ledger-payee-any-status-regex)
(forward-line))
(if (re-search-forward ledger-payee-any-status-regex nil t)
(goto-char (match-beginning 0))
(goto-char (point-max))))
@@ -42,7 +42,7 @@
"Return t if at the beginning line of an xact or directive.
Assumes point is at the beginning of a line."
(not (looking-at "[ \t]\\|\\(^$\\)")))
(not (looking-at-p "[ \t]\\|\\(^$\\)")))
(defun ledger-navigate-next-xact-or-directive ()
"Move to the beginning of the next xact or directive."
@@ -72,7 +72,7 @@ Assumes point is at the beginning of a line."
;; need to start at the beginning of a line in case we are in the first line of an xact already.
(beginning-of-line)
(let ((sreg (concat "^[=~[:digit:]]")))
(unless (looking-at sreg)
(unless (looking-at-p sreg)
(re-search-backward sreg nil t)
(beginning-of-line)))
(point))
@@ -123,21 +123,20 @@ Requires empty line separating xacts."
;; handle block comments here
(goto-char begin)
(cond
((looking-at comment-re)
((looking-at-p comment-re)
(ledger-navigate-skip-lines-backwards comment-re)
;; We are either at the beginning of the buffer, or we found
;; a line outside the comment, or both. If we are outside
;; the comment then we need to move forward a line.
(unless (looking-at comment-re)
(unless (looking-at-p comment-re)
(forward-line 1)
(beginning-of-line))
(setq begin (point))
(goto-char pos)
(ledger-navigate-skip-lines-forwards comment-re)
(setq end (point)))
((looking-at "\\(?:comment\\|test\\)\\>")
(setq end (or (save-match-data
(re-search-forward "^end[[:blank:]]+\\(?:comment\\|test\\)\\_>"))
((looking-at-p "\\(?:comment\\|test\\)\\>")
(setq end (or (re-search-forward "^end[[:blank:]]+\\(?:comment\\|test\\)\\_>" nil t)
(point-max)))))
(list begin end)))
@@ -152,7 +151,7 @@ Requires empty line separating xacts."
(comment-re " *;"))
;; handle block comments here
(beginning-of-line)
(when (looking-at comment-re)
(when (looking-at-p comment-re)
(ledger-navigate-skip-lines-backwards comment-re)
(setq begin (point))
(goto-char pos)
@@ -169,14 +168,14 @@ Requires empty line separating xacts."
(goto-char pos)
(beginning-of-line)
(ledger-navigate-skip-lines-backwards "[ \t]\\|end[[:blank:]]+\\(?:comment\\|test\\)\\_>")
(if (looking-at "[=~0-9\\[]")
(if (looking-at-p "[=~0-9\\[]")
(ledger-navigate-find-xact-extents pos)
(ledger-navigate-find-directive-extents pos))))
(defun ledger-navigate-next-uncleared ()
"Move point to the next uncleared transaction."
(interactive)
(when (looking-at ledger-payee-uncleared-regex)
(when (looking-at-p ledger-payee-uncleared-regex)
(forward-line))
(if (re-search-forward ledger-payee-uncleared-regex nil t)
(progn (beginning-of-line)

View File

@@ -160,7 +160,7 @@ described above."
(defvar-local ledger-reconcile-last-balance-equals-target nil)
(defface ledger-reconcile-last-balance-equals-target-face
'((t :inherit header-line :foreground "green3"))
'((t :inherit (header-line success)))
"Face used for header line when cleared-or-pending balance equals the target."
:group 'ledger-reconcile)
@@ -509,7 +509,7 @@ Return a count of the uncleared transactions."
(ledger-exec-ledger buf (current-buffer)
"--uncleared" "--real" "emacs" "--sort" sort-by account)
(goto-char (point-min))
(when (and (not (eobp)) (looking-at "("))
(when (and (not (eobp)) (looking-at-p "("))
(read (current-buffer)))))
(fmt (ledger-reconcile-compile-format-string ledger-reconcile-buffer-line-format)))
(if (null xacts)

View File

@@ -299,13 +299,22 @@
(ledger-define-regexp commoditized-amount
(macroexpand
`(rx (group
(or (and (regexp ,ledger-commodity-no-group-regexp)
(*? blank)
(regexp ,ledger-amount-no-group-regexp))
(and (regexp ,ledger-amount-no-group-regexp)
(*? blank)
(regexp ,ledger-commodity-no-group-regexp))))))
"")
(or
;; Match commodity before amount, with optional
;; minus sign allowed before commodity.
;; Ex: "$100" or "-$100"
(and (opt ?-)
(regexp ,ledger-commodity-no-group-regexp)
(*? blank)
(regexp ,ledger-amount-no-group-regexp))
;; Match commodity after amount
;; Ex: "100 Dollars"
(and (regexp ,ledger-amount-no-group-regexp)
(*? blank)
(regexp ,ledger-commodity-no-group-regexp))))))
"Regexp to match a commodity with amount such as \"$100\" or \"100 Dollars\"")
(ledger-define-regexp commodity-annotations
(macroexpand

View File

@@ -81,7 +81,7 @@
;; make sure beg of region is at the beginning of a line
(beginning-of-line)
;; make sure point is at the beginning of a xact
(unless (looking-at ledger-payee-any-status-regex)
(unless (looking-at-p ledger-payee-any-status-regex)
(ledger-navigate-next-xact))
(setq beg (point))
(goto-char end)

View File

@@ -35,12 +35,12 @@
(defun ledger-transaction-state ()
"Return the state of the transaction at point."
(save-excursion
(when (or (looking-at "^[0-9]")
(when (or (looking-at-p "^[0-9]")
(re-search-backward "^[0-9]" nil t))
(skip-chars-forward "0-9./=\\-")
(skip-syntax-forward " ")
(cond ((looking-at "!\\s-*") 'pending)
((looking-at "\\*\\s-*") 'cleared)
(cond ((looking-at-p "!\\s-*") 'pending)
((looking-at-p "\\*\\s-*") 'cleared)
(t nil)))))
(defun ledger-posting-state ()
@@ -48,8 +48,8 @@
(save-excursion
(goto-char (line-beginning-position))
(skip-syntax-forward " ")
(cond ((looking-at "!\\s-*") 'pending)
((looking-at "\\*\\s-*") 'cleared)
(cond ((looking-at-p "!\\s-*") 'pending)
((looking-at-p "\\*\\s-*") 'cleared)
(t (ledger-transaction-state)))))
(defun ledger-char-from-state (state)
@@ -111,12 +111,12 @@ dropped."
(insert (make-string width ? ))))))
(forward-line)
;; Shift the cleared/pending status to the postings
(while (looking-at "[ \t]")
(while (looking-at-p "[ \t]")
(skip-chars-forward " \t")
(when (not (eq (ledger-state-from-char (char-after)) 'comment))
(insert (ledger-char-from-state cur-status) " ")
(if (and (search-forward " " (line-end-position) t)
(looking-at " "))
(looking-at-p " "))
(delete-char 2)))
(forward-line))
(setq new-status nil)))
@@ -126,7 +126,7 @@ dropped."
(setq inhibit-modification-hooks t)
(goto-char (line-beginning-position))
(when (looking-at "[ \t]")
(when (looking-at-p "[ \t]")
(skip-chars-forward " \t")
(let ((here (point))
(cur-status (ledger-state-from-char (char-after))))
@@ -154,11 +154,11 @@ dropped."
(re-search-forward "\\(\t\\| [ \t]\\)"
(line-end-position) t))
(cond
((looking-at "\t")
((looking-at-p "\t")
(delete-char 1))
((looking-at " [ \t]")
((looking-at-p " [ \t]")
(delete-char 2))
((looking-at " ")
((looking-at-p " ")
(delete-char 1))))
(setq new-status inserted))))
(setq inhibit-modification-hooks nil))
@@ -172,7 +172,7 @@ dropped."
(let ((first t)
(state nil)
(hetero nil))
(while (and (not hetero) (looking-at "[ \t]"))
(while (and (not hetero) (looking-at-p "[ \t]"))
(skip-chars-forward " \t")
(let ((cur-status (ledger-state-from-char (char-after))))
(if (not (eq cur-status 'comment))
@@ -185,7 +185,7 @@ dropped."
(when (and (not hetero) (not (eq state nil)))
(goto-char (car bounds))
(forward-line)
(while (looking-at "[ \t]")
(while (looking-at-p "[ \t]")
(skip-chars-forward " \t")
(let ((here (point)))
(skip-chars-forward "*! ")
@@ -204,11 +204,11 @@ dropped."
(if (re-search-forward "\\(\t\\| [ \t]\\)"
(line-end-position) t)
(cond
((looking-at "\t")
((looking-at-p "\t")
(delete-char 1))
((looking-at " [ \t]")
((looking-at-p " [ \t]")
(delete-char 2))
((looking-at " ")
((looking-at-p " ")
(delete-char 1)))))))
new-status))
@@ -224,7 +224,7 @@ dropped."
(forward-line)
(beginning-of-line)
(while (< (point) end)
(when (looking-at "\\s-+[*!]")
(when (looking-at-p "\\s-+[*!]")
(ledger-toggle-current-posting style))
(forward-line)))
(set-marker end nil)
@@ -235,7 +235,7 @@ dropped."
"Toggle the transaction at point using optional STYLE."
(interactive)
(save-excursion
(when (or (looking-at "^[0-9]")
(when (or (looking-at-p "^[0-9]")
(re-search-backward "^[0-9]" nil t))
(skip-chars-forward "0-9./=\\-")
(delete-horizontal-space)

View File

@@ -140,7 +140,7 @@
(data-file ledger-texi-sample-doc-path))
(goto-char (match-end 0))
(forward-line)
(when (looking-at "@\\(\\(?:small\\)?example\\)")
(when (looking-at-p "@\\(\\(?:small\\)?example\\)")
(let ((beg (point)))
(re-search-forward "^@end \\(\\(?:small\\)?example\\)")
(delete-region beg (1+ (point)))))

View File

@@ -208,7 +208,7 @@ the \\[universal-argument] enables INSERT-AT-POINT."
(push-mark)
;; TODO: what about when it can't be parsed?
(ledger-xact-find-slot (or parsed-date date))
(when (looking-at "\n*\\'")
(when (looking-at-p "\n*\\'")
(setq separator ""))))
(if (cdr args)
(save-excursion