summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-30 13:01:35 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-30 13:01:35 +0200
commit2e800ee9c8a38619dfdf58d03e6c4d5381f61196 (patch)
tree3b9ebc48c98f14958f3e507d5e67506295ccfbd3 /rust-mode.el
parent2f0c84fdccbfefe19611bb751af25a2401a79317 (diff)
downloadrust-mode-2e800ee9c8a38619dfdf58d03e6c4d5381f61196.tar.gz
workaround emacs 23 issues.
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 6df4ffc..27250a2 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -326,14 +326,19 @@
(defun rust-re-item-def (itype)
(concat (rust-re-word itype) "[[:space:]]+" (rust-re-grab rust-re-ident)))
+;; (See PR #42 -- this is just like `(regexp-opt words 'symbols)` from
+;; newer Emacs versions, but will work on Emacs 23.)
+(defun regexp-opt-symbols (words)
+ (concat "\\_<" (regexp-opt words t) "\\_>"))
+
(defvar rust-mode-font-lock-keywords
(append
`(
;; Keywords proper
- (,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face)
+ (,(regexp-opt-symbols rust-mode-keywords) . font-lock-keyword-face)
;; Special types
- (,(regexp-opt rust-special-types 'symbols) . font-lock-type-face)
+ (,(regexp-opt-symbols rust-special-types) . font-lock-type-face)
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))