Add toggle macro.
[name & more]
~(var ,name :private ,;more))
+(defmacro toggle
+ "Set a value to its boolean inverse. Same as `(set value (not value))`."
+ [value]
+ ~(set ,value (,not ,value)))
+
(defn defglobal
"Dynamically create a global def."
[name value]
:italics ["*" "*"]
:bold ["**" "**"]}))
(def modes @{})
- (defn toggle [mode]
+ (defn toggle-mode [mode]
(def active (get modes mode))
(def delims (get delimiters mode))
(put modes mode (not active))
(def token @"")
(var token-length 0)
(defn delim [mode]
- (def d (toggle mode))
+ (def d (toggle-mode mode))
(if-not has-color (+= token-length (length d)))
(buffer/push token d))
(defn endtoken []
