aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-05-17 12:33:12 +0800
committerLeo Liu2013-05-17 12:33:12 +0800
commite219dd97020be9d2f7bc51de9915d77d56732b66 (patch)
treee98ad63a337a173ee03b0fc2ee3f87b659a59839
parentdc5dcb4bc598fa54dcd05becac2f04fcd03e8fcc (diff)
downloademacs-e219dd97020be9d2f7bc51de9915d77d56732b66.tar.gz
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
-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 @@
12013-05-17 Leo Liu <sdl.web@gmail.com>
2
3 * emacs-lisp/smie.el (smie-highlight-matching-block-mode): Clean
4 up when turned off. (Bug#14395)
5 (smie--highlight-matching-block-overlay): No longer buffer-local.
6 (smie-highlight-matching-block): Adjust.
7
12013-05-17 Paul Eggert <eggert@cs.ucla.edu> 82013-05-17 Paul Eggert <eggert@cs.ucla.edu>
2 9
3 Doc string fix for "nanoseconds" (Bug#14406). 10 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'.
1025 "Face used to highlight matching block." 1025 "Face used to highlight matching block."
1026 :group 'smie) 1026 :group 'smie)
1027 1027
1028(defvar-local smie--highlight-matching-block-overlay nil) 1028(defvar smie--highlight-matching-block-overlay nil)
1029(defvar-local smie--highlight-matching-block-lastpos -1) 1029(defvar-local smie--highlight-matching-block-lastpos -1)
1030 1030
1031(defun smie-highlight-matching-block () 1031(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'.
1056 nil)))) 1056 nil))))
1057 (highlight 1057 (highlight
1058 (lambda (beg end) 1058 (lambda (beg end)
1059 (move-overlay smie--highlight-matching-block-overlay beg end) 1059 (move-overlay smie--highlight-matching-block-overlay
1060 beg end (current-buffer))
1060 (overlay-put smie--highlight-matching-block-overlay 1061 (overlay-put smie--highlight-matching-block-overlay
1061 'face 'smie-matching-block-highlight)))) 1062 'face 'smie-matching-block-highlight))))
1062 (save-excursion 1063 (save-excursion
@@ -1095,10 +1096,15 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
1095 (when (timerp smie--highlight-matching-block-timer) 1096 (when (timerp smie--highlight-matching-block-timer)
1096 (cancel-timer smie--highlight-matching-block-timer)) 1097 (cancel-timer smie--highlight-matching-block-timer))
1097 (setq smie--highlight-matching-block-timer nil) 1098 (setq smie--highlight-matching-block-timer nil)
1098 (when smie-highlight-matching-block-mode 1099 (if smie-highlight-matching-block-mode
1099 (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local) 1100 (progn
1100 (setq smie--highlight-matching-block-timer 1101 (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)
1101 (run-with-idle-timer 0.2 t #'smie-highlight-matching-block)))) 1102 (setq smie--highlight-matching-block-timer
1103 (run-with-idle-timer 0.2 t #'smie-highlight-matching-block)))
1104 (when smie--highlight-matching-block-overlay
1105 (delete-overlay smie--highlight-matching-block-overlay)
1106 (setq smie--highlight-matching-block-overlay nil))
1107 (kill-local-variable 'smie--highlight-matching-block-lastpos)))
1102 1108
1103;;; The indentation engine. 1109;;; The indentation engine.
1104 1110