diff options
author | Steve Purcell <steve@sanityinc.com> | 2013-12-09 19:11:23 +0000 |
---|---|---|
committer | Steve Purcell <steve@sanityinc.com> | 2013-12-09 19:11:23 +0000 |
commit | a74053b01012216a99c25859eaf386c78d69e4da (patch) | |
tree | 39f96f84d466142f1f2b0029d677764624124a72 /lisp | |
parent | 0e5867bc5c164036d4a4efbcb6e38f713d9ebacd (diff) | |
download | fork-ledger-a74053b01012216a99c25859eaf386c78d69e4da.tar.gz fork-ledger-a74053b01012216a99c25859eaf386c78d69e4da.tar.bz2 fork-ledger-a74053b01012216a99c25859eaf386c78d69e4da.zip |
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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ledger-mode.el | 9 |
1 files changed, 9 insertions, 0 deletions
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) |