summaryrefslogtreecommitdiff
path: root/lisp/ledger-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ledger-mode.el')
-rw-r--r--lisp/ledger-mode.el37
1 files changed, 10 insertions, 27 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index 458c24b1..08cbb950 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -35,6 +35,7 @@
(require 'ledger-context)
(require 'ledger-exec)
(require 'ledger-fonts)
+(require 'ledger-fontify)
(require 'ledger-init)
(require 'ledger-occur)
(require 'ledger-post)
@@ -228,15 +229,6 @@ With a prefix argument, remove the effective date. "
(ledger-post-align-postings (point-min) (point-max))
(ledger-mode-remove-extra-lines))
-
-(defvar ledger-mode-syntax-table
- (let ((table (make-syntax-table)))
- ;; Support comments via the syntax table
- (modify-syntax-entry ?\; "< b" table)
- (modify-syntax-entry ?\n "> b" table)
- table)
- "Syntax table for `ledger-mode' buffers.")
-
(defvar ledger-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [(control ?c) (control ?a)] 'ledger-add-transaction)
@@ -315,38 +307,29 @@ 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)
-
- (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)
- (set (make-local-variable 'font-lock-defaults)
- '(ledger-font-lock-keywords nil t)))
- (setq font-lock-extend-region-functions
- (list #'font-lock-extend-region-wholelines))
- (setq font-lock-multiline nil)
-
- (set (make-local-variable 'pcomplete-parse-arguments-function)
- 'ledger-parse-arguments)
- (set (make-local-variable 'pcomplete-command-completion-function)
- 'ledger-complete-at-point)
+ (setq-local font-lock-defaults
+ '(ledger-font-lock-keywords t t nil nil
+ (font-lock-fontify-region-function . ledger-fontify-buffer-part))))
+
+ (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 'after-save-hook)
(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)
- (set (make-local-variable 'indent-region-function) 'ledger-post-align-postings))
+ (setq-local indent-region-function 'ledger-post-align-postings))
+
(defun ledger-set-year (newyear)