summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-fontify.el2
-rw-r--r--lisp/ledger-fonts.el84
-rw-r--r--lisp/ledger-mode.el58
3 files changed, 89 insertions, 55 deletions
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index f282167e..7621b448 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -63,7 +63,7 @@
(if (string= (format-mode-line 'mode-name) "Ledger")
(add-hook 'after-change-functions 'ledger-fontify-buffer-part)))
-(defun ledger-fontify-buffer-part (beg end len)
+(defun ledger-fontify-buffer-part (beg end)
(save-excursion
;; (message (concat "ledger-fontify-buffer-part: "
;; (int-to-string beg) " "
diff --git a/lisp/ledger-fonts.el b/lisp/ledger-fonts.el
index 5725db09..0c3b9861 100644
--- a/lisp/ledger-fonts.el
+++ b/lisp/ledger-fonts.el
@@ -228,48 +228,48 @@
:group 'ledger-faces)
-;; (defvar ledger-font-lock-keywords
-;; `( ;; (,ledger-other-entries-regex 1
-;; ;; ledger-font-other-face)
-;; (,ledger-comment-regex 0
-;; 'ledger-font-comment-face)
-;; (,ledger-amount-regex 0
-;; 'ledger-font-posting-amount-face)
-;; (,ledger-multiline-comment-regex 0 'ledger-font-comment-face)
-;; (,ledger-payee-pending-regex 2
-;; 'ledger-font-payee-pending-face) ; Works
-;; (,ledger-payee-cleared-regex 2
-;; 'ledger-font-payee-cleared-face) ; Works
-;; (,ledger-payee-uncleared-regex 2
-;; 'ledger-font-payee-uncleared-face) ; Works
-;; (,ledger-account-cleared-regex 2
-;; 'ledger-font-posting-account-cleared-face) ; Works
-;; (,ledger-account-pending-regex 2
-;; 'ledger-font-posting-account-pending-face) ; Works
-;; (,ledger-account-any-status-regex 2
-;; 'ledger-font-posting-account-face) ; Works
-;; (,ledger-other-entries-regex 1
-;; 'ledger-font-other-face))
-;; "Expressions to highlight in Ledger mode.")
-
-(defvar ledger-font-lock-keywords
- `(("account" . ledger-font-account-directive-face)
- ("apply" . ledger-font-apply-directive-face)
- ("alias" . ledger-font-alias-directive-face)
- ("assert" . ledger-font-assert-directive-face)
- ("bucket" . ledger-font-bucket-directive-face)
- ("capture" . ledger-font-capture-directive-face)
- ("check" . ledger-font-check-directive-face)
- ("commodity" . ledger-font-commodity-directive-face)
- ("define" . ledger-font-define-directive-face)
- ("end" . ledger-font-end-directive-face)
- ("expr" . ledger-font-expr-directive-face)
- ("fixed" . ledger-font-fixed-directive-face)
- ("include" . ledger-font-include-directive-face)
- ("payee" . ledger-font-payee-directive-face)
- ("tag" . ledger-font-tag-directive-face)
- ("year" . ledger-font-year-directive-face))
- "Expressions to highlight in Ledger mode.")
+ ;; (defvar ledger-font-lock-keywords
+ ;; `( ;; (,ledger-other-entries-regex 1
+ ;; ;; ledger-font-other-face)
+ ;; (,ledger-comment-regex 0
+ ;; 'ledger-font-comment-face)
+ ;; (,ledger-amount-regex 0
+ ;; 'ledger-font-posting-amount-face)
+ ;; (,ledger-multiline-comment-regex 0 'ledger-font-comment-face)
+ ;; (,ledger-payee-pending-regex 2
+ ;; 'ledger-font-payee-pending-face) ; Works
+ ;; (,ledger-payee-cleared-regex 2
+ ;; 'ledger-font-payee-cleared-face) ; Works
+ ;; (,ledger-payee-uncleared-regex 2
+ ;; 'ledger-font-payee-uncleared-face) ; Works
+ ;; (,ledger-account-cleared-regex 2
+ ;; 'ledger-font-posting-account-cleared-face) ; Works
+ ;; (,ledger-account-pending-regex 2
+ ;; 'ledger-font-posting-account-pending-face) ; Works
+ ;; (,ledger-account-any-status-regex 2
+ ;; 'ledger-font-posting-account-face) ; Works
+ ;; (,ledger-other-entries-regex 1
+ ;; 'ledger-font-other-face))
+ ;; "Expressions to highlight in Ledger mode.")
+
+ (defvar ledger-font-lock-keywords
+ `(("account" . ledger-font-account-directive-face)
+ ("apply" . ledger-font-apply-directive-face)
+ ("alias" . ledger-font-alias-directive-face)
+ ("assert" . ledger-font-assert-directive-face)
+ ("bucket" . ledger-font-bucket-directive-face)
+ ("capture" . ledger-font-capture-directive-face)
+ ("check" . ledger-font-check-directive-face)
+ ("commodity" . ledger-font-commodity-directive-face)
+ ("define" . ledger-font-define-directive-face)
+ ("end" . ledger-font-end-directive-face)
+ ("expr" . ledger-font-expr-directive-face)
+ ("fixed" . ledger-font-fixed-directive-face)
+ ("include" . ledger-font-include-directive-face)
+ ("payee" . ledger-font-payee-directive-face)
+ ("tag" . ledger-font-tag-directive-face)
+ ("year" . ledger-font-year-directive-face))
+ "Expressions to highlight in Ledger mode.")
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index 46b7e677..1f6d8c32 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -307,16 +307,58 @@ With a prefix argument, remove the effective date. "
["Kill Report" ledger-report-kill ledger-works]))
;;;###autoload
+;; (define-derived-mode ledger-mode text-mode "Ledger"
+;; "A mode for editing ledger data files."
+;; (ledger-check-version)
+;; (ledger-schedule-check-available)
+;; ;;(ledger-post-setup)
+
+;; (setq-local pcomplete-parse-arguments-function 'ledger-parse-arguments)
+;; (setq-local pcomplete-command-completion-function 'ledger-complete-at-point)
+;; (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
+
+;; (add-hook 'after-save-hook 'ledger-report-redo)
+
+;; (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t)
+;; (add-hook 'before-revert-hook 'ledger-occur-remove-all-overlays nil t)
+
+;; (ledger-init-load-init-file)
+
+;; ;; (setq font-lock-defaults
+;; ;; `(,ledger-font-lock-keywords t nil nil nil
+;; ;; (font-lock-fontify-buffer-function . ledger-fontify-whole-buffer)
+;; ;; (font-lock-fontify-region-function . ledger-fontify-buffer-part)))
+
+;; ;; (setq-local font-lock-defaults `(,ledger-font-lock-keywords nil t nil nil
+;; ;; (font-lock-fontify-buffer-function . ledger-fontify-whole-buffer)))
+
+;; (setq-local indent-region-function 'ledger-post-align-postings))
+
(define-derived-mode ledger-mode text-mode "Ledger"
"A mode for editing ledger data files."
(ledger-check-version)
(ledger-schedule-check-available)
;;(ledger-post-setup)
- (setq-local pcomplete-parse-arguments-function 'ledger-parse-arguments)
- (setq-local pcomplete-command-completion-function 'ledger-complete-at-point)
- (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
+ ;; (set-syntax-table ledger-mode-syntax-table)
+ ;; (set (make-local-variable 'comment-start) "; ")
+ ;; (set (make-local-variable 'comment-end) "")
+ ;; (set (make-local-variable 'indent-tabs-mode) nil)
+
+ (if (boundp 'font-lock-defaults)
+ (setq-local font-lock-defaults
+ '(ledger-font-lock-keywords t t)))
+
+ ;; (setq font-lock-extend-region-functions
+ ;; (list #'font-lock-extend-region-wholelines))
+ ;; (setq font-lock-multiline nil)
+ (jit-lock-register 'ledger-fontify-buffer-part)
+ (jit-lock-unregister 'font-lock-fontify-region)
+
+ (setq-local pcomplete-parse-arguments-function 'ledger-parse-arguments)
+ (setq-local pcomplete-command-completion-function 'ledger-complete-at-point)
+ (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
(add-hook 'after-save-hook 'ledger-report-redo)
(add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t)
@@ -324,16 +366,8 @@ With a prefix argument, remove the effective date. "
(ledger-init-load-init-file)
- ;; (setq font-lock-defaults
- ;; `(,ledger-font-lock-keywords t nil nil nil
- ;; (font-lock-fontify-buffer-function . ledger-fontify-whole-buffer)
- ;; (font-lock-fontify-region-function . ledger-fontify-buffer-part)))
-
- ;; (setq-local font-lock-defaults `(,ledger-font-lock-keywords nil t nil nil
- ;; (font-lock-fontify-buffer-function . ledger-fontify-whole-buffer)))
+ (setq-local indent-region-function 'ledger-post-align-postings))
- (setq-local indent-region-function 'ledger-post-align-postings)
- (ledger-fontify-activate))
(defun ledger-set-year (newyear)