From ec8e89ba441495c79710c5fda7fd05d61a6787b6 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijn@haverbeke.nl>
Date: Mon, 2 Jan 2017 00:45:36 +0100
Subject: [PATCH] [closebrackets addon] Add override option

Closes #4478
---
 addon/edit/closebrackets.js | 2 +-
 doc/manual.html             | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/addon/edit/closebrackets.js b/addon/edit/closebrackets.js
index 7c47bcd0..62b99c1b 100644
--- a/addon/edit/closebrackets.js
+++ b/addon/edit/closebrackets.js
@@ -45,7 +45,7 @@
 
   function getConfig(cm) {
     var deflt = cm.state.closeBrackets;
-    if (!deflt) return null;
+    if (!deflt || deflt.override) return deflt;
     var mode = cm.getModeAt(cm.getCursor());
     return mode.closeBrackets || deflt;
   }
diff --git a/doc/manual.html b/doc/manual.html
index 98c16094..3c252381 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -2314,7 +2314,13 @@ editor.setOption("extraKeys", {
       it. <code>explode</code> should be a similar string that gives
       the pairs of characters that, when enter is pressed between
       them, should have the second character also moved to its own
-      line. <a href="../demo/closebrackets.html">Demo here</a>.</dd>
+      line. By default, if the active mode has
+      a <code>closeBrackets</code> property, that overrides the
+      configuration given in the option. But you can add
+      an <code>override</code> property with a truthy value to
+      override mode-specific
+      configuration. <a href="../demo/closebrackets.html">Demo
+      here</a>.</dd>
 
       <dt id="addon_matchtags"><a href="../addon/edit/matchtags.js"><code>edit/matchtags.js</code></a></dt>
       <dd>Defines an option <code>matchTags</code> that, when enabled,
-- 
GitLab