comparison lisp/follow.el @ 85441:62f2f3aa55e2

(follow-unload-function): New function.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 19 Oct 2007 10:53:58 +0000
parents e0bc3c57c9ce
children d3e87ee5aa0e 4b09bb044f38
comparison
equal deleted inserted replaced
85440:a7fffd183c61 85441:62f2f3aa55e2
710 (follow-switch-to-buffer-all)) 710 (follow-switch-to-buffer-all))
711 711
712 ;;}}} 712 ;;}}}
713 ;;{{{ Movement 713 ;;{{{ Movement
714 714
715 ;; Note, these functions are not very useful, atleast not unless you 715 ;; Note, these functions are not very useful, at least not unless you
716 ;; rebind the rather cumbersome key sequence `C-c . p'. 716 ;; rebind the rather cumbersome key sequence `C-c . p'.
717 717
718 (defun follow-next-window () 718 (defun follow-next-window ()
719 "Select the next window showing the same buffer." 719 "Select the next window showing the same buffer."
720 (interactive) 720 (interactive)
1265 (setq start (or start (window-start win))) 1265 (setq start (or start (window-start win)))
1266 (save-excursion 1266 (save-excursion
1267 (let ((done nil) 1267 (let ((done nil)
1268 win-start 1268 win-start
1269 res) 1269 res)
1270 ;; Always calculate what happend when no line is displayed in the first 1270 ;; Always calculate what happens when no line is displayed in the first
1271 ;; window. (The `previous' res is needed below!) 1271 ;; window. (The `previous' res is needed below!)
1272 (goto-char guess) 1272 (goto-char guess)
1273 (vertical-motion 0 (car windows)) 1273 (vertical-motion 0 (car windows))
1274 (setq res (point)) 1274 (setq res (point))
1275 (while (not done) 1275 (while (not done)
1506 (setq follow-internal-force-redisplay nil) 1506 (setq follow-internal-force-redisplay nil)
1507 (follow-redisplay windows (selected-window)) 1507 (follow-redisplay windows (selected-window))
1508 (setq win-start-end (follow-windows-start-end windows)) 1508 (setq win-start-end (follow-windows-start-end windows))
1509 (follow-invalidate-cache) 1509 (follow-invalidate-cache)
1510 ;; When the point ends up in another window. This 1510 ;; When the point ends up in another window. This
1511 ;; happends when dest is in the beginning of the 1511 ;; happens when dest is in the beginning of the
1512 ;; file and the selected window is not the first. 1512 ;; file and the selected window is not the first.
1513 ;; It can also, in rare situations happend when 1513 ;; It can also, in rare situations happen when
1514 ;; long lines are used and there is a big 1514 ;; long lines are used and there is a big
1515 ;; difference between the width of the windows. 1515 ;; difference between the width of the windows.
1516 ;; (When scrolling one line in a wide window which 1516 ;; (When scrolling one line in a wide window which
1517 ;; will cause a move larger that an entire small 1517 ;; will cause a move larger that an entire small
1518 ;; window.) 1518 ;; window.)
2160 2160
2161 ;;}}} 2161 ;;}}}
2162 2162
2163 ;;{{{ The end 2163 ;;{{{ The end
2164 2164
2165 (defun follow-unload-function ()
2166 (easy-menu-remove-item nil '("Tools") "Follow")
2167 (follow-stop-intercept-process-output)
2168 (dolist (group '((before
2169 ;; XEmacs
2170 isearch-done
2171 ;; both
2172 set-process-filter sit-for move-overlay)
2173 (after
2174 ;; Emacs
2175 scroll-bar-drag scroll-bar-drag-1 scroll-bar-scroll-down
2176 scroll-bar-scroll-up scroll-bar-set-window-start
2177 ;; XEmacs
2178 scrollbar-line-down scrollbar-line-up scrollbar-page-down
2179 scrollbar-page-up scrollbar-to-bottom scrollbar-to-top
2180 scrollbar-vertical-drag
2181 ;; both
2182 process-filter)))
2183 (let ((class (car group)))
2184 (dolist (fun (cdr group))
2185 (when (functionp fun)
2186 (condition-case nil
2187 (progn
2188 (ad-remove-advice fun class
2189 (intern (concat "follow-" (symbol-name fun))))
2190 (ad-update fun))
2191 (error nil))))))
2192 nil)
2193
2194 (defvar follow-unload-function 'follow-unload-function)
2195
2165 ;; 2196 ;;
2166 ;; We're done! 2197 ;; We're done!
2167 ;; 2198 ;;
2168 2199
2169 (provide 'follow) 2200 (provide 'follow)