]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/vlf/vlf-follow.el
* packages/vlf: Version 1.3.
[gnu-emacs-elpa] / packages / vlf / vlf-follow.el
index 2ff522a25e59915a007ef83460b2e491cc0872a0..2b825da92bc986e1cfc03633efc995b6bd1c5179 100644 (file)
 
 ;;; Code:
 
+(require 'vlf)
+
 (defvar vlf-follow-timer nil
   "Contains timer if vlf buffer is set to continuously recenter.")
+(make-variable-buffer-local 'vlf-follow-timer)
 (put 'vlf-follow-timer 'permanent-local t)
 
 (defun vlf-recenter (vlf-buffer)
@@ -57,8 +60,9 @@
 
 (defun vlf-stop-follow ()
   "Stop continuous recenter."
-  (cancel-timer vlf-follow-timer)
-  (setq vlf-follow-timer nil))
+  (when vlf-follow-timer
+    (cancel-timer vlf-follow-timer)
+    (setq vlf-follow-timer nil)))
 
 (defun vlf-start-follow (interval)
   "Continuously recenter chunk around point every INTERVAL seconds."