summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Purcell <steve@sanityinc.com>2014-12-13 17:09:11 +0000
committerSteve Purcell <steve@sanityinc.com>2014-12-13 17:15:44 +0000
commitb0ab334ddf156350550985b7a4ef5c0e8636bcc2 (patch)
tree97b66059a24c8f3698d658ceba5021f9e9f10e2c
parentad7c5ea7646d50e157ddd95e632fc02880ec500a (diff)
downloadfork-ledger-b0ab334ddf156350550985b7a4ef5c0e8636bcc2.tar.gz
fork-ledger-b0ab334ddf156350550985b7a4ef5c0e8636bcc2.tar.bz2
fork-ledger-b0ab334ddf156350550985b7a4ef5c0e8636bcc2.zip
[emacs] Add syntax table so that ";" comments are handled
This allows things like goto-address-prog-mode to correctly highlight URLs inside comments.
-rw-r--r--lisp/ledger-mode.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index a85e0759..d14ea370 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -244,6 +244,13 @@ With a prefix argument, remove the effective date."
(goto-char start)
(search-forward target))))
+(defvar ledger-mode-syntax-table
+ (let ((table (make-syntax-table text-mode-syntax-table)))
+ (modify-syntax-entry ?\; "<" table)
+ (modify-syntax-entry ?\n ">" table)
+ table)
+ "Syntax table in use in `ledger-mode' buffers.")
+
(defvar ledger-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [(control ?c) (control ?a)] 'ledger-add-transaction)
@@ -322,10 +329,10 @@ 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)
+ (set-syntax-table ledger-mode-syntax-table)
(when (boundp 'font-lock-defaults)
(setq font-lock-defaults
'(ledger-font-lock-keywords t t nil nil