]> code.delx.au - gnu-emacs/blobdiff - lisp/follow.el
(follow-submit-feedback, follow-mode): Remove
[gnu-emacs] / lisp / follow.el
index 2d818708c63f1ab635c769ac2ebdd5e099e4cdb9..74dc12f88814772952b9941b76b75ba03e67bff7 100644 (file)
@@ -1,13 +1,13 @@
-;;; follow.el --- Minor mode, Synchronize windows showing the same buffer.
+;;; follow.el --- synchronize windows showing the same buffer
 
-;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1999, 2001, 2005
+;;           Free Software Foundation, Inc.
 
-;; Author: Anders Lindgren <andersl@csd.uu.se>
-;; Maintainer: Anders Lindgren <andersl@csd.uu.se>
-;; Created: 25 May 1995
-;; Version: 1.7
-;; Keywords: display, window, minor-mode
-;; Date: 4 Jun 1997
+;; Author: Anders Lindgren <andersl@andersl.com>
+;; Maintainer: Anders Lindgren <andersl@andersl.com>
+;; Created: 1995-05-25
+;; Keywords: display, window, minor-mode, convenience
+;; Last Changed: 1999-11-17
 
 ;; This file is part of GNU Emacs.
 
 ;; and being able to use 144 lines instead of the normal 72... (your
 ;; mileage may vary).
 
-
-;; The latest version, and a demonstration, are avaiable at:
-;;
-;;     http://www.csd.uu.se/~andersl/emacs.shtml
-
-
 ;; To test this package, make sure `follow' is loaded, or will be
 ;; autoloaded when activated (see below). Then do the following:
 ;;
 ;;
 ;; When `Follow' mode is activated, functions stored in the hook
 ;; `follow-mode-hook' are called.  When it is deactivated
-;; `follow-mode-off-hook' is runed.
+;; `follow-mode-off-hook' is run.
 ;;
 ;; The keymap `follow-key-map' contains key bindings activated by
 ;; `follow-mode'.
 (defgroup follow nil
   "Synchronize windows showing the same buffer."
   :prefix "follow-"
-  :group 'windows)
+  :group 'windows
+  :group 'convenience)
 
 (defvar follow-mode nil
   "Variable indicating if Follow mode is active.")
@@ -391,15 +386,14 @@ Used by `follow-window-size-change'.")
 (eval-when-compile (require 'reporter))
 
 (defun follow-submit-feedback ()
-  "Submit feedback on Follow mode to the author: andersl@csd.uu.se"
+  "Submit feedback on Follow mode to the author: andersl@andersl.com"
   (interactive)
   (require 'reporter)
   (and (y-or-n-p "Do you really want to submit a report on Follow mode? ")
        (reporter-submit-bug-report
-       "Anders Lindgren <andersl@csd.uu.se>"
+       "Anders Lindgren <andersl@andersl.com>"
        "follow.el"
        '(post-command-hook
-         post-command-idle-hook
          pre-command-hook
          window-size-change-functions
          window-scroll-functions
@@ -688,9 +682,6 @@ Keys specific to Follow mode:
               (set 'scroll-on-clipped-lines nil))
           (force-mode-line-update)
           (add-hook 'post-command-hook 'follow-post-command-hook t)
-          (if (boundp 'post-command-idle-hook)
-              (add-hook 'post-command-idle-hook
-                        'follow-avoid-tail-recenter t))
           (run-hooks 'follow-mode-hook))
 
          ((and (not follow-mode) follow-mode-orig) ; Off
@@ -714,7 +705,7 @@ Keys specific to Follow mode:
 ;; This will start follow-mode whenever a new file is loaded, if
 ;; the variable `follow-auto' is non-nil.
 
-(add-hook 'find-file-hooks 'follow-find-file-hook t)
+(add-hook 'find-file-hook 'follow-find-file-hook t)
 
 (defun follow-find-file-hook ()
   "Find-file hook for Follow Mode.  See the variable `follow-auto'."
@@ -985,7 +976,8 @@ of the way from the true end."
          (t
           (select-window (car (reverse followers)))))
     (goto-char pos)
-    (end-of-buffer arg)))
+    (with-no-warnings
+      (end-of-buffer arg))))
 
 ;;}}}
 
@@ -1485,7 +1477,7 @@ position of the first window. Otherwise it is a good guess."
 (defun follow-avoid-tail-recenter (&rest rest)
   "Make sure windows displaying the end of a buffer aren't recentered.
 
-This is done by reading and rewriting the start positon of
+This is done by reading and rewriting the start position of
 non-first windows in Follow Mode."
   (if follow-avoid-tail-recenter-p
       (let* ((orig-buffer (current-buffer))
@@ -1567,7 +1559,7 @@ non-first windows in Follow Mode."
              (or follow-internal-force-redisplay
                  (progn
                    (if (eq dest (point-max))
-                       ;; We're at the end, we have be be careful since
+                       ;; We're at the end, we have to be careful since
                        ;; the display can be aligned while `dest' can
                        ;; be visible in several windows.
                        (cond
@@ -1774,12 +1766,12 @@ non-first windows in Follow Mode."
                     scroll-bar-set-window-start)))
         (while cmds
           (eval
-           (` (defadvice (, (intern (symbol-name (car cmds))))
+           `(defadvice ,(intern (symbol-name (car cmds)))
                 (after
-                 (, (intern (concat "follow-" (symbol-name (car cmds)))))
+                 ,(intern (concat "follow-" (symbol-name (car cmds))))
                  activate)
                 "Adviced by Follow Mode."
-                (follow-redraw-after-event (ad-get-arg 0)))))
+                (follow-redraw-after-event (ad-get-arg 0))))
           (setq cmds (cdr cmds))))
 
 
@@ -1824,12 +1816,12 @@ non-first windows in Follow Mode."
 
        (while cmds
          (eval
-          (` (defadvice (, (intern (symbol-name (car cmds))))
+          `(defadvice ,(intern (symbol-name (car cmds)))
                (after
-                (, (intern (concat "follow-" (symbol-name (car cmds)))))
+                ,(intern (concat "follow-" (symbol-name (car cmds))))
                 activate)
                "Adviced by `follow-mode'."
-               (follow-xemacs-scrollbar-support (ad-get-arg 0)))))
+               (follow-xemacs-scrollbar-support (ad-get-arg 0))))
          (setq cmds (cdr cmds))))
 
 
@@ -2044,24 +2036,15 @@ report this using the `follow-submit-feedback' function."
        (if (not (marker-buffer (process-mark proc)))
            (set-marker (process-mark proc) (point-max)))
        (let ((moving (= (point) (process-mark proc)))
-             (odeactivate (and (boundp 'deactivate-mark)
-                               (symbol-value 'deactivate-mark)))
-             (old-buffer-read-only buffer-read-only))
-         (setq buffer-read-only nil)
+             deactivate-mark
+             (inhibit-read-only t))
          (save-excursion
            (goto-char (process-mark proc))
            ;; `insert-before-markers' just in case the users next
            ;; command is M-y.
            (insert-before-markers output)
            (set-marker (process-mark proc) (point)))
-         (if moving (goto-char (process-mark proc)))
-         (if (boundp 'deactivate-mark)
-             ;; This could really be
-             ;;    (setq deactivate-mark odeactivate)
-             ;; but this raises an error when compiling on XEmacs.
-             (funcall (symbol-function 'set)
-                      'deactivate-mark odeactivate))
-         (setq buffer-read-only old-buffer-read-only)))))
+         (if moving (goto-char (process-mark proc)))))))
 
     ;; If we're in follow mode, do our stuff.  Select a new window and
     ;; redisplay.  (Actually, it is redundant to check `buf', but I
@@ -2077,12 +2060,20 @@ report this using the `follow-submit-feedback' function."
                       (new-window-start (window-start win))
                       (new-window-point (window-point win)))
                  (cond
-                  ;; The window was moved. Move it back and
-                  ;; select a new.  If no better could be found,
-                  ;; we stick the the new start position.  This
-                  ;; is used when the original process filter
-                  ;; tries to position the cursor at the bottom
-                  ;; of the window.  Example: `lyskom'.
+                  ;; The start of the selected window was repositioned.
+                  ;; Try to use the original start position and continue
+                  ;; working with a window to the "right" in the window
+                  ;; chain.  This will create the effect that the output
+                  ;; starts in one window and continues into the next.
+
+                  ;; If the display has changed so much that it is not
+                  ;; possible to keep the original window fixed and still
+                  ;; display the point then we give up and use the new
+                  ;; window start.
+
+                  ;; This case is typically used when the process filter
+                  ;; tries to reposition the start of the window in order
+                  ;; to view the tail of the output.
                   ((not (eq orig-window-start new-window-start))
                    (follow-debug-message "filter: Moved")
                    (set-window-start win orig-window-start)
@@ -2354,4 +2345,5 @@ This prevents `mouse-drag-region' from messing things up."
 ;; | save it".             -- Douglas Adams, "Last Chance to See"           |
 ;; \------------------------------------------------------------------------/
 
+;; arch-tag: 7b16bb1a-808c-4991-a8cc-66d3822936d0
 ;;; follow.el ends here