From 56c5b74008bed643c09714770054c86f9d4719ae Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Tue, 12 Jul 2016 12:53:25 -0700 Subject: [PATCH] Reset memoization in post command hook --- smartparens.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/smartparens.el b/smartparens.el index f5e1dae6..9addda0c 100644 --- a/smartparens.el +++ b/smartparens.el @@ -2428,6 +2428,7 @@ should be highlighted." "Remove all pair overlays that doesn't have point inside them, are of zero length, or if point moved backwards." ;; if the point moved backwards, remove all overlays + (sp--reset-memoization) (if (and sp-cancel-autoskip-on-backward-movement (< (point) sp-previous-point)) (dolist (o sp-pair-overlay-list) (sp--remove-overlay o)) @@ -2440,6 +2441,11 @@ are of zero length, or if point moved backwards." (when sp-pair-overlay-list (setq sp-previous-point (point)))) +(defun sp--reset-memoization () + "Reset memoization as a safety precaution." + (setf (sp-state-last-syntax-ppss-point sp-state) nil + (sp-state-last-syntax-ppss-result sp-state) nil)) + (defun sp-remove-active-pair-overlay () "Deactivate the active overlay. See `sp--get-active-overlay'." (interactive)