Skip to content

Commit 2e800ee

Browse files
committed
workaround emacs 23 issues.
1 parent 2f0c84f commit 2e800ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rust-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,19 @@
326326
(defun rust-re-item-def (itype)
327327
(concat (rust-re-word itype) "[[:space:]]+" (rust-re-grab rust-re-ident)))
328328

329+
;; (See PR #42 -- this is just like `(regexp-opt words 'symbols)` from
330+
;; newer Emacs versions, but will work on Emacs 23.)
331+
(defun regexp-opt-symbols (words)
332+
(concat "\\_<" (regexp-opt words t) "\\_>"))
333+
329334
(defvar rust-mode-font-lock-keywords
330335
(append
331336
`(
332337
;; Keywords proper
333-
(,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face)
338+
(,(regexp-opt-symbols rust-mode-keywords) . font-lock-keyword-face)
334339

335340
;; Special types
336-
(,(regexp-opt rust-special-types 'symbols) . font-lock-type-face)
341+
(,(regexp-opt-symbols rust-special-types) . font-lock-type-face)
337342

338343
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
339344
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))

0 commit comments

Comments
 (0)