diff --git a/CHANGES.md b/CHANGES.md
index 67631e65a2..0f57683f60 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -17,6 +17,7 @@ Core Changes:
Language Improvements:
+- bug(clojure) Now highlights `defn-` properly (#2438) [Josh Goebel][]
- enh(clojure) Add support for global definitions name (#2347) [Alexandre Grison][]
- enh(fortran) Support Fortran 77 style comments (#2416) [Josh Goebel][]
- (csharp) add support for `@identifier` style identifiers (#2414) [Josh Goebel][]
diff --git a/src/languages/clojure.js b/src/languages/clojure.js
index 00501124f2..5be1dfc517 100644
--- a/src/languages/clojure.js
+++ b/src/languages/clojure.js
@@ -94,6 +94,7 @@ export default function(hljs) {
var GLOBAL = {
beginKeywords: globals,
+ lexemes: SYMBOL_RE,
end: '(\\[|\\#|\\d|"|:|\\{|\\)|\\(|$)',
contains: [
{
diff --git a/src/lib/mode_compiler.js b/src/lib/mode_compiler.js
index b425b02952..d468022a28 100644
--- a/src/lib/mode_compiler.js
+++ b/src/lib/mode_compiler.js
@@ -83,7 +83,12 @@ export function compileLanguage(language) {
if (parent) {
if (mode.beginKeywords) {
- mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b';
+ // for languages with keywords that include non-word characters checking for
+ // a word boundary is not sufficient, so instead we check for a word boundary
+ // or whitespace - this does no harm in any case since our keyword engine
+ // doesn't allow spaces in keywords anyways and we still check for the boundary
+ // first
+ mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?=\\b|\\s)';
}
if (!mode.begin)
mode.begin = /\B|\b/;
diff --git a/test/markup/clojure/globals_definition.expect.txt b/test/markup/clojure/globals_definition.expect.txt
index dcc6cd11fe..5e54172d67 100644
--- a/test/markup/clojure/globals_definition.expect.txt
+++ b/test/markup/clojure/globals_definition.expect.txt
@@ -22,7 +22,7 @@
(defonce ^:private another-var #"foo")
-(defn- add [x y] (+ x y))
+(defn- add [x y] (+ x y))
(defprotocol Fly