emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/beancount bde2d6c499 089/103: Add function to jump to prev


From: ELPA Syncer
Subject: [nongnu] elpa/beancount bde2d6c499 089/103: Add function to jump to previous transaction
Date: Mon, 29 Apr 2024 15:59:48 -0400 (EDT)

branch: elpa/beancount
commit bde2d6c499ce630e4cc4beb79c0dffef2217e7b8
Author: Debanjum Singh Solanky <debanjum@gmail.com>
Commit: Daniele Nicolodi <daniele@grinta.net>

    Add function to jump to previous transaction
    
    This function mirrors the existing `beancount-goto-next-transaction'
---
 beancount.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/beancount.el b/beancount.el
index c3f5614ec4..810dbc8f49 100644
--- a/beancount.el
+++ b/beancount.el
@@ -425,6 +425,20 @@ With an argument move to the next non cleared transaction."
         (setq done t)))
     (if (not done) (goto-char (point-max)))))
 
+(defun beancount-goto-previous-transaction (&optional arg)
+  "Move to the previous transaction.
+With an argument move to the previous non cleared transaction."
+  (interactive "P")
+  (beancount-goto-transaction-begin)
+  (let ((done nil))
+    (while (and (not done)
+                (re-search-backward beancount-transaction-regexp nil t))
+      (if (and arg (string-equal (match-string 2) "*"))
+          (goto-char (match-beginning 0))
+        (goto-char (match-beginning 0))
+        (setq done t)))
+    (if (not done) (goto-char (point-min)))))
+
 (defun beancount-find-transaction-extents (p)
   (save-excursion
     (goto-char p)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]