aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1997-06-03 07:09:13 +0000
committerKarl Heuer1997-06-03 07:09:13 +0000
commitcb02be17bab6672a5174bec63d80e9fe84fe9d01 (patch)
tree9108e9ed866a0f730bb0966dc4568c13bd4e7745
parent6824710a86581e7008d2c5d709b54c16f696ba5d (diff)
downloademacs-cb02be17bab6672a5174bec63d80e9fe84fe9d01.tar.gz
emacs-cb02be17bab6672a5174bec63d80e9fe84fe9d01.zip
(follow-windows-aligned-p): Doc fix.
(follow-post-command-hook, follow-recenter): Doc fix. (follow-end-of-buffer, follow-windows-aligned-p): Doc fix. (follow-post-command-hook, follow-maximize-region): Doc fix. (set-process-filter, process-filter, move-overlay): Advice doc fix.
-rw-r--r--lisp/follow.el295
1 files changed, 145 insertions, 150 deletions
diff --git a/lisp/follow.el b/lisp/follow.el
index f23504da36e..d7a6864bd03 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -1,6 +1,6 @@
1;;; follow.el --- Minor mode, Synchronize windows showing the same buffer. 1;;; follow.el --- Minor mode, Synchronize windows showing the same buffer.
2 2
3;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Anders Lindgren <andersl@csd.uu.se> 5;; Author: Anders Lindgren <andersl@csd.uu.se>
6;; Maintainer: Anders Lindgren <andersl@csd.uu.se> 6;; Maintainer: Anders Lindgren <andersl@csd.uu.se>
@@ -36,13 +36,13 @@
36;; The feeling of a "virtual window" has been accomplished by the use 36;; The feeling of a "virtual window" has been accomplished by the use
37;; of two major techniques: 37;; of two major techniques:
38;; 38;;
39;; * The windows always displays adjacent sections of the buffer. 39;; * The windows always displays adjacent sections of the buffer.
40;; This means that whenever one window is moved, all the 40;; This means that whenever one window is moved, all the
41;; others will follow. (Hence the name Follow Mode.) 41;; others will follow. (Hence the name Follow Mode.)
42;; 42;;
43;; * Should the point (cursor) end up outside a window, another 43;; * Should the point (cursor) end up outside a window, another
44;; window displaying that point is selected, if possible. This 44;; window displaying that point is selected, if possible. This
45;; makes it possible to walk between windows using normal cursor 45;; makes it possible to walk between windows using normal cursor
46;; movement commands. 46;; movement commands.
47;; 47;;
48;; Follow mode comes to its prime when used on a large screen and two 48;; Follow mode comes to its prime when used on a large screen and two
@@ -81,7 +81,7 @@
81;; |1 |73 | 81;; |1 |73 |
82;; |2 |74 | 82;; |2 |74 |
83;; |3 |75 | 83;; |3 |75 |
84;; ... ... 84;; ... ...
85;; |71 |143 | 85;; |71 |143 |
86;; |72 |144 | 86;; |72 |144 |
87;; +----------+----------+ 87;; +----------+----------+
@@ -97,7 +97,7 @@
97;; windows. 97;; windows.
98;; 98;;
99;; * Should you find `Follow' mode annoying, just type 99;; * Should you find `Follow' mode annoying, just type
100;; M-x follow-mode <RETURN> 100;; M-x follow-mode <RETURN>
101;; to turn it off. 101;; to turn it off.
102 102
103 103
@@ -228,7 +228,7 @@
228;; (global-set-key [f8] 'follow-mode) 228;; (global-set-key [f8] 'follow-mode)
229 229
230 230
231;; Implementation: 231;; Implementation:
232;; 232;;
233;; In an ideal world, follow mode would have been implemented in the 233;; In an ideal world, follow mode would have been implemented in the
234;; kernal of the display routines, making sure that the windows (in 234;; kernal of the display routines, making sure that the windows (in
@@ -278,8 +278,8 @@
278;; 15-Jul-95 andersl * find-file hook. 278;; 15-Jul-95 andersl * find-file hook.
279;; * submit-feedback. 279;; * submit-feedback.
280;; * Survives major mode changes. 280;; * Survives major mode changes.
281;; * Region spanning multiple windows looks 281;; * Region spanning multiple windows looks
282;; resonabely good. 282;; reasonably good.
283;; 19-Jul-95 andersl * New process-filter handling. 283;; 19-Jul-95 andersl * New process-filter handling.
284;; 1-Aug-95 andersl * XEmacs scrollbar support. 284;; 1-Aug-95 andersl * XEmacs scrollbar support.
285;; * Emacs 19 `window-size-change' support. 285;; * Emacs 19 `window-size-change' support.
@@ -288,9 +288,9 @@
288;; 5-Aug-95 andersl * `follow-switch-to-current-buffer-all' added. 288;; 5-Aug-95 andersl * `follow-switch-to-current-buffer-all' added.
289;; 16-Nov-95 andersl * V1.0 released! 289;; 16-Nov-95 andersl * V1.0 released!
290;; 17-Nov-95 andersl * Byte compiler silencer for XEmacs broken. 290;; 17-Nov-95 andersl * Byte compiler silencer for XEmacs broken.
291;; * fkey-end-of-buffer treated the same way 291;; * fkey-end-of-buffer treated the same way
292;; end-of-buffer is. 292;; end-of-buffer is.
293;; * follow-mode-off-hook added. 293;; * follow-mode-off-hook added.
294;; (Suggested by David Hughes, thanks!) 294;; (Suggested by David Hughes, thanks!)
295;; 20-Nov-95 andersl * Bug in menu code corrected. 295;; 20-Nov-95 andersl * Bug in menu code corrected.
296;; (Reported by Robert E. Brown, thanks!) 296;; (Reported by Robert E. Brown, thanks!)
@@ -306,7 +306,7 @@
306;; * `follow-calc-win-end' created. 306;; * `follow-calc-win-end' created.
307;; 8-Jan-96 andersl * XEmacs: `window-end' with `guarantee' 307;; 8-Jan-96 andersl * XEmacs: `window-end' with `guarantee'
308;; argument used in `follow-calc-win-end'. 308;; argument used in `follow-calc-win-end'.
309;; 9-Jan-96 andersl * `follow-end-of-buffer' added. 309;; 9-Jan-96 andersl * `follow-end-of-buffer' added.
310;; Code in post hook removed. 310;; Code in post hook removed.
311;; * XEmacs: Post hook is always executed 311;; * XEmacs: Post hook is always executed
312;; after a mouse button event. 312;; after a mouse button event.
@@ -385,7 +385,7 @@
385 "*Minor mode keymap for Follow mode.") 385 "*Minor mode keymap for Follow mode.")
386 386
387(defvar follow-mode-line-text " Follow" 387(defvar follow-mode-line-text " Follow"
388 "*Text shown in the mode line when Follow mode is active. 388 "*Text shown in the mode line when Follow mode is active.
389Defaults to \" Follow\". Examples of other values 389Defaults to \" Follow\". Examples of other values
390are \" Fw\", or simply \"\".") 390are \" Fw\", or simply \"\".")
391 391
@@ -400,19 +400,19 @@ After that, changing the prefix key requires manipulating keymaps.")
400(defvar follow-intercept-processes t 400(defvar follow-intercept-processes t
401 "*When non-nil, Follow Mode will monitor process output.") 401 "*When non-nil, Follow Mode will monitor process output.")
402 402
403(defvar follow-emacs-version-xemacs-p 403(defvar follow-emacs-version-xemacs-p
404 (string-match "XEmacs" emacs-version) 404 (string-match "XEmacs" emacs-version)
405 "Non-nil when running under XEmacs.") 405 "Non-nil when running under XEmacs.")
406 406
407(defvar follow-avoid-tail-recenter-p 407(defvar follow-avoid-tail-recenter-p
408 (not follow-emacs-version-xemacs-p) 408 (not follow-emacs-version-xemacs-p)
409 "*When non-nil, patch emacs so that tail windows won't be recentered. 409 "*When non-nil, patch emacs so that tail windows won't be recentered.
410 410
411A \"tail window\" is a window which displays only the end of 411A \"tail window\" is a window which displays only the end of
412the buffer. Normally it is practical for the user that empty 412the buffer. Normally it is practical for the user that empty
413windows are recentered automatically. However, when using 413windows are recentered automatically. However, when using
414Follow Mode it breaks the display when the end is displayed 414Follow Mode it breaks the display when the end is displayed
415in a window \"above\" the last window. This is for 415in a window \"above\" the last window. This is for
416example the case when displaying a short page in info. 416example the case when displaying a short page in info.
417 417
418Must be set before Follow Mode is loaded. 418Must be set before Follow Mode is loaded.
@@ -455,7 +455,7 @@ property `follow-mode-use-cache' to non-nil.")
455 "The menu visible when Follow mode is deactivated.") 455 "The menu visible when Follow mode is deactivated.")
456 456
457(defvar follow-inside-post-command-hook nil 457(defvar follow-inside-post-command-hook nil
458 "Non-nil when inside Follow modes `post-command-hook'. 458 "Non-nil when inside Follow modes `post-command-hook'.
459Used by `follow-window-size-change'.") 459Used by `follow-window-size-change'.")
460 460
461(defvar follow-windows-start-end-cache nil 461(defvar follow-windows-start-end-cache nil
@@ -474,20 +474,20 @@ Used by `follow-window-size-change'.")
474 (reporter-submit-bug-report 474 (reporter-submit-bug-report
475 "Anders Lindgren <andersl@csd.uu.se>" 475 "Anders Lindgren <andersl@csd.uu.se>"
476 follow-mode-version 476 follow-mode-version
477 '(post-command-hook 477 '(post-command-hook
478 post-command-idle-hook 478 post-command-idle-hook
479 pre-command-hook 479 pre-command-hook
480 window-size-change-functions 480 window-size-change-functions
481 window-scroll-functions 481 window-scroll-functions
482 follow-mode-hook 482 follow-mode-hook
483 follow-mode-off-hook 483 follow-mode-off-hook
484 follow-auto 484 follow-auto
485 follow-intercept-processes 485 follow-intercept-processes
486 follow-avoid-tail-recenter-p 486 follow-avoid-tail-recenter-p
487 follow-process-filter-alist) 487 follow-process-filter-alist)
488 nil 488 nil
489 nil 489 nil
490 (concat 490 (concat
491 "Hi Anders!\n\n" 491 "Hi Anders!\n\n"
492 "(I have read the section on how to report bugs in the " 492 "(I have read the section on how to report bugs in the "
493 "Emacs manual.)\n\n" 493 "Emacs manual.)\n\n"
@@ -499,7 +499,7 @@ Used by `follow-window-size-change'.")
499 499
500;; This inline function must be as small as possible! 500;; This inline function must be as small as possible!
501;; Maybe we should define a macro which expands to nil if 501;; Maybe we should define a macro which expands to nil if
502;; the varible is not set. 502;; the variable is not set.
503 503
504(defsubst follow-debug-message (&rest args) 504(defsubst follow-debug-message (&rest args)
505 "Like message, but only active when `follow-debug' is non-nil." 505 "Like message, but only active when `follow-debug' is non-nil."
@@ -553,11 +553,11 @@ Used by `follow-window-size-change'.")
553 ;; (The function `substitute-key-definition' does not work 553 ;; (The function `substitute-key-definition' does not work
554 ;; in all versions of Emacs.) 554 ;; in all versions of Emacs.)
555 (mapcar 555 (mapcar
556 (function 556 (function
557 (lambda (pair) 557 (lambda (pair)
558 (let ((old (car pair)) 558 (let ((old (car pair))
559 (new (cdr pair))) 559 (new (cdr pair)))
560 (mapcar (function (lambda (key) 560 (mapcar (function (lambda (key)
561 (define-key follow-mode-map key new))) 561 (define-key follow-mode-map key new)))
562 (where-is-internal old global-map))))) 562 (where-is-internal old global-map)))))
563 '((end-of-buffer . follow-end-of-buffer) 563 '((end-of-buffer . follow-end-of-buffer)
@@ -572,14 +572,14 @@ Used by `follow-window-size-change'.")
572 ;; 572 ;;
573 ;; Emacs 19 573 ;; Emacs 19
574 ;; 574 ;;
575 (let ((menumap (funcall (symbol-function 'make-sparse-keymap) 575 (let ((menumap (funcall (symbol-function 'make-sparse-keymap)
576 "Follow")) 576 "Follow"))
577 (count 0) 577 (count 0)
578 id) 578 id)
579 (mapcar 579 (mapcar
580 (function 580 (function
581 (lambda (item) 581 (lambda (item)
582 (setq id 582 (setq id
583 (or (cdr item) 583 (or (cdr item)
584 (progn 584 (progn
585 (setq count (+ count 1)) 585 (setq count (+ count 1))
@@ -606,23 +606,23 @@ Used by `follow-window-size-change'.")
606 ("--") 606 ("--")
607 ("Scroll Down" . follow-scroll-down) 607 ("Scroll Down" . follow-scroll-down)
608 ("Scroll Up" . follow-scroll-up))) 608 ("Scroll Up" . follow-scroll-up)))
609 609
610 ;; If there is a `tools' meny, we use it. However, we can't add a 610 ;; If there is a `tools' meny, we use it. However, we can't add a
611 ;; minor-mode specific item to it (it's broken), so we make the 611 ;; minor-mode specific item to it (it's broken), so we make the
612 ;; contents ghosted when not in use, and add ourselves to the 612 ;; contents ghosted when not in use, and add ourselves to the
613 ;; global map. If no `tools' menu is present, just make a 613 ;; global map. If no `tools' menu is present, just make a
614 ;; top-level menu visible when the mode is activated. 614 ;; top-level menu visible when the mode is activated.
615 615
616 (let ((tools-map (lookup-key (current-global-map) [menu-bar tools])) 616 (let ((tools-map (lookup-key (current-global-map) [menu-bar tools]))
617 (last nil)) 617 (last nil))
618 (if (sequencep tools-map) 618 (if (sequencep tools-map)
619 (progn 619 (progn
620 ;; Find the last entry in the menu and store it in `last'. 620 ;; Find the last entry in the menu and store it in `last'.
621 (mapcar (function 621 (mapcar (function
622 (lambda (x) 622 (lambda (x)
623 (setq last (or (cdr-safe 623 (setq last (or (cdr-safe
624 (cdr-safe 624 (cdr-safe
625 (cdr-safe x))) 625 (cdr-safe x)))
626 last)))) 626 last))))
627 tools-map) 627 tools-map)
628 (if last 628 (if last
@@ -652,7 +652,7 @@ Used by `follow-window-size-change'.")
652 ["Delete Other Windows and Split" 652 ["Delete Other Windows and Split"
653 follow-delete-other-windows-and-split t] 653 follow-delete-other-windows-and-split t]
654 ["Switch To Buffer" follow-switch-to-buffer t] 654 ["Switch To Buffer" follow-switch-to-buffer t]
655 ["Switch To Buffer (all windows)" 655 ["Switch To Buffer (all windows)"
656 follow-switch-to-buffer-all t] 656 follow-switch-to-buffer-all t]
657 ["First Window" follow-first-window t] 657 ["First Window" follow-first-window t]
658 ["Last Window" follow-last-window t] 658 ["Last Window" follow-last-window t]
@@ -710,19 +710,19 @@ Used by `follow-window-size-change'.")
710 710
711 711
712;;;###autoload 712;;;###autoload
713(defun follow-mode (arg) 713(defun follow-mode (arg)
714 "Minor mode which combines windows into one tall virtual window. 714 "Minor mode which combines windows into one tall virtual window.
715 715
716The feeling of a \"virtual window\" has been accomplished by the use 716The feeling of a \"virtual window\" has been accomplished by the use
717of two major techniques: 717of two major techniques:
718 718
719* The windows always displays adjacent sections of the buffer. 719* The windows always displays adjacent sections of the buffer.
720 This means that whenever one window is moved, all the 720 This means that whenever one window is moved, all the
721 others will follow. (Hence the name Follow Mode.) 721 others will follow. (Hence the name Follow Mode.)
722 722
723* Should the point (cursor) end up outside a window, another 723* Should the point (cursor) end up outside a window, another
724 window displaying that point is selected, if possible. This 724 window displaying that point is selected, if possible. This
725 makes it possible to walk between windows using normal cursor 725 makes it possible to walk between windows using normal cursor
726 movement commands. 726 movement commands.
727 727
728Follow mode comes to its prime when used on a large screen and two 728Follow mode comes to its prime when used on a large screen and two
@@ -765,7 +765,7 @@ Keys specific to Follow mode:
765 (force-mode-line-update) 765 (force-mode-line-update)
766 (add-hook 'post-command-hook 'follow-post-command-hook t) 766 (add-hook 'post-command-hook 'follow-post-command-hook t)
767 (if (boundp 'post-command-idle-hook) 767 (if (boundp 'post-command-idle-hook)
768 (add-hook 'post-command-idle-hook 768 (add-hook 'post-command-idle-hook
769 'follow-avoid-tail-recenter t)) 769 'follow-avoid-tail-recenter t))
770 (run-hooks 'follow-mode-hook)) 770 (run-hooks 'follow-mode-hook))
771 771
@@ -871,8 +871,8 @@ Works like `scroll-up' when not in Follow Mode."
871 (signal 'beginning-of-buffer nil) 871 (signal 'beginning-of-buffer nil)
872 (select-window win) 872 (select-window win)
873 (goto-char start) 873 (goto-char start)
874 (vertical-motion (- (- (window-height win) 874 (vertical-motion (- (- (window-height win)
875 1 875 1
876 next-screen-context-lines))) 876 next-screen-context-lines)))
877 (set-window-start win (point)) 877 (set-window-start win (point))
878 (goto-char start) 878 (goto-char start)
@@ -887,9 +887,9 @@ Works like `scroll-up' when not in Follow Mode."
887 "Create two side by side windows and enter Follow Mode. 887 "Create two side by side windows and enter Follow Mode.
888 888
889Execute this command to display as much as possible of the text 889Execute this command to display as much as possible of the text
890in the selected window. All other windows, in the current 890in the selected window. All other windows, in the current
891frame, are deleted and the selected window is split in two 891frame, are deleted and the selected window is split in two
892side-by-side windows. Follow Mode is activated, hence the 892side-by-side windows. Follow Mode is activated, hence the
893two windows always will display two successive pages. 893two windows always will display two successive pages.
894\(If one window is moved, the other one will follow.) 894\(If one window is moved, the other one will follow.)
895 895
@@ -901,7 +901,7 @@ To bind this command to a hotkey, place the following line
901in your `~/.emacs' file, replacing [f7] by your favourite key: 901in your `~/.emacs' file, replacing [f7] by your favourite key:
902 (global-set-key [f7] 'follow-delete-other-windows-and-split)" 902 (global-set-key [f7] 'follow-delete-other-windows-and-split)"
903 (interactive "P") 903 (interactive "P")
904 (let ((other (or (and (null arg) 904 (let ((other (or (and (null arg)
905 (not (eq (selected-window) 905 (not (eq (selected-window)
906 (frame-first-window (selected-frame))))) 906 (frame-first-window (selected-frame)))))
907 (and arg 907 (and arg
@@ -909,7 +909,7 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
909 (start (window-start))) 909 (start (window-start)))
910 (delete-other-windows) 910 (delete-other-windows)
911 (split-window-horizontally) 911 (split-window-horizontally)
912 (if other 912 (if other
913 (progn 913 (progn
914 (other-window 1) 914 (other-window 1)
915 (set-window-start (selected-window) start) 915 (set-window-start (selected-window) start)
@@ -931,12 +931,12 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
931(defun follow-switch-to-buffer-all (&optional buffer) 931(defun follow-switch-to-buffer-all (&optional buffer)
932 "Show BUFFER in all windows on this frame. 932 "Show BUFFER in all windows on this frame.
933Defaults to current buffer." 933Defaults to current buffer."
934 (interactive (list (read-buffer "Switch to Buffer: " 934 (interactive (list (read-buffer "Switch to Buffer: "
935 (current-buffer)))) 935 (current-buffer))))
936 (or buffer (setq buffer (current-buffer))) 936 (or buffer (setq buffer (current-buffer)))
937 (let ((orig-window (selected-window))) 937 (let ((orig-window (selected-window)))
938 (walk-windows 938 (walk-windows
939 (function 939 (function
940 (lambda (win) 940 (lambda (win)
941 (select-window win) 941 (select-window win)
942 (switch-to-buffer buffer)))) 942 (switch-to-buffer buffer))))
@@ -947,7 +947,7 @@ Defaults to current buffer."
947(defun follow-switch-to-current-buffer-all () 947(defun follow-switch-to-current-buffer-all ()
948 "Show current buffer in all windows on this frame, and enter Follow Mode. 948 "Show current buffer in all windows on this frame, and enter Follow Mode.
949 949
950To bind this command to a hotkey place the following line 950To bind this command to a hotkey place the following line
951in your `~/.emacs' file: 951in your `~/.emacs' file:
952 (global-set-key [f7] 'follow-switch-to-current-buffer-all)" 952 (global-set-key [f7] 'follow-switch-to-current-buffer-all)"
953 (interactive) 953 (interactive)
@@ -994,8 +994,8 @@ in your `~/.emacs' file:
994;;{{{ Redraw 994;;{{{ Redraw
995 995
996(defun follow-recenter (&optional arg) 996(defun follow-recenter (&optional arg)
997 "Recenter the middle window around the point, 997 "Recenter the middle window around point.
998and rearrange all other windows around the middle window. 998Rearrange all other windows around the middle window.
999 999
1000With a positive argument, place the current line ARG lines 1000With a positive argument, place the current line ARG lines
1001from the top. With a negative, place it -ARG lines from the 1001from the top. With a negative, place it -ARG lines from the
@@ -1042,19 +1042,19 @@ Follow mode since the windows should always be aligned."
1042;;{{{ End of buffer 1042;;{{{ End of buffer
1043 1043
1044(defun follow-end-of-buffer (&optional arg) 1044(defun follow-end-of-buffer (&optional arg)
1045 "Move point to the end of the buffer. Follow Mode style. 1045 "Move point to the end of the buffer, Follow Mode style.
1046 1046
1047If the end is not visible, it will be displayed in the last possible 1047If the end is not visible, it will be displayed in the last possible
1048window in the Follow Mode window chain. 1048window in the Follow Mode window chain.
1049 1049
1050The mark is left at the previous position. With arg N, put point N/10 1050The mark is left at the previous position. With arg N, put point N/10
1051of the way from the true end." 1051of the way from the true end."
1052 (interactive "P") 1052 (interactive "P")
1053 (let ((followers (follow-all-followers)) 1053 (let ((followers (follow-all-followers))
1054 (pos (point))) 1054 (pos (point)))
1055 (cond (arg 1055 (cond (arg
1056 (select-window (car (reverse followers)))) 1056 (select-window (car (reverse followers))))
1057 ((follow-select-if-end-visible 1057 ((follow-select-if-end-visible
1058 (follow-windows-start-end followers))) 1058 (follow-windows-start-end followers)))
1059 (t 1059 (t
1060 (select-window (car (reverse followers))))) 1060 (select-window (car (reverse followers)))))
@@ -1093,9 +1093,9 @@ If TESTWIN is nil the selected window is used."
1093 1093
1094(defun follow-split-followers (windows &optional win) 1094(defun follow-split-followers (windows &optional win)
1095 "Split the WINDOWS into the sets: predecessors and successors. 1095 "Split the WINDOWS into the sets: predecessors and successors.
1096Return `(PRED . SUCC)' where `PRED' and `SUCC' are ordered starting 1096Return `(PRED . SUCC)' where `PRED' and `SUCC' are ordered starting
1097from the selected window." 1097from the selected window."
1098 (or win 1098 (or win
1099 (setq win (selected-window))) 1099 (setq win (selected-window)))
1100 (let ((pred '())) 1100 (let ((pred '()))
1101 (while (not (eq (car windows) win)) 1101 (while (not (eq (car windows) win))
@@ -1122,7 +1122,7 @@ Returns (end-pos end-of-buffer-p)"
1122 (if (= end (funcall (symbol-function 'point-max) 1122 (if (= end (funcall (symbol-function 'point-max)
1123 (window-buffer win))) 1123 (window-buffer win)))
1124 (list end t) 1124 (list end t)
1125 (list (+ end 1) nil))) 1125 (list (+ end 1) nil)))
1126 ;; Emacs 19: We have to calculate the end by ourselves. 1126 ;; Emacs 19: We have to calculate the end by ourselves.
1127 ;; This code works on both XEmacs and Emacs 19, but now 1127 ;; This code works on both XEmacs and Emacs 19, but now
1128 ;; that XEmacs has got custom-written code, this could 1128 ;; that XEmacs has got custom-written code, this could
@@ -1204,8 +1204,8 @@ Note that this handles the case when the cache has been set to nil."
1204 (orig-win (selected-window))) 1204 (orig-win (selected-window)))
1205 (while windows 1205 (while windows
1206 (select-window (car windows)) 1206 (select-window (car windows))
1207 (setq win-start-end 1207 (setq win-start-end
1208 (cons (cons (car windows) 1208 (cons (cons (car windows)
1209 (cons (window-start) 1209 (cons (window-start)
1210 (follow-calc-win-end))) 1210 (follow-calc-win-end)))
1211 win-start-end)) 1211 win-start-end))
@@ -1228,8 +1228,8 @@ Note that this handles the case when the cache has been set to nil."
1228;; should start at a full screen line. 1228;; should start at a full screen line.
1229 1229
1230(defsubst follow-windows-aligned-p (win-start-end) 1230(defsubst follow-windows-aligned-p (win-start-end)
1231 "Non-nil if the follower WINDOWS are alinged." 1231 "Non-nil if the follower WINDOWS are aligned."
1232 (let ((res t)) 1232 (let ((res t))
1233 (save-excursion 1233 (save-excursion
1234 (goto-char (window-start (car (car win-start-end)))) 1234 (goto-char (window-start (car (car win-start-end))))
1235 (if (bolp) 1235 (if (bolp)
@@ -1310,7 +1310,7 @@ Return the selected window."
1310;; 1310;;
1311;; (Compability cludge: in Emacs 19 `window-end' is equal to `point-max'; 1311;; (Compability cludge: in Emacs 19 `window-end' is equal to `point-max';
1312;; in XEmacs, it is equal to `point-max + 1'. Should I really bother 1312;; in XEmacs, it is equal to `point-max + 1'. Should I really bother
1313;; checking `window-end' now when I check `end-of-buffer' explicitylt?) 1313;; checking `window-end' now when I check `end-of-buffer' explicitly?)
1314 1314
1315(defun follow-select-if-end-visible (win-start-end) 1315(defun follow-select-if-end-visible (win-start-end)
1316 "Select and return a window, if end is visible in it." 1316 "Select and return a window, if end is visible in it."
@@ -1343,7 +1343,7 @@ Return the selected window."
1343 (goto-char (window-start (car windows))) 1343 (goto-char (window-start (car windows)))
1344 ;; Make sure the line start in the beginning of a real screen 1344 ;; Make sure the line start in the beginning of a real screen
1345 ;; line. 1345 ;; line.
1346 (vertical-motion 0 (car windows)) 1346 (vertical-motion 0 (car windows))
1347 (if (< dest (point)) 1347 (if (< dest (point))
1348 ;; Above the start, not visible. 1348 ;; Above the start, not visible.
1349 nil 1349 nil
@@ -1359,13 +1359,13 @@ Return the selected window."
1359 (< dest (point))) 1359 (< dest (point)))
1360 (setq win (car windows)) 1360 (setq win (car windows))
1361 (setq windows (cdr windows))))))) 1361 (setq windows (cdr windows)))))))
1362 (if win 1362 (if win
1363 (select-window win)) 1363 (select-window win))
1364 win)) 1364 win))
1365 1365
1366 1366
1367;;}}} 1367;;}}}
1368;;{{{ Redisplay 1368;;{{{ Redisplay
1369 1369
1370;; Redraw all the windows on the screen, starting with the top window. 1370;; Redraw all the windows on the screen, starting with the top window.
1371;; The window used as as marker is WIN, or the selcted window if WIN 1371;; The window used as as marker is WIN, or the selcted window if WIN
@@ -1375,13 +1375,13 @@ Return the selected window."
1375 "Reposition the WINDOWS around WIN. 1375 "Reposition the WINDOWS around WIN.
1376Should the point be too close to the roof we redisplay everything 1376Should the point be too close to the roof we redisplay everything
1377from the top. WINDOWS should contain a list of windows to 1377from the top. WINDOWS should contain a list of windows to
1378redisplay, it is assumed that WIN is a member of the list. 1378redisplay, it is assumed that WIN is a member of the list.
1379Should WINDOWS be nil, the windows displaying the 1379Should WINDOWS be nil, the windows displaying the
1380same buffer as WIN, in the current frame, are used. 1380same buffer as WIN, in the current frame, are used.
1381Should WIN be nil, the selected window is used." 1381Should WIN be nil, the selected window is used."
1382 (or win 1382 (or win
1383 (setq win (selected-window))) 1383 (setq win (selected-window)))
1384 (or windows 1384 (or windows
1385 (setq windows (follow-all-followers win))) 1385 (setq windows (follow-all-followers win)))
1386 (follow-downward windows (follow-calculate-first-window-start windows win))) 1386 (follow-downward windows (follow-calculate-first-window-start windows win)))
1387 1387
@@ -1426,27 +1426,27 @@ Should WIN be nil, the selected window is used."
1426 "Calculate the start of the first window. 1426 "Calculate the start of the first window.
1427 1427
1428WINDOWS is a chain of windows to work with. WIN is the window 1428WINDOWS is a chain of windows to work with. WIN is the window
1429to recenter around. It is assumed that WIN starts at position 1429to recenter around. It is assumed that WIN starts at position
1430START." 1430START."
1431 (or win 1431 (or win
1432 (setq win (selected-window))) 1432 (setq win (selected-window)))
1433 (or start 1433 (or start
1434 (setq start (window-start win))) 1434 (setq start (window-start win)))
1435 (let ((guess (follow-estimate-first-window-start windows win start))) 1435 (let ((guess (follow-estimate-first-window-start windows win start)))
1436 (if (car guess) 1436 (if (car guess)
1437 (cdr guess) 1437 (cdr guess)
1438 ;; The guess wasn't exact, try to enhance it. 1438 ;; The guess wasn't exact, try to enhance it.
1439 (let ((win-start (follow-calc-win-start windows (cdr guess) win))) 1439 (let ((win-start (follow-calc-win-start windows (cdr guess) win)))
1440 (cond ((= win-start start) 1440 (cond ((= win-start start)
1441 (follow-debug-message "exact") 1441 (follow-debug-message "exact")
1442 (cdr guess)) 1442 (cdr guess))
1443 ((< win-start start) 1443 ((< win-start start)
1444 (follow-debug-message "above") 1444 (follow-debug-message "above")
1445 (follow-calculate-first-window-start-from-above 1445 (follow-calculate-first-window-start-from-above
1446 windows (cdr guess) win start)) 1446 windows (cdr guess) win start))
1447 (t 1447 (t
1448 (follow-debug-message "below") 1448 (follow-debug-message "below")
1449 (follow-calculate-first-window-start-from-below 1449 (follow-calculate-first-window-start-from-below
1450 windows (cdr guess) win start))))))) 1450 windows (cdr guess) win start)))))))
1451 1451
1452 1452
@@ -1474,7 +1474,7 @@ position of the first window. Otherwise it is a good guess."
1474;; Find the starting point, start at GUESS and search downward. 1474;; Find the starting point, start at GUESS and search downward.
1475;; The returned point is always a point below GUESS. 1475;; The returned point is always a point below GUESS.
1476 1476
1477(defun follow-calculate-first-window-start-from-above 1477(defun follow-calculate-first-window-start-from-above
1478 (windows guess win start) 1478 (windows guess win start)
1479 (save-excursion 1479 (save-excursion
1480 (let ((done nil) 1480 (let ((done nil)
@@ -1490,7 +1490,7 @@ position of the first window. Otherwise it is a good guess."
1490 (setq res (point-max))) 1490 (setq res (point-max)))
1491 (setq win-start (follow-calc-win-start windows (point) win)) 1491 (setq win-start (follow-calc-win-start windows (point) win))
1492 (if (>= win-start start) 1492 (if (>= win-start start)
1493 (progn 1493 (progn
1494 (setq done t) 1494 (setq done t)
1495 (setq res (point)))))) 1495 (setq res (point))))))
1496 res))) 1496 res)))
@@ -1557,7 +1557,7 @@ position of the first window. Otherwise it is a good guess."
1557(defun follow-avoid-tail-recenter (&rest rest) 1557(defun follow-avoid-tail-recenter (&rest rest)
1558 "Make sure windows displaying the end of a buffer aren't recentered. 1558 "Make sure windows displaying the end of a buffer aren't recentered.
1559 1559
1560This is done by reading and rewriting the start positon of 1560This is done by reading and rewriting the start positon of
1561non-first windows in Follow Mode." 1561non-first windows in Follow Mode."
1562 (if follow-avoid-tail-recenter-p 1562 (if follow-avoid-tail-recenter-p
1563 (let* ((orig-buffer (current-buffer)) 1563 (let* ((orig-buffer (current-buffer))
@@ -1576,7 +1576,7 @@ non-first windows in Follow Mode."
1576 (set-buffer (window-buffer win)) 1576 (set-buffer (window-buffer win))
1577 (setq pair (cons (window-buffer win) (window-frame win))) 1577 (setq pair (cons (window-buffer win) (window-frame win)))
1578 (if (member pair who) 1578 (if (member pair who)
1579 (if (and (boundp 'follow-mode) follow-mode 1579 (if (and (boundp 'follow-mode) follow-mode
1580 (eq (point-max) start)) 1580 (eq (point-max) start))
1581 ;; Write the same window start back, but don't 1581 ;; Write the same window start back, but don't
1582 ;; set the NOFORCE flag. 1582 ;; set the NOFORCE flag.
@@ -1602,7 +1602,7 @@ non-first windows in Follow Mode."
1602;; in several window even though they are aligned. 1602;; in several window even though they are aligned.
1603 1603
1604(defun follow-post-command-hook () 1604(defun follow-post-command-hook ()
1605 "Ensure that the windows in Follow mode are adjecent after each command." 1605 "Ensure that the windows in Follow mode are adjacent after each command."
1606 (setq follow-inside-post-command-hook t) 1606 (setq follow-inside-post-command-hook t)
1607 (if (or (not (input-pending-p)) 1607 (if (or (not (input-pending-p))
1608 ;; Sometimes, in XEmacs, mouse events are not handled 1608 ;; Sometimes, in XEmacs, mouse events are not handled
@@ -1617,7 +1617,7 @@ non-first windows in Follow Mode."
1617 (let ((orig-buffer (current-buffer)) 1617 (let ((orig-buffer (current-buffer))
1618 (win (selected-window))) 1618 (win (selected-window)))
1619 (set-buffer (window-buffer win)) 1619 (set-buffer (window-buffer win))
1620 (or (and (symbolp this-command) 1620 (or (and (symbolp this-command)
1621 (get this-command 'follow-mode-use-cache)) 1621 (get this-command 'follow-mode-use-cache))
1622 (follow-invalidate-cache)) 1622 (follow-invalidate-cache))
1623 (if (and (boundp 'follow-mode) follow-mode 1623 (if (and (boundp 'follow-mode) follow-mode
@@ -1656,7 +1656,7 @@ non-first windows in Follow Mode."
1656 ;; unintuitive. 1656 ;; unintuitive.
1657 ((and visible 1657 ((and visible
1658 aligned 1658 aligned
1659 (not (memq this-command 1659 (not (memq this-command
1660 '(backward-delete-char 1660 '(backward-delete-char
1661 delete-backward-char 1661 delete-backward-char
1662 backward-delete-char-untabify 1662 backward-delete-char-untabify
@@ -1677,10 +1677,10 @@ non-first windows in Follow Mode."
1677 (goto-char dest) 1677 (goto-char dest)
1678 (setq visible nil) 1678 (setq visible nil)
1679 (setq aligned nil))) 1679 (setq aligned nil)))
1680 1680
1681 ;; We're not at the end, here life is much simpler. 1681 ;; We're not at the end, here life is much simpler.
1682 (cond 1682 (cond
1683 ;; This is the normal case! 1683 ;; This is the normal case!
1684 ;; It should be optimized for speed. 1684 ;; It should be optimized for speed.
1685 ((and visible aligned) 1685 ((and visible aligned)
1686 (follow-debug-message "same")) 1686 (follow-debug-message "same"))
@@ -1712,7 +1712,7 @@ non-first windows in Follow Mode."
1712 ;; at the bottom of a window. 1712 ;; at the bottom of a window.
1713 ((follow-select-if-visible-from-first dest windows) 1713 ((follow-select-if-visible-from-first dest windows)
1714 (follow-debug-message "Below first") 1714 (follow-debug-message "Below first")
1715 (setq visible t) 1715 (setq visible t)
1716 (setq aligned t) 1716 (setq aligned t)
1717 (follow-redisplay windows (car windows)) 1717 (follow-redisplay windows (car windows))
1718 (goto-char dest)) 1718 (goto-char dest))
@@ -1743,7 +1743,7 @@ non-first windows in Follow Mode."
1743 (if (or follow-internal-force-redisplay 1743 (if (or follow-internal-force-redisplay
1744 (not (or aligned 1744 (not (or aligned
1745 (follow-windows-aligned-p win-start-end))) 1745 (follow-windows-aligned-p win-start-end)))
1746 (not (inline (follow-point-visible-all-windows-p 1746 (not (inline (follow-point-visible-all-windows-p
1747 win-start-end)))) 1747 win-start-end))))
1748 (progn 1748 (progn
1749 (setq follow-internal-force-redisplay nil) 1749 (setq follow-internal-force-redisplay nil)
@@ -1763,18 +1763,18 @@ non-first windows in Follow Mode."
1763 nil 1763 nil
1764 (follow-select-if-visible dest win-start-end) 1764 (follow-select-if-visible dest win-start-end)
1765 (goto-char dest)))) 1765 (goto-char dest))))
1766 1766
1767 ;; If the region is visible, make it look good when spanning 1767 ;; If the region is visible, make it look good when spanning
1768 ;; multiple windows. 1768 ;; multiple windows.
1769 (if (or (and (boundp 'mark-active) (symbol-value 'mark-active)) 1769 (if (or (and (boundp 'mark-active) (symbol-value 'mark-active))
1770 (and (fboundp 'region-active-p) 1770 (and (fboundp 'region-active-p)
1771 (funcall (symbol-function 'region-active-p)))) 1771 (funcall (symbol-function 'region-active-p))))
1772 (follow-maximize-region 1772 (follow-maximize-region
1773 (selected-window) windows win-start-end)) 1773 (selected-window) windows win-start-end))
1774 1774
1775 (inline (follow-avoid-tail-recenter)) 1775 (inline (follow-avoid-tail-recenter))
1776 ;; DEBUG 1776 ;; DEBUG
1777 ;;(if (not (follow-windows-aligned-p 1777 ;;(if (not (follow-windows-aligned-p
1778 ;; (follow-windows-start-end windows))) 1778 ;; (follow-windows-start-end windows)))
1779 ;; (message "follow-mode: windows still unaligend!")) 1779 ;; (message "follow-mode: windows still unaligend!"))
1780 ;; END OF DEBUG 1780 ;; END OF DEBUG
@@ -1790,15 +1790,14 @@ non-first windows in Follow Mode."
1790;;{{{ The region 1790;;{{{ The region
1791 1791
1792;; Tries to make the highlighted area representing the region look 1792;; Tries to make the highlighted area representing the region look
1793;; good when spanning several windows. 1793;; good when spanning several windows.
1794;; 1794;;
1795;; Not perfect, as the point can't be placed at window end, only at 1795;; Not perfect, as the point can't be placed at window end, only at
1796;; end-1. Whis will highlight a little bit in windows above 1796;; end-1. This will highlight a little bit in windows above
1797;; the current. 1797;; the current.
1798 1798
1799(defun follow-maximize-region (win windows win-start-end) 1799(defun follow-maximize-region (win windows win-start-end)
1800 "Make a highlighted region stretching multiple windows look good 1800 "Make a highlighted region stretching multiple windows look good."
1801when in Follow mode."
1802 (let* ((all (follow-split-followers windows win)) 1801 (let* ((all (follow-split-followers windows win))
1803 (pred (car all)) 1802 (pred (car all))
1804 (succ (cdr all)) 1803 (succ (cdr all))
@@ -1848,22 +1847,22 @@ when in Follow mode."
1848 (while cmds 1847 (while cmds
1849 (eval 1848 (eval
1850 (` (defadvice (, (intern (symbol-name (car cmds)))) 1849 (` (defadvice (, (intern (symbol-name (car cmds))))
1851 (after 1850 (after
1852 (, (intern (concat "follow-" (symbol-name (car cmds))))) 1851 (, (intern (concat "follow-" (symbol-name (car cmds)))))
1853 activate) 1852 activate)
1854 "Adviced by Follow Mode." 1853 "Adviced by Follow Mode."
1855 (follow-redraw-after-event (ad-get-arg 0))))) 1854 (follow-redraw-after-event (ad-get-arg 0)))))
1856 (setq cmds (cdr cmds)))) 1855 (setq cmds (cdr cmds))))
1857 1856
1858 1857
1859 (defun follow-redraw-after-event (event) 1858 (defun follow-redraw-after-event (event)
1860 "Adviced by Follow mode." 1859 "Adviced by Follow mode."
1861 (condition-case nil 1860 (condition-case nil
1862 (let* ((orig-win (selected-window)) 1861 (let* ((orig-win (selected-window))
1863 (win (nth 0 (funcall 1862 (win (nth 0 (funcall
1864 (symbol-function 'event-start) event))) 1863 (symbol-function 'event-start) event)))
1865 (fmode (assq 'follow-mode 1864 (fmode (assq 'follow-mode
1866 (buffer-local-variables 1865 (buffer-local-variables
1867 (window-buffer win))))) 1866 (window-buffer win)))))
1868 (if (and fmode (cdr fmode)) 1867 (if (and fmode (cdr fmode))
1869 ;; The selected window is in follow-mode 1868 ;; The selected window is in follow-mode
@@ -1882,7 +1881,7 @@ when in Follow mode."
1882 1881
1883 ;; Advice all scrollbar functions on the form: 1882 ;; Advice all scrollbar functions on the form:
1884 ;; 1883 ;;
1885 ;; (defadvice scrollbar-line-down 1884 ;; (defadvice scrollbar-line-down
1886 ;; (after follow-scrollbar-line-down activate) 1885 ;; (after follow-scrollbar-line-down activate)
1887 ;; (follow-xemacs-scrollbar-support (ad-get-arg 0))) 1886 ;; (follow-xemacs-scrollbar-support (ad-get-arg 0)))
1888 1887
@@ -1894,12 +1893,12 @@ when in Follow mode."
1894 scrollbar-to-top 1893 scrollbar-to-top
1895 scrollbar-vertical-drag ; Object 1894 scrollbar-vertical-drag ; Object
1896 ))) 1895 )))
1897 1896
1898 (while cmds 1897 (while cmds
1899 (eval 1898 (eval
1900 (` (defadvice (, (intern (symbol-name (car cmds)))) 1899 (` (defadvice (, (intern (symbol-name (car cmds))))
1901 (after 1900 (after
1902 (, (intern (concat "follow-" (symbol-name (car cmds))))) 1901 (, (intern (concat "follow-" (symbol-name (car cmds)))))
1903 activate) 1902 activate)
1904 "Adviced by `follow-mode'." 1903 "Adviced by `follow-mode'."
1905 (follow-xemacs-scrollbar-support (ad-get-arg 0))))) 1904 (follow-xemacs-scrollbar-support (ad-get-arg 0)))))
@@ -1917,8 +1916,8 @@ WINDOW can be an object or a window."
1917 (progn 1916 (progn
1918 (if (consp window) 1917 (if (consp window)
1919 (setq window (car window))) 1918 (setq window (car window)))
1920 (let ((fmode (assq 'follow-mode 1919 (let ((fmode (assq 'follow-mode
1921 (buffer-local-variables 1920 (buffer-local-variables
1922 (window-buffer window)))) 1921 (window-buffer window))))
1923 (orig-win (selected-window))) 1922 (orig-win (selected-window)))
1924 (if (and fmode (cdr fmode)) 1923 (if (and fmode (cdr fmode))
@@ -1949,7 +1948,7 @@ WINDOW can be an object or a window."
1949;;; output filter. It also makes sure that the windows connected to 1948;;; output filter. It also makes sure that the windows connected to
1950;;; the buffer are aligned. 1949;;; the buffer are aligned.
1951;;; 1950;;;
1952;;; Discussion: How to we find processes which doesn't call 1951;;; Discussion: How do we find processes which don't call
1953;;; `set-process-filter'? (How often are processes created in a 1952;;; `set-process-filter'? (How often are processes created in a
1954;;; buffer after Follow mode are activated?) 1953;;; buffer after Follow mode are activated?)
1955;;; 1954;;;
@@ -1962,11 +1961,9 @@ WINDOW can be an object or a window."
1962;; filter... 1961;; filter...
1963 1962
1964(defadvice set-process-filter (before follow-set-process-filter activate) 1963(defadvice set-process-filter (before follow-set-process-filter activate)
1965 "Follow Mode listens to calls to this function to make 1964 "Ensure process output will be displayed correctly in Follow Mode buffers."
1966sure process output will be displayed correctly in buffers
1967in which the mode is activated.
1968 1965
1969Follow Mode inserts its own process filter to do its 1966Follow Mode inserts its own process filter to do its
1970magic stuff before the real process filter is called." 1967magic stuff before the real process filter is called."
1971 (if follow-intercept-processes 1968 (if follow-intercept-processes
1972 (progn 1969 (progn
@@ -1978,8 +1975,8 @@ magic stuff before the real process filter is called."
1978 ((eq (ad-get-arg 1) nil) 1975 ((eq (ad-get-arg 1) nil)
1979 (ad-set-arg 1 'follow-generic-filter)) 1976 (ad-set-arg 1 'follow-generic-filter))
1980 (t 1977 (t
1981 (setq follow-process-filter-alist 1978 (setq follow-process-filter-alist
1982 (cons (cons (ad-get-arg 0) (ad-get-arg 1)) 1979 (cons (cons (ad-get-arg 0) (ad-get-arg 1))
1983 follow-process-filter-alist)) 1980 follow-process-filter-alist))
1984 (ad-set-arg 1 'follow-generic-filter)))))) 1981 (ad-set-arg 1 'follow-generic-filter))))))
1985 1982
@@ -1989,7 +1986,7 @@ magic stuff before the real process filter is called."
1989 (ad-disable-advice 'set-process-filter 'before 1986 (ad-disable-advice 'set-process-filter 'before
1990 'follow-set-process-filter) 1987 'follow-set-process-filter)
1991 (ad-activate 'set-process-filter) 1988 (ad-activate 'set-process-filter)
1992 (prog1 1989 (prog1
1993 (set-process-filter proc filter) 1990 (set-process-filter proc filter)
1994 (ad-enable-advice 'set-process-filter 'before 1991 (ad-enable-advice 'set-process-filter 'before
1995 'follow-set-process-filter) 1992 'follow-set-process-filter)
@@ -1997,12 +1994,10 @@ magic stuff before the real process filter is called."
1997 1994
1998 1995
1999(defadvice process-filter (after follow-process-filter activate) 1996(defadvice process-filter (after follow-process-filter activate)
2000 "Normally when Follow mode is activated all processes has the 1997 "Return the original process filter, not `follow-generic-filter'."
2001process filter set to `follow-generic-filter'. With this advice,
2002the original process filter is returned."
2003 (cond ((eq ad-return-value 'follow-generic-filter) 1998 (cond ((eq ad-return-value 'follow-generic-filter)
2004 (setq ad-return-value 1999 (setq ad-return-value
2005 (cdr-safe (assq (ad-get-arg 0) 2000 (cdr-safe (assq (ad-get-arg 0)
2006 follow-process-filter-alist)))))) 2001 follow-process-filter-alist))))))
2007 2002
2008 2003
@@ -2011,12 +2006,12 @@ the original process filter is returned."
2011 (ad-disable-advice 'process-filter 'after 2006 (ad-disable-advice 'process-filter 'after
2012 'follow-process-filter) 2007 'follow-process-filter)
2013 (ad-activate 'process-filter) 2008 (ad-activate 'process-filter)
2014 (prog1 2009 (prog1
2015 (process-filter proc) 2010 (process-filter proc)
2016 (ad-enable-advice 'process-filter 'after 2011 (ad-enable-advice 'process-filter 'after
2017 'follow-process-filter) 2012 'follow-process-filter)
2018 (ad-activate 'process-filter))) 2013 (ad-activate 'process-filter)))
2019 2014
2020 2015
2021(defun follow-tidy-process-filter-alist () 2016(defun follow-tidy-process-filter-alist ()
2022 "Remove old processes from `follow-process-filter-alist'." 2017 "Remove old processes from `follow-process-filter-alist'."
@@ -2024,7 +2019,7 @@ the original process filter is returned."
2024 (ps (process-list)) 2019 (ps (process-list))
2025 (new ())) 2020 (new ()))
2026 (while alist 2021 (while alist
2027 (if (and (not (memq (process-status (car (car alist))) 2022 (if (and (not (memq (process-status (car (car alist)))
2028 '(exit signal closed nil))) 2023 '(exit signal closed nil)))
2029 (memq (car (car alist)) ps)) 2024 (memq (car (car alist)) ps))
2030 (setq new (cons (car alist) new))) 2025 (setq new (cons (car alist) new)))
@@ -2060,8 +2055,8 @@ system. (See `follow-mode')"
2060 2055
2061All current spypoints are removed and no new will be added. 2056All current spypoints are removed and no new will be added.
2062 2057
2063The effect is that Follow mode won't be able to handle buffers 2058The effect is that Follow mode won't be able to handle buffers
2064connected to processes. 2059connected to processes.
2065 2060
2066The only reason to call this function is if the Follow mode spy filter 2061The only reason to call this function is if the Follow mode spy filter
2067would interfere with some other package. If this happens, please 2062would interfere with some other package. If this happens, please
@@ -2072,10 +2067,10 @@ report this using the `follow-submit-feedback' function."
2072 (while list 2067 (while list
2073 (if (eq (process-filter (car list)) 'follow-generic-filter) 2068 (if (eq (process-filter (car list)) 'follow-generic-filter)
2074 (progn 2069 (progn
2075 (follow-call-set-process-filter 2070 (follow-call-set-process-filter
2076 (car list) 2071 (car list)
2077 (cdr-safe (assq (car list) follow-process-filter-alist))) 2072 (cdr-safe (assq (car list) follow-process-filter-alist)))
2078 (setq follow-process-filter-alist 2073 (setq follow-process-filter-alist
2079 (delq (assq (car list) follow-process-filter-alist) 2074 (delq (assq (car list) follow-process-filter-alist)
2080 follow-process-filter-alist)))) 2075 follow-process-filter-alist))))
2081 (setq list (cdr list)))) 2076 (setq list (cdr list))))
@@ -2110,7 +2105,7 @@ report this using the `follow-submit-feedback' function."
2110 2105
2111 ;; Output the `output'. 2106 ;; Output the `output'.
2112 (let ((filter (cdr-safe (assq proc follow-process-filter-alist)))) 2107 (let ((filter (cdr-safe (assq proc follow-process-filter-alist))))
2113 (cond 2108 (cond
2114 ;; Call the original filter function 2109 ;; Call the original filter function
2115 (filter 2110 (filter
2116 (funcall filter proc output)) 2111 (funcall filter proc output))
@@ -2147,7 +2142,7 @@ report this using the `follow-submit-feedback' function."
2147 (progn 2142 (progn
2148 (set-buffer buf) 2143 (set-buffer buf)
2149 (if (and (boundp 'follow-mode) follow-mode) 2144 (if (and (boundp 'follow-mode) follow-mode)
2150 (progn 2145 (progn
2151 (select-window win) 2146 (select-window win)
2152 (let* ((windows (follow-all-followers win)) 2147 (let* ((windows (follow-all-followers win))
2153 (win-start-end (follow-windows-start-end windows)) 2148 (win-start-end (follow-windows-start-end windows))
@@ -2165,7 +2160,7 @@ report this using the `follow-submit-feedback' function."
2165 (set-window-start win orig-window-start) 2160 (set-window-start win orig-window-start)
2166 (follow-redisplay windows win) 2161 (follow-redisplay windows win)
2167 (setq win-start-end (follow-windows-start-end windows)) 2162 (setq win-start-end (follow-windows-start-end windows))
2168 (follow-select-if-visible new-window-point 2163 (follow-select-if-visible new-window-point
2169 win-start-end) 2164 win-start-end)
2170 (goto-char new-window-point) 2165 (goto-char new-window-point)
2171 (if (eq win (selected-window)) 2166 (if (eq win (selected-window))
@@ -2177,7 +2172,7 @@ report this using the `follow-submit-feedback' function."
2177 ;; Avoid redisplaying the first window. If the 2172 ;; Avoid redisplaying the first window. If the
2178 ;; point is visible at a window below, 2173 ;; point is visible at a window below,
2179 ;; redisplay and select it. 2174 ;; redisplay and select it.
2180 ((follow-select-if-visible-from-first 2175 ((follow-select-if-visible-from-first
2181 new-window-point windows) 2176 new-window-point windows)
2182 (follow-debug-message "filter: Seen from first") 2177 (follow-debug-message "filter: Seen from first")
2183 (follow-redisplay windows (car windows)) 2178 (follow-redisplay windows (car windows))
@@ -2185,18 +2180,18 @@ report this using the `follow-submit-feedback' function."
2185 (setq win-start-end 2180 (setq win-start-end
2186 (follow-windows-start-end windows))) 2181 (follow-windows-start-end windows)))
2187 ;; None of the above. We stick to the current window. 2182 ;; None of the above. We stick to the current window.
2188 (t 2183 (t
2189 (follow-debug-message "filter: nothing"))) 2184 (follow-debug-message "filter: nothing")))
2190 2185
2191 ;; Here we have slected a window. Make sure the 2186 ;; Here we have slected a window. Make sure the
2192 ;; windows are aligned and the point is visible 2187 ;; windows are aligned and the point is visible
2193 ;; in the selected window. 2188 ;; in the selected window.
2194 (if (and (not (follow-pos-visible 2189 (if (and (not (follow-pos-visible
2195 (point) (selected-window) win-start-end)) 2190 (point) (selected-window) win-start-end))
2196 (not return-to-orig-win)) 2191 (not return-to-orig-win))
2197 (progn 2192 (progn
2198 (sit-for 0) 2193 (sit-for 0)
2199 (setq win-start-end 2194 (setq win-start-end
2200 (follow-windows-start-end windows)))) 2195 (follow-windows-start-end windows))))
2201 2196
2202 (if (or follow-internal-force-redisplay 2197 (if (or follow-internal-force-redisplay
@@ -2211,7 +2206,7 @@ report this using the `follow-submit-feedback' function."
2211 (if (and (eq buf (current-buffer)) 2206 (if (and (eq buf (current-buffer))
2212 (buffer-name old-buffer)) 2207 (buffer-name old-buffer))
2213 (set-buffer old-buffer))) 2208 (set-buffer old-buffer)))
2214 2209
2215 (follow-invalidate-cache) 2210 (follow-invalidate-cache)
2216 2211
2217 ;; Normally, if the display has been changed, it is redrawn. All 2212 ;; Normally, if the display has been changed, it is redrawn. All
@@ -2263,8 +2258,8 @@ report this using the `follow-submit-feedback' function."
2263 buf) 2258 buf)
2264 (select-frame frame) 2259 (select-frame frame)
2265 (unwind-protect 2260 (unwind-protect
2266 (walk-windows 2261 (walk-windows
2267 (function 2262 (function
2268 (lambda (win) 2263 (lambda (win)
2269 (setq buf (window-buffer win)) 2264 (setq buf (window-buffer win))
2270 (if (memq buf buffers) 2265 (if (memq buf buffers)
@@ -2314,14 +2309,14 @@ report this using the `follow-submit-feedback' function."
2314 (boundp 'isearch-slow-terminal-mode) 2309 (boundp 'isearch-slow-terminal-mode)
2315 (not isearch-slow-terminal-mode)) 2310 (not isearch-slow-terminal-mode))
2316 (let ((buf (current-buffer))) 2311 (let ((buf (current-buffer)))
2317 (setq isearch-window-configuration 2312 (setq isearch-window-configuration
2318 (current-window-configuration)) 2313 (current-window-configuration))
2319 (set-buffer buf))))) 2314 (set-buffer buf)))))
2320 2315
2321;;}}} 2316;;}}}
2322;;{{{ Tail window handling 2317;;{{{ Tail window handling
2323 2318
2324;;; In Emacs (not XEmacs) windows showing nothing are sometimes 2319;;; In Emacs (not XEmacs) windows showing nothing are sometimes
2325;;; recentered. When in Follow Mode, this is not desireable for 2320;;; recentered. When in Follow Mode, this is not desireable for
2326;;; non-first windows in the window chain. This section tries to 2321;;; non-first windows in the window chain. This section tries to
2327;;; make the windows stay where they should be. 2322;;; make the windows stay where they should be.
@@ -2369,9 +2364,9 @@ displaying a short file in two windows, using Follow Mode."
2369(if (and follow-avoid-tail-recenter-p 2364(if (and follow-avoid-tail-recenter-p
2370 (fboundp 'move-overlay)) 2365 (fboundp 'move-overlay))
2371 (defadvice move-overlay (before follow-move-overlay activate) 2366 (defadvice move-overlay (before follow-move-overlay activate)
2372 "Adviced by Follow Mode. Don't recenter windows showing only 2367 "Adviced by Follow Mode.
2373the end of a buffer. This prevents `mouse-drag-region' from 2368Don't recenter windows showing only the end of a buffer.
2374messing things up." 2369This prevents `mouse-drag-region' from messing things up."
2375 (follow-avoid-tail-recenter))) 2370 (follow-avoid-tail-recenter)))
2376 2371
2377;;}}} 2372;;}}}
@@ -2384,12 +2379,12 @@ messing things up."
2384 2379
2385(cond (nil 2380(cond (nil
2386(setq elp-function-list 2381(setq elp-function-list
2387 '(window-end 2382 '(window-end
2388 vertical-motion 2383 vertical-motion
2389 ; sit-for ;; elp can't handle advices... 2384 ; sit-for ;; elp can't handle advices...
2390 follow-mode 2385 follow-mode
2391 follow-all-followers 2386 follow-all-followers
2392 follow-split-followers 2387 follow-split-followers
2393 follow-redisplay 2388 follow-redisplay
2394 follow-downward 2389 follow-downward
2395 follow-calculate-first-window-start 2390 follow-calculate-first-window-start