From a74053b01012216a99c25859eaf386c78d69e4da Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Mon, 9 Dec 2013 19:11:23 +0000 Subject: ledger-mode: define and use a syntax table so that comments are handled properly Specifically, functionality which uses syntax-ppss to detect comments needs the syntax table to be aware of them. A prime example is goto-address-prog-mode. This commit adds a basic syntax table for this purpose. --- lisp/ledger-mode.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lisp') diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el index a8a448b8..2f860f2f 100644 --- a/lisp/ledger-mode.el +++ b/lisp/ledger-mode.el @@ -168,6 +168,14 @@ Can indent, complete or align depending on context." (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.") + ;;;###autoload (define-derived-mode ledger-mode text-mode "Ledger" "A mode for editing ledger data files." @@ -175,6 +183,7 @@ Can indent, complete or align depending on context." (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) -- cgit v1.2.3