summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-09-08 20:36:11 -0700
committerCraig Earls <enderw88@gmail.com>2014-09-08 20:36:11 -0700
commitad87ab16e4c25caa4b52a2905778ae4a275d69f9 (patch)
tree532172b0a47ad9a34703e71090915aa31a9fafbc
parent57e2ec55ebaf97a285d31391425db58a68a578fb (diff)
downloadfork-ledger-ad87ab16e4c25caa4b52a2905778ae4a275d69f9.tar.gz
fork-ledger-ad87ab16e4c25caa4b52a2905778ae4a275d69f9.tar.bz2
fork-ledger-ad87ab16e4c25caa4b52a2905778ae4a275d69f9.zip
New fortification is working.
Code pruned.
-rw-r--r--lisp/ledger-fontify.el54
-rw-r--r--lisp/ledger-fonts.el25
-rw-r--r--lisp/ledger-mode.el39
3 files changed, 27 insertions, 91 deletions
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index 7b9e121b..548881aa 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -35,33 +35,33 @@
:type 'boolean
:group 'ledger-fontification)
-(defun ledger-fontify-whole-buffer ()
- (interactive)
- (save-excursion
- (message "Ledger fontify whole buffer")
- (goto-char (point-min))
-
- (while (not (eobp))
- (cond ((looking-at ledger-xact-start-regex)
- (ledger-fontify-xact-at (point)))
- ((looking-at ledger-directive-start-regex)
- (ledger-fontify-directive-at (point))))
- (ledger-xact-next-xact-or-directive) ;; gets to beginning of next xact
- )))
-
-(defun ledger-fontify-activate ()
- "add hook to fontify after buffer changes"
- (interactive)
- (if (string= (format-mode-line 'mode-name) "Ledger")
- (progn
- (ledger-fontify-whole-buffer)
- (add-hook 'after-change-functions 'ledger-fontify-buffer-part)
- (add-hook 'before-change-functions 'ledger-fontify-ensure-activation)
- (message "ledger-fontify-activate called"))))
-
-(defun ledger-fontify-ensure-activation (beg end)
- (if (string= (format-mode-line 'mode-name) "Ledger")
- (add-hook 'after-change-functions 'ledger-fontify-buffer-part)))
+;; (defun ledger-fontify-whole-buffer ()
+;; (interactive)
+;; (save-excursion
+;; (message "Ledger fontify whole buffer")
+;; (goto-char (point-min))
+
+;; (while (not (eobp))
+;; (cond ((looking-at ledger-xact-start-regex)
+;; (ledger-fontify-xact-at (point)))
+;; ((looking-at ledger-directive-start-regex)
+;; (ledger-fontify-directive-at (point))))
+;; (ledger-xact-next-xact-or-directive) ;; gets to beginning of next xact
+;; )))
+
+;; (defun ledger-fontify-activate ()
+;; "add hook to fontify after buffer changes"
+;; (interactive)
+;; (if (string= (format-mode-line 'mode-name) "Ledger")
+;; (progn
+;; (ledger-fontify-whole-buffer)
+;; (add-hook 'after-change-functions 'ledger-fontify-buffer-part)
+;; (add-hook 'before-change-functions 'ledger-fontify-ensure-activation)
+;; (message "ledger-fontify-activate called"))))
+
+;; (defun ledger-fontify-ensure-activation (beg end)
+;; (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)
(save-excursion
diff --git a/lisp/ledger-fonts.el b/lisp/ledger-fonts.el
index 0c3b9861..b5495460 100644
--- a/lisp/ledger-fonts.el
+++ b/lisp/ledger-fonts.el
@@ -227,31 +227,6 @@
"Default face for pending (!) transactions in the reconcile window"
: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)
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index 94b1f591..08cbb950 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -307,56 +307,17 @@ 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)
-
- ;; (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 nil nil
(font-lock-fontify-region-function . ledger-fontify-buffer-part))))
- ;; (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)