branch: elpa/beancount commit 41039a8d7b08d8ddfdd1bd41363644b7590733a5 Author: blais <bl...@furius.ca> Commit: blais <bl...@furius.ca>
Added support for accounts in thing-at-point. --- beancount.el | 15 +++++++++++---- etc/emacsrc | 11 ----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/beancount.el b/beancount.el index c1d76dfef9..5e2c62b385 100644 --- a/beancount.el +++ b/beancount.el @@ -893,10 +893,16 @@ 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))))) +;; There is no length limit for links but it seems reasonable to +;; limit the search for the link to the 128 characters before and +;; after the point. This number is chosen arbitrarily. +(defun beancount--bounds-of-account-at-point () + (when (thing-at-point-looking-at beancount-account-regexp 128) + (cons (match-beginning 0) (match-end 0)))) + +(put 'beancount-account 'bounds-of-thing-at-point #'beancount--bounds-of-account-at-point) + (defun beancount--bounds-of-link-at-point () - ;; There is no length limit for links but it seems reasonable to - ;; limit the search for the link to the 128 characters before and - ;; after the point. This number is chosen arbitrarily. (when (thing-at-point-looking-at (concat "\\^[" beancount-tag-chars "]+") 128) (cons (match-beginning 0) (match-end 0)))) @@ -955,7 +961,7 @@ Only useful if you have not installed Beancount properly in your PATH.") (call-process beancount-price-program nil t nil (file-relative-name buffer-file-name))) -;;; Transaction highligh +;;; Transaction highlight. (defvar beancount-highlight-overlay (list)) (make-variable-buffer-local 'beancount-highlight-overlay) @@ -1112,6 +1118,7 @@ Essentially a much simplified version of `next-line'." (get-char-property (1- (point)) 'invisible)) (beginning-of-line 2))) + ;;; Fava (defvar beancount--fava-process nil) diff --git a/etc/emacsrc b/etc/emacsrc index cc062907fd..03c2b3cfab 100644 --- a/etc/emacsrc +++ b/etc/emacsrc @@ -56,17 +56,6 @@ ;; alignment column to be determined from file content. Postings in ;; transactions are indented with `beancount-transaction-indent` spaces. - -;; Register support for a 'beancount-account thing for (thing-at-point). -(put 'beancount-account 'bounds-of-thing-at-point - (lambda () - (let ((thing (thing-at-point-looking-at - beancount-account-regexp 500))) - (if thing - (let ((beginning (match-beginning 0)) - (end (match-end 0))) - (cons beginning end)))))) - (defadvice shell-quote-argument (around dont-quote-already-quoted-args activate) "Avoid quoting argument if it's already quoted." (let ((arg (ad-get-arg 0)))