[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/beancount dcb317ed0a 064/103: If the cursor is over a link
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/beancount dcb317ed0a 064/103: If the cursor is over a link, invoke 'bean-doctor linked' command with the link |
Date: |
Mon, 29 Apr 2024 15:59:46 -0400 (EDT) |
branch: elpa/beancount
commit dcb317ed0a7582243f30ffc44aaf31717a81502b
Author: Martin Blais <blais@furius.ca>
Commit: Martin Blais <blais@furius.ca>
If the cursor is over a link, invoke 'bean-doctor linked' command with the
link
instead of the line number.
Note that the result is different from invocation over a line number, which
pulls all the related transactions through any link, recursively. If you
specify
a link, only the transactions with that particular link will be included.
---
beancount.el | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/beancount.el b/beancount.el
index 9ac5c1484d..0ba8d88784 100644
--- a/beancount.el
+++ b/beancount.el
@@ -33,6 +33,7 @@
(autoload 'ido-completing-read "ido")
(require 'subr-x)
(require 'outline)
+(require 'thingatpt)
(defgroup beancount ()
"Editing mode for Beancount files."
@@ -317,11 +318,11 @@ from the open directive for the relevant account."
(setq-local tab-always-indent 'complete)
(setq-local completion-ignore-case t)
-
+
(add-hook 'completion-at-point-functions #'beancount-completion-at-point nil
t)
(add-hook 'post-command-hook #'beancount-highlight-transaction-at-point nil
t)
(add-hook 'post-self-insert-hook #'beancount--electric-currency nil t)
-
+
(setq-local font-lock-defaults '(beancount-font-lock-keywords))
(setq-local font-lock-syntax-table t)
@@ -839,14 +840,21 @@ Only useful if you have not installed Beancount properly
in your PATH.")
(file-relative-name buffer-file-name)
(number-to-string (line-number-at-pos)))))
+;; Define a type for (thing-at-point) for Beancount links.
+(defvar beancount-link-chars "[:alnum:]-_\\.\\^"
+ "Characters allowable in Beancount links.")
+
+(define-thing-chars beancount-link beancount-link-chars)
(defun beancount-linked ()
"Get the \"linked\" info from `beancount-doctor-program'."
(interactive)
- (let ((compilation-read-command nil))
- (beancount--run beancount-doctor-program "linked"
- (file-relative-name buffer-file-name)
- (number-to-string (line-number-at-pos)))))
+ (let* ((word (thing-at-point 'beancount-link))
+ (link (when (and word (string-match "\\^" word)) word)))
+ (let ((compilation-read-command nil))
+ (beancount--run beancount-doctor-program "linked"
+ (file-relative-name buffer-file-name)
+ (or link (number-to-string (line-number-at-pos)))))))
(defvar beancount-price-program "bean-price"
"Program to run the price fetching commands.")
- [nongnu] elpa/beancount d4db16f0ee 042/103: beancount.el: Fix fontification of outline headings, (continued)
- [nongnu] elpa/beancount d4db16f0ee 042/103: beancount.el: Fix fontification of outline headings, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 35d127f8fe 048/103: beancount.el: Add imenu support, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount d51963d156 052/103: beancount.el: Remove redundant :group, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 70d4878171 051/103: Merged in default (pull request #133), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount b377d14caf 047/103: (merge), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount ba6bada870 058/103: beancount.el: Rework imenu support and add tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 05d4798156 059/103: (emacs) Added experimental beancount-mode support for running a journal for the account under the cursor., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7410724924 065/103: beancount-region: Added bindings for region_value variant., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 9508e5640c 060/103: Add README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 3c04745fa5 069/103: Add missing paren to configuration example in README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dcb317ed0a 064/103: If the cursor is over a link, invoke 'bean-doctor linked' command with the link,
ELPA Syncer <=
- [nongnu] elpa/beancount 5ff509075d 063/103: Fixes to /etc, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7785e8803f 067/103: Improve thing-at-point definition for beancount-link, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 194a9e9697 061/103: Added license., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 90c3992269 076/103: Fix imenu tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 5be04a37d6 081/103: (Merge branch 'main' into cost), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7b8f02ebcd 077/103: Cleanup faces definitions, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dbafe6a73d 082/103: Shift beancount-insert-date by DAYS from today using prefix args, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount e32e44e8d2 092/103: Added personal binding to aggregate balance binding., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 73b2afcff6 087/103: (Merge remote-tracking branch 'github/main'), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 42edc5bf07 083/103: Align amounts in balance directives in the same way as in postings, ELPA Syncer, 2024/04/29