summaryrefslogtreecommitdiff
path: root/lisp/ldg-fonts.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-05-06 11:28:35 -0700
committerCraig Earls <enderw88@gmail.com>2013-05-06 11:28:35 -0700
commitfdbae766c17e779accbc9152aae689e738fc9ad0 (patch)
tree449f7781137cce1926073dab8c27de9d09547cb0 /lisp/ldg-fonts.el
parent6b10e2e9096b42aa11be0b7aec0e8789974a277b (diff)
downloadfork-ledger-fdbae766c17e779accbc9152aae689e738fc9ad0.tar.gz
fork-ledger-fdbae766c17e779accbc9152aae689e738fc9ad0.tar.bz2
fork-ledger-fdbae766c17e779accbc9152aae689e738fc9ad0.zip
Implement more efficient completion algorithm. Thanks Thierry! Also remove multi-comment font-locking for performance reasons.
Diffstat (limited to 'lisp/ldg-fonts.el')
-rw-r--r--lisp/ldg-fonts.el43
1 files changed, 8 insertions, 35 deletions
diff --git a/lisp/ldg-fonts.el b/lisp/ldg-fonts.el
index fc0b7813..ab0a3317 100644
--- a/lisp/ldg-fonts.el
+++ b/lisp/ldg-fonts.el
@@ -111,54 +111,27 @@
(defvar ledger-font-lock-keywords
- `( ;; (,ledger-other-entries-regex 1
+ `( ;; (,ledger-other-entries-regex 1
;; ledger-font-other-face)
(,ledger-comment-regex 0
'ledger-font-comment-face)
(,ledger-multiline-comment-regex 0 'ledger-font-comment-face)
- (,ledger-payee-pending-regex 2
+ (,ledger-payee-pending-regex 2
'ledger-font-payee-pending-face) ; Works
- (,ledger-payee-cleared-regex 2
+ (,ledger-payee-cleared-regex 2
'ledger-font-payee-cleared-face) ; Works
- (,ledger-payee-uncleared-regex 2
+ (,ledger-payee-uncleared-regex 2
'ledger-font-payee-uncleared-face) ; Works
- (,ledger-account-cleared-regex 2
+ (,ledger-account-cleared-regex 2
'ledger-font-posting-account-cleared-face) ; Works
- (,ledger-account-pending-regex 2
+ (,ledger-account-pending-regex 2
'ledger-font-posting-account-pending-face) ; Works
- (,ledger-account-any-status-regex 2
+ (,ledger-account-any-status-regex 2
'ledger-font-posting-account-face) ; Works
- (,ledger-other-entries-regex 1
+ (,ledger-other-entries-regex 1
'ledger-font-other-face))
"Expressions to highlight in Ledger mode.")
-(defun ledger-extend-region-multiline-comment ()
- "Adjusts the variables font-lock-beg and font-lock-end if they
- fall within a multiline comment. Returns non-nil if an
- adjustment is made."
- (let (beg end)
- ;; fix beg
- (save-excursion
- (goto-char font-lock-beg)
- (end-of-line)
- (when (re-search-backward ledger-multiline-comment-start-regex nil t)
- (setq beg (point))
- (re-search-forward ledger-multiline-comment-regex nil t)
- (if (and (>= (point) font-lock-beg)
- (/= beg font-lock-beg))
- (setq font-lock-beg beg)
- (setq beg nil))))
- ;; fix end
- (save-excursion
- (goto-char font-lock-end)
- (end-of-line)
- (when (re-search-backward ledger-multiline-comment-start-regex nil t)
- (re-search-forward ledger-multiline-comment-regex nil t)
- (setq end (point))
- (if (> end font-lock-end)
- (setq font-lock-end end)
- (setq end nil))))
- (or beg end)))
(provide 'ldg-fonts)