summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2013-05-17 12:33:12 +0800
committerLeo Liu <sdl.web@gmail.com>2013-05-17 12:33:12 +0800
commite219dd97020be9d2f7bc51de9915d77d56732b66 (patch)
treee98ad63a337a173ee03b0fc2ee3f87b659a59839 /lisp
parentdc5dcb4bc598fa54dcd05becac2f04fcd03e8fcc (diff)
downloademacs-e219dd97020be9d2f7bc51de9915d77d56732b66.tar.gz
emacs-e219dd97020be9d2f7bc51de9915d77d56732b66.tar.bz2
emacs-e219dd97020be9d2f7bc51de9915d77d56732b66.zip
* emacs-lisp/smie.el (smie-highlight-matching-block-mode): Clean
up when turned off. (smie--highlight-matching-block-overlay): No longer buffer-local. (smie-highlight-matching-block): Adjust. Fixes: debbugs:14395
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/smie.el18
2 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c4e5390267b..12ae5239f13 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-17 Leo Liu <sdl.web@gmail.com>
+
+ * emacs-lisp/smie.el (smie-highlight-matching-block-mode): Clean
+ up when turned off. (Bug#14395)
+ (smie--highlight-matching-block-overlay): No longer buffer-local.
+ (smie-highlight-matching-block): Adjust.
+
2013-05-17 Paul Eggert <eggert@cs.ucla.edu>
Doc string fix for "nanoseconds" (Bug#14406).
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 2113457869e..b0883995532 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1025,7 +1025,7 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
"Face used to highlight matching block."
:group 'smie)
-(defvar-local smie--highlight-matching-block-overlay nil)
+(defvar smie--highlight-matching-block-overlay nil)
(defvar-local smie--highlight-matching-block-lastpos -1)
(defun smie-highlight-matching-block ()
@@ -1056,7 +1056,8 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
nil))))
(highlight
(lambda (beg end)
- (move-overlay smie--highlight-matching-block-overlay beg end)
+ (move-overlay smie--highlight-matching-block-overlay
+ beg end (current-buffer))
(overlay-put smie--highlight-matching-block-overlay
'face 'smie-matching-block-highlight))))
(save-excursion
@@ -1095,10 +1096,15 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
(when (timerp smie--highlight-matching-block-timer)
(cancel-timer smie--highlight-matching-block-timer))
(setq smie--highlight-matching-block-timer nil)
- (when smie-highlight-matching-block-mode
- (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)
- (setq smie--highlight-matching-block-timer
- (run-with-idle-timer 0.2 t #'smie-highlight-matching-block))))
+ (if smie-highlight-matching-block-mode
+ (progn
+ (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)
+ (setq smie--highlight-matching-block-timer
+ (run-with-idle-timer 0.2 t #'smie-highlight-matching-block)))
+ (when smie--highlight-matching-block-overlay
+ (delete-overlay smie--highlight-matching-block-overlay)
+ (setq smie--highlight-matching-block-overlay nil))
+ (kill-local-variable 'smie--highlight-matching-block-lastpos)))
;;; The indentation engine.