changeset 79149:6ddbf3d3f1a7

(follow-unload-function): New function.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 19 Oct 2007 10:33:32 +0000
parents 361a21ac1081
children f29d059746df
files lisp/follow.el
diffstat 1 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/follow.el	Fri Oct 19 10:22:53 2007 +0000
+++ b/lisp/follow.el	Fri Oct 19 10:33:32 2007 +0000
@@ -404,8 +404,8 @@
 			(funcall (symbol-function 'define-key-after)
 				 tools-map [follow] (cons "Follow" menumap)
 				 'separator-follow))
-		    ;; Didn't find the last item, Adding to the top of
-		    ;; tools.  (This will probably never happend...)
+		    ;; Didn't find the last item, adding to the top of
+		    ;; tools.  (This will probably never happen...)
 		    (define-key (current-global-map) [menu-bar tools follow]
 		      (cons "Follow" menumap))))
 	      ;; No tools menu, add "Follow" to the menubar.
@@ -790,7 +790,7 @@
 ;;}}}
 ;;{{{ Movement
 
-;; Note, these functions are not very useful, atleast not unless you
+;; Note, these functions are not very useful, at least not unless you
 ;; rebind the rather cumbersome key sequence `C-c . p'.
 
 (defun follow-next-window ()
@@ -2243,6 +2243,36 @@
 
 ;;{{{ The end
 
+(defun follow-unload-function ()
+  (follow-stop-intercept-process-output)
+  (dolist (group '((before
+		    ;; XEmacs
+		    isearch-done
+		    ;; both
+		    set-process-filter sit-for move-overlay)
+		   (after
+		    ;; Emacs
+		    scroll-bar-drag scroll-bar-drag-1 scroll-bar-scroll-down
+		    scroll-bar-scroll-up scroll-bar-set-window-start
+		    ;; XEmacs
+		    scrollbar-line-down scrollbar-line-up scrollbar-page-down
+		    scrollbar-page-up scrollbar-to-bottom scrollbar-to-top
+		    scrollbar-vertical-drag
+		    ;; both
+		    process-filter)))
+    (let ((class (car group)))
+      (dolist (fun (cdr group))
+	(when (functionp fun)
+	  (condition-case nil
+	      (progn
+		(ad-remove-advice fun class
+				  (intern (concat "follow-" (symbol-name fun))))
+		(ad-update fun))
+	    (error nil))))))
+  nil)
+
+(defvar follow-unload-function 'follow-unload-function)
+
 ;;
 ;; We're done!
 ;;