diff options
| author | Richard M. Stallman | 1998-04-02 03:37:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-02 03:37:18 +0000 |
| commit | ff7534387622b01af5bcb5a07b09d17accbf1d24 (patch) | |
| tree | aeab0517cc89ee3c6de239287d563aa4060f327c | |
| parent | 15b0983da00dfe17311ca3b54863ba5ddf3637f0 (diff) | |
| download | emacs-ff7534387622b01af5bcb5a07b09d17accbf1d24.tar.gz emacs-ff7534387622b01af5bcb5a07b09d17accbf1d24.zip | |
(follow-scroll-up): Cope if `window-end' returns nil.
(follow-select-if-end-visible): Likewise.
(follow-mode-version): Variable removed.
| -rw-r--r-- | lisp/follow.el | 194 |
1 files changed, 52 insertions, 142 deletions
diff --git a/lisp/follow.el b/lisp/follow.el index aea56ee0b96..a3f1ec782dd 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | ;;{{{ Documentation | 31 | ;;{{{ Documentation |
| 32 | 32 | ||
| 33 | ;; `Follow mode' is a minor mode for Emacs 19 and XEmacs which | 33 | ;; `Follow mode' is a minor mode for Emacs and XEmacs that |
| 34 | ;; combines windows into one tall virtual window. | 34 | ;; combines windows into one tall virtual window. |
| 35 | ;; | 35 | ;; |
| 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 |
| @@ -45,31 +45,27 @@ | |||
| 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 a large screen and two |
| 49 | ;; side-by-side window are used. The user can, with the help of Follow | 49 | ;; side-by-side window are used. The user can, with the help of Follow |
| 50 | ;; mode, use two full-height windows as though they would have been | 50 | ;; mode, use two full-height windows as though they would have been |
| 51 | ;; one. Imagine yourself editing a large function, or section of text, | 51 | ;; one. Imagine yourself editing a large function, or section of text, |
| 52 | ;; and being able to use 144 lines instead of the normal 72... (your | 52 | ;; and being able to use 144 lines instead of the normal 72... (your |
| 53 | ;; mileage may vary). | 53 | ;; mileage may vary). |
| 54 | 54 | ||
| 55 | |||
| 55 | ;; The latest version, and a demonstration, are avaiable at: | 56 | ;; The latest version, and a demonstration, are avaiable at: |
| 56 | ;; | 57 | ;; |
| 57 | ;; ftp://ftp.csd.uu.se/pub/users/andersl/emacs/follow.el | 58 | ;; http://www.csd.uu.se/~andersl/emacs.shtml |
| 58 | ;; http://www.csd.uu.se/~andersl/follow.shtml | ||
| 59 | |||
| 60 | ;; `Follow mode' can be used together with Emacs 19 and XEmacs. | ||
| 61 | ;; It has been tested together with Emacs 19.27, 19.28, 19.29, | ||
| 62 | ;; 19.30, XEmacs 19.12, and 19.13. | ||
| 63 | 59 | ||
| 64 | 60 | ||
| 65 | ;; To test this package, make sure `follow' is loaded, or will be | 61 | ;; To test this package, make sure `follow' is loaded, or will be |
| 66 | ;; autoloaded when activated (see below). Then do the following: | 62 | ;; autoloaded when activated (see below). Then do the following: |
| 67 | ;; | 63 | ;; |
| 68 | ;; * Find your favorite file (preferably a long one.) | 64 | ;; * Find your favorite file (preferably a long one). |
| 69 | ;; | 65 | ;; |
| 70 | ;; * Resize Emacs so that it will be wide enough for two full sized | 66 | ;; * Resize Emacs so that it will be wide enough for two full size |
| 71 | ;; columns. Delete the other windows and split with the commands | 67 | ;; columns. Delete the other windows and split the window with |
| 72 | ;; `C-x 1 C-x 3'. | 68 | ;; the commands `C-x 1 C-x 3'. |
| 73 | ;; | 69 | ;; |
| 74 | ;; * Give the command: | 70 | ;; * Give the command: |
| 75 | ;; M-x follow-mode <RETURN> | 71 | ;; M-x follow-mode <RETURN> |
| @@ -101,16 +97,6 @@ | |||
| 101 | ;; to turn it off. | 97 | ;; to turn it off. |
| 102 | 98 | ||
| 103 | 99 | ||
| 104 | ;; Installation: | ||
| 105 | ;; | ||
| 106 | ;; To fully install this, add this file to your Emacs Lisp directory and | ||
| 107 | ;; compile it with M-x byte-compile-file. Then add the following to the | ||
| 108 | ;; appropriate init file (normally your `~/.emacs' file): | ||
| 109 | ;; | ||
| 110 | ;; (autoload 'follow-mode "follow" | ||
| 111 | ;; "Synchronize windows showing the same buffer, minor mode." t) | ||
| 112 | |||
| 113 | |||
| 114 | ;; The command `follow-delete-other-windows-and-split' maximises the | 100 | ;; The command `follow-delete-other-windows-and-split' maximises the |
| 115 | ;; visible area of the current buffer. | 101 | ;; visible area of the current buffer. |
| 116 | ;; | 102 | ;; |
| @@ -118,17 +104,12 @@ | |||
| 118 | ;; key map. To do so, add the following lines (replacing `[f7]' and | 104 | ;; key map. To do so, add the following lines (replacing `[f7]' and |
| 119 | ;; `[f8]' with your favorite keys) to the init file: | 105 | ;; `[f8]' with your favorite keys) to the init file: |
| 120 | ;; | 106 | ;; |
| 121 | ;; (autoload 'follow-mode "follow" | ||
| 122 | ;; "Synchronize windows showing the same buffer, minor mode." t) | ||
| 123 | ;; (global-set-key [f8] 'follow-mode) | 107 | ;; (global-set-key [f8] 'follow-mode) |
| 124 | ;; | ||
| 125 | ;; (autoload 'follow-delete-other-windows-and-split "follow" | ||
| 126 | ;; "Delete other windows, split the frame in two, and enter Follow Mode." t) | ||
| 127 | ;; (global-set-key [f7] 'follow-delete-other-windows-and-split) | 108 | ;; (global-set-key [f7] 'follow-delete-other-windows-and-split) |
| 128 | 109 | ||
| 129 | 110 | ||
| 130 | ;; There exists two system variables which controls the appearence of | 111 | ;; There exists two system variables that controls the appearence of |
| 131 | ;; lines which are wider than the window containing them. The default | 112 | ;; lines that are wider than the window containing them. The default |
| 132 | ;; is to truncate long lines whenever a window isn't as wide as the | 113 | ;; is to truncate long lines whenever a window isn't as wide as the |
| 133 | ;; frame. | 114 | ;; frame. |
| 134 | ;; | 115 | ;; |
| @@ -149,7 +130,7 @@ | |||
| 149 | 130 | ||
| 150 | 131 | ||
| 151 | ;; The correct way to cofigurate Follow mode, or any other mode for | 132 | ;; The correct way to cofigurate Follow mode, or any other mode for |
| 152 | ;; that matter, is to create one (or more) function which does | 133 | ;; that matter, is to create one (or more) function that does |
| 153 | ;; whatever you would like to do. The function is then added to | 134 | ;; whatever you would like to do. The function is then added to |
| 154 | ;; a hook. | 135 | ;; a hook. |
| 155 | ;; | 136 | ;; |
| @@ -170,10 +151,11 @@ | |||
| 170 | 151 | ||
| 171 | ;; Usage: | 152 | ;; Usage: |
| 172 | ;; | 153 | ;; |
| 173 | ;; To activate give the command: M-x follow-mode | 154 | ;; To activate issue the command "M-x follow-mode" |
| 174 | ;; and press return. To deactivate, do it again. | 155 | ;; and press return. To deactivate, do it again. |
| 175 | ;; | 156 | ;; |
| 176 | ;; Some special commands have been developed to make life even easier: | 157 | ;; The following is a list of commands useful when follow-mode is active. |
| 158 | ;; | ||
| 177 | ;; follow-scroll-up C-c . C-v | 159 | ;; follow-scroll-up C-c . C-v |
| 178 | ;; Scroll text in a Follow Mode window chain up. | 160 | ;; Scroll text in a Follow Mode window chain up. |
| 179 | ;; | 161 | ;; |
| @@ -231,7 +213,7 @@ | |||
| 231 | ;; Implementation: | 213 | ;; Implementation: |
| 232 | ;; | 214 | ;; |
| 233 | ;; In an ideal world, follow mode would have been implemented in the | 215 | ;; In an ideal world, follow mode would have been implemented in the |
| 234 | ;; kernal of the display routines, making sure that the windows (in | 216 | ;; kernel of the display routines, making sure that the windows (using |
| 235 | ;; follow mode) ALWAYS are aligned. On planet earth, however, we must | 217 | ;; follow mode) ALWAYS are aligned. On planet earth, however, we must |
| 236 | ;; accept a solution where we ALMOST ALWAYS can make sure that the | 218 | ;; accept a solution where we ALMOST ALWAYS can make sure that the |
| 237 | ;; windows are aligned. | 219 | ;; windows are aligned. |
| @@ -242,86 +224,14 @@ | |||
| 242 | ;; 3) When a scrollbar has been moved. | 224 | ;; 3) When a scrollbar has been moved. |
| 243 | ;; | 225 | ;; |
| 244 | ;; This will cover most situations. (Let me know if there are other | 226 | ;; This will cover most situations. (Let me know if there are other |
| 245 | ;; situations which should be covered.) | 227 | ;; situations that should be covered.) |
| 246 | ;; | 228 | ;; |
| 247 | ;; However, only the selected window is checked, for the reason of | 229 | ;; Note that only the selected window is checked, for the reason of |
| 248 | ;; efficiency and code complexity. (i.e. it is possible to make a | 230 | ;; efficiency and code complexity. (I.e. it is possible to make a |
| 249 | ;; non-selected windows unaligned. It will, however, pop right back | 231 | ;; non-selected windows unaligned. It will, however, pop right back |
| 250 | ;; when it is selected.) | 232 | ;; when it is selected.) |
| 251 | 233 | ||
| 252 | ;;}}} | 234 | ;;}}} |
| 253 | ;;{{{ Change Log | ||
| 254 | |||
| 255 | ;;; Change log: | ||
| 256 | ;; 25-May-95 andersl * File created. | ||
| 257 | ;; 26-May-95 andersl * It works! | ||
| 258 | ;; 27-May-95 andersl * Avoids hitting the head in the roof. | ||
| 259 | ;; * follow-scroll-up, -scroll-down, and -recenter. | ||
| 260 | ;; * V0.1 Sent to Ohio. | ||
| 261 | ;; 28-May-95 andersl * Scroll-bar support added. | ||
| 262 | ;; 30-May-95 andersl * Code adopted to standard style. | ||
| 263 | ;; * Minor mode keymap. | ||
| 264 | ;; 2-Jun-95 andersl * Processor output. | ||
| 265 | ;; 3-Jun-95 andersl * V0.4 | ||
| 266 | ;; 5-Jun-95 andersl * V0.5. Copyright notice corrected. | ||
| 267 | ;; (The old one stated that I had copyright, but | ||
| 268 | ;; that Emacs could be freely distributed ;-) ) | ||
| 269 | ;; 6-Jun-95 andersl * Lucid support added. (no longer valid.) | ||
| 270 | ;; 7-Jun-95 andersl * Menu bar added. | ||
| 271 | ;; * Bug fix, (at-window 0 0) => (frame-first-window) | ||
| 272 | ;; 15-Jun-95 andersl * 0.8 Major rework. looong lines and outline mode. | ||
| 273 | ;; 18-Jun-95 andersl * 0.9 Allow a tail window to be selected, but pick | ||
| 274 | ;; a better one when edited. | ||
| 275 | ;; 26-Jun-95 andersl * Inlineing. | ||
| 276 | ;; 02-Jul-95 andersl * compute-motion imitated with a ugly workaround, | ||
| 277 | ;; Works with XEmacs again! | ||
| 278 | ;; 15-Jul-95 andersl * find-file hook. | ||
| 279 | ;; * submit-feedback. | ||
| 280 | ;; * Survives major mode changes. | ||
| 281 | ;; * Region spanning multiple windows looks | ||
| 282 | ;; reasonably good. | ||
| 283 | ;; 19-Jul-95 andersl * New process-filter handling. | ||
| 284 | ;; 1-Aug-95 andersl * XEmacs scrollbar support. | ||
| 285 | ;; * Emacs 19 `window-size-change' support. | ||
| 286 | ;; * `save-window-excursion' removed, it triggered | ||
| 287 | ;; a redraw! | ||
| 288 | ;; 5-Aug-95 andersl * `follow-switch-to-current-buffer-all' added. | ||
| 289 | ;; 16-Nov-95 andersl * V1.0 released! | ||
| 290 | ;; 17-Nov-95 andersl * Byte compiler silencer for XEmacs broken. | ||
| 291 | ;; * fkey-end-of-buffer treated the same way | ||
| 292 | ;; end-of-buffer is. | ||
| 293 | ;; * follow-mode-off-hook added. | ||
| 294 | ;; (Suggested by David Hughes, thanks!) | ||
| 295 | ;; 20-Nov-95 andersl * Bug in menu code corrected. | ||
| 296 | ;; (Reported by Robert E. Brown, thanks!) | ||
| 297 | ;; 5-Dec-95 andersl * `follow-avoid-tail-recenter' added to the | ||
| 298 | ;; post-command-idle-hook to avoid recentering | ||
| 299 | ;; caused by `paren' et. al. | ||
| 300 | ;; 7-Dec-95 andersl * `follow-avoid-tail-recenter' called by | ||
| 301 | ;; `window-scroll-functions'. | ||
| 302 | ;; 18-Dec-95 andersl * All processes intercepted. | ||
| 303 | ;; 20-Dec-95 andersl * `follow-recenter' accepts arguments. | ||
| 304 | ;; * `move-overlay' advices, drag-region works. | ||
| 305 | ;; 2-Jan-96 andersl * XEmacs: isearch fixed. | ||
| 306 | ;; * `follow-calc-win-end' created. | ||
| 307 | ;; 8-Jan-96 andersl * XEmacs: `window-end' with `guarantee' | ||
| 308 | ;; argument used in `follow-calc-win-end'. | ||
| 309 | ;; 9-Jan-96 andersl * `follow-end-of-buffer' added. | ||
| 310 | ;; Code in post hook removed. | ||
| 311 | ;; * XEmacs: Post hook is always executed | ||
| 312 | ;; after a mouse button event. | ||
| 313 | ;; 22-Jan-96 andersl * 1.5 released. | ||
| 314 | ;; | ||
| 315 | |||
| 316 | ;;}}} | ||
| 317 | ;;{{{ LCD Entry | ||
| 318 | |||
| 319 | ;;; LCD Archive Entry: | ||
| 320 | ;; follow|Anders Lindgren|andersl@csd.uu.se| | ||
| 321 | ;; Combines windows into tall virtual window, minor mode. | ||
| 322 | ;; 20-Feb-1996|1.6|~/modes/follow.el.Z| | ||
| 323 | |||
| 324 | ;;}}} | ||
| 325 | 235 | ||
| 326 | ;;; Code: | 236 | ;;; Code: |
| 327 | 237 | ||
| @@ -345,10 +255,9 @@ | |||
| 345 | ;; (funcall (symbol-function 'set) 'bar ...) | 255 | ;; (funcall (symbol-function 'set) 'bar ...) |
| 346 | ;; | 256 | ;; |
| 347 | ;; Note: When this file is interpreted, `eval-when-compile' is | 257 | ;; Note: When this file is interpreted, `eval-when-compile' is |
| 348 | ;; evaluted (really smart...) Since it doesn't hurt to evaluate it, | 258 | ;; evaluted. Since it doesn't hurt to evaluate it, but it is a bit |
| 349 | ;; but it is a bit annoying, we test if the byte-compiler has been | 259 | ;; annoying, we test if the byte-compiler has been loaded. This can, |
| 350 | ;; loaded. This can, of course, lead to some occasional unintended | 260 | ;; of course, lead to some occasional unintended evaluation... |
| 351 | ;; evaluation... | ||
| 352 | ;; | 261 | ;; |
| 353 | ;; Should someone come up with a better solution, please let me | 262 | ;; Should someone come up with a better solution, please let me |
| 354 | ;; know. | 263 | ;; know. |
| @@ -387,9 +296,6 @@ | |||
| 387 | :type 'hook | 296 | :type 'hook |
| 388 | :group 'follow) | 297 | :group 'follow) |
| 389 | 298 | ||
| 390 | (defvar follow-mode-version "follow.el (Release 1.6)" | ||
| 391 | "The current version of Follow mode.") | ||
| 392 | |||
| 393 | (defvar follow-mode-map nil | 299 | (defvar follow-mode-map nil |
| 394 | "*Minor mode keymap for Follow mode.") | 300 | "*Minor mode keymap for Follow mode.") |
| 395 | 301 | ||
| @@ -425,7 +331,7 @@ After that, changing the prefix key requires manipulating keymaps." | |||
| 425 | (not follow-emacs-version-xemacs-p) | 331 | (not follow-emacs-version-xemacs-p) |
| 426 | "*When non-nil, patch emacs so that tail windows won't be recentered. | 332 | "*When non-nil, patch emacs so that tail windows won't be recentered. |
| 427 | 333 | ||
| 428 | A \"tail window\" is a window which displays only the end of | 334 | A \"tail window\" is a window that displays only the end of |
| 429 | the buffer. Normally it is practical for the user that empty | 335 | the buffer. Normally it is practical for the user that empty |
| 430 | windows are recentered automatically. However, when using | 336 | windows are recentered automatically. However, when using |
| 431 | Follow Mode it breaks the display when the end is displayed | 337 | Follow Mode it breaks the display when the end is displayed |
| @@ -442,7 +348,7 @@ XEmacs, as of 19.12, does not recenter windows, good!") | |||
| 442 | 348 | ||
| 443 | (defvar follow-cache-command-list | 349 | (defvar follow-cache-command-list |
| 444 | '(next-line previous-line forward-char backward-char) | 350 | '(next-line previous-line forward-char backward-char) |
| 445 | "List of commands which don't require recalculation. | 351 | "List of commands that don't require recalculation. |
| 446 | 352 | ||
| 447 | In order to be able to use the cache, a command should not change the | 353 | In order to be able to use the cache, a command should not change the |
| 448 | contents of the buffer, nor should it change selected window or current | 354 | contents of the buffer, nor should it change selected window or current |
| @@ -490,7 +396,7 @@ Used by `follow-window-size-change'.") | |||
| 490 | (and (y-or-n-p "Do you really want to submit a report on Follow mode? ") | 396 | (and (y-or-n-p "Do you really want to submit a report on Follow mode? ") |
| 491 | (reporter-submit-bug-report | 397 | (reporter-submit-bug-report |
| 492 | "Anders Lindgren <andersl@csd.uu.se>" | 398 | "Anders Lindgren <andersl@csd.uu.se>" |
| 493 | follow-mode-version | 399 | "follow.el" |
| 494 | '(post-command-hook | 400 | '(post-command-hook |
| 495 | post-command-idle-hook | 401 | post-command-idle-hook |
| 496 | pre-command-hook | 402 | pre-command-hook |
| @@ -515,7 +421,7 @@ Used by `follow-window-size-change'.") | |||
| 515 | ;;{{{ Debug messages | 421 | ;;{{{ Debug messages |
| 516 | 422 | ||
| 517 | ;; This inline function must be as small as possible! | 423 | ;; This inline function must be as small as possible! |
| 518 | ;; Maybe we should define a macro which expands to nil if | 424 | ;; Maybe we should define a macro that expands to nil if |
| 519 | ;; the variable is not set. | 425 | ;; the variable is not set. |
| 520 | 426 | ||
| 521 | (defsubst follow-debug-message (&rest args) | 427 | (defsubst follow-debug-message (&rest args) |
| @@ -562,7 +468,7 @@ Used by `follow-window-size-change'.") | |||
| 562 | (define-key follow-mode-map follow-mode-prefix map) | 468 | (define-key follow-mode-map follow-mode-prefix map) |
| 563 | 469 | ||
| 564 | ;; Replace the standard `end-of-buffer', when in Follow Mode. (I | 470 | ;; Replace the standard `end-of-buffer', when in Follow Mode. (I |
| 565 | ;; don't see the point in trying to replace every function which | 471 | ;; don't see the point in trying to replace every function that |
| 566 | ;; could be enhanced in Follow mode. End-of-buffer is a special | 472 | ;; could be enhanced in Follow mode. End-of-buffer is a special |
| 567 | ;; case since it is very simple to define and it greatly enhances | 473 | ;; case since it is very simple to define and it greatly enhances |
| 568 | ;; the look and feel of Follow mode.) | 474 | ;; the look and feel of Follow mode.) |
| @@ -587,7 +493,7 @@ Used by `follow-window-size-change'.") | |||
| 587 | (if (not follow-emacs-version-xemacs-p) | 493 | (if (not follow-emacs-version-xemacs-p) |
| 588 | 494 | ||
| 589 | ;; | 495 | ;; |
| 590 | ;; Emacs 19 | 496 | ;; Emacs |
| 591 | ;; | 497 | ;; |
| 592 | (let ((menumap (funcall (symbol-function 'make-sparse-keymap) | 498 | (let ((menumap (funcall (symbol-function 'make-sparse-keymap) |
| 593 | "Follow")) | 499 | "Follow")) |
| @@ -680,7 +586,7 @@ Used by `follow-window-size-change'.") | |||
| 680 | 586 | ||
| 681 | ;; Why not just `(set-buffer-menubar current-menubar)'? The | 587 | ;; Why not just `(set-buffer-menubar current-menubar)'? The |
| 682 | ;; question is a very good question. The reason is that under | 588 | ;; question is a very good question. The reason is that under |
| 683 | ;; Emacs 19, neither `set-buffer-menubar' nor | 589 | ;; Emacs, neither `set-buffer-menubar' nor |
| 684 | ;; `current-menubar' is defined, hence the byte-compiler will | 590 | ;; `current-menubar' is defined, hence the byte-compiler will |
| 685 | ;; warn. | 591 | ;; warn. |
| 686 | (funcall (symbol-function 'set-buffer-menubar) | 592 | (funcall (symbol-function 'set-buffer-menubar) |
| @@ -728,7 +634,7 @@ Used by `follow-window-size-change'.") | |||
| 728 | 634 | ||
| 729 | ;;;###autoload | 635 | ;;;###autoload |
| 730 | (defun follow-mode (arg) | 636 | (defun follow-mode (arg) |
| 731 | "Minor mode which combines windows into one tall virtual window. | 637 | "Minor mode that combines windows into one tall virtual window. |
| 732 | 638 | ||
| 733 | The feeling of a \"virtual window\" has been accomplished by the use | 639 | The feeling of a \"virtual window\" has been accomplished by the use |
| 734 | of two major techniques: | 640 | of two major techniques: |
| @@ -860,7 +766,9 @@ Works like `scroll-up' when not in Follow Mode." | |||
| 860 | (if (eq end (point-max)) | 766 | (if (eq end (point-max)) |
| 861 | (signal 'end-of-buffer nil) | 767 | (signal 'end-of-buffer nil) |
| 862 | (select-window (car windows)) | 768 | (select-window (car windows)) |
| 863 | (goto-char end) | 769 | ;; `window-end' might return nil. |
| 770 | (if end | ||
| 771 | (goto-char end)) | ||
| 864 | (vertical-motion (- next-screen-context-lines)) | 772 | (vertical-motion (- next-screen-context-lines)) |
| 865 | (set-window-start (car windows) (point))))))) | 773 | (set-window-start (car windows) (point))))))) |
| 866 | 774 | ||
| @@ -1121,7 +1029,7 @@ from the selected window." | |||
| 1121 | (cons pred (cdr windows)))) | 1029 | (cons pred (cdr windows)))) |
| 1122 | 1030 | ||
| 1123 | 1031 | ||
| 1124 | ;; Try to optimize this function for speed! | 1032 | ;; This function is optimized function for speed! |
| 1125 | 1033 | ||
| 1126 | (defun follow-calc-win-end (&optional win) | 1034 | (defun follow-calc-win-end (&optional win) |
| 1127 | "Calculate the presumed window end for WIN. | 1035 | "Calculate the presumed window end for WIN. |
| @@ -1140,10 +1048,10 @@ Returns (end-pos end-of-buffer-p)" | |||
| 1140 | (window-buffer win))) | 1048 | (window-buffer win))) |
| 1141 | (list end t) | 1049 | (list end t) |
| 1142 | (list (+ end 1) nil))) | 1050 | (list (+ end 1) nil))) |
| 1143 | ;; Emacs 19: We have to calculate the end by ourselves. | 1051 | ;; Emacs: We have to calculate the end by ourselves. |
| 1144 | ;; This code works on both XEmacs and Emacs 19, but now | 1052 | ;; This code works on both XEmacs and Emacs, but now |
| 1145 | ;; that XEmacs has got custom-written code, this could | 1053 | ;; that XEmacs has got custom-written code, this could |
| 1146 | ;; be optimized for Emacs 19. | 1054 | ;; be optimized for Emacs. |
| 1147 | (let ((orig-win (and win (selected-window))) | 1055 | (let ((orig-win (and win (selected-window))) |
| 1148 | height | 1056 | height |
| 1149 | buffer-end-p) | 1057 | buffer-end-p) |
| @@ -1310,7 +1218,7 @@ Note that this handles the case when the cache has been set to nil." | |||
| 1310 | Return the selected window." | 1218 | Return the selected window." |
| 1311 | (let ((win nil)) | 1219 | (let ((win nil)) |
| 1312 | (while (and (not win) win-start-end) | 1220 | (while (and (not win) win-start-end) |
| 1313 | ;; Don't select a window which was just moved. This makes it | 1221 | ;; Don't select a window that was just moved. This makes it |
| 1314 | ;; possible to later select the last window after a `end-of-buffer' | 1222 | ;; possible to later select the last window after a `end-of-buffer' |
| 1315 | ;; command. | 1223 | ;; command. |
| 1316 | (if (follow-pos-visible dest (car (car win-start-end)) win-start-end) | 1224 | (if (follow-pos-visible dest (car (car win-start-end)) win-start-end) |
| @@ -1325,7 +1233,7 @@ Return the selected window." | |||
| 1325 | ;; it wasn't just moved here. (i.e. M-> shall not unconditionally place | 1233 | ;; it wasn't just moved here. (i.e. M-> shall not unconditionally place |
| 1326 | ;; the point in the selected window.) | 1234 | ;; the point in the selected window.) |
| 1327 | ;; | 1235 | ;; |
| 1328 | ;; (Compability cludge: in Emacs 19 `window-end' is equal to `point-max'; | 1236 | ;; (Compability cludge: in Emacs `window-end' is equal to `point-max'; |
| 1329 | ;; in XEmacs, it is equal to `point-max + 1'. Should I really bother | 1237 | ;; in XEmacs, it is equal to `point-max + 1'. Should I really bother |
| 1330 | ;; checking `window-end' now when I check `end-of-buffer' explicitly?) | 1238 | ;; checking `window-end' now when I check `end-of-buffer' explicitly?) |
| 1331 | 1239 | ||
| @@ -1333,13 +1241,15 @@ Return the selected window." | |||
| 1333 | "Select and return a window, if end is visible in it." | 1241 | "Select and return a window, if end is visible in it." |
| 1334 | (let ((win nil)) | 1242 | (let ((win nil)) |
| 1335 | (while (and (not win) win-start-end) | 1243 | (while (and (not win) win-start-end) |
| 1336 | ;; Don't select a window which was just moved. This makes it | 1244 | ;; Don't select a window that was just moved. This makes it |
| 1337 | ;; possible to later select the last window after a `end-of-buffer' | 1245 | ;; possible to later select the last window after a `end-of-buffer' |
| 1338 | ;; command. | 1246 | ;; command. |
| 1339 | (if (and (eq (point-max) (nth 2 (car win-start-end))) | 1247 | (if (and (eq (point-max) (nth 2 (car win-start-end))) |
| 1340 | (nth 3 (car win-start-end)) | 1248 | (nth 3 (car win-start-end)) |
| 1341 | (eq (point-max) (min (point-max) | 1249 | ;; `window-end' might return nil. |
| 1342 | (window-end (car (car win-start-end)))))) | 1250 | (let ((end (window-end (car (car win-start-end))))) |
| 1251 | (and end | ||
| 1252 | (eq (point-max) (min (point-max) end))))) | ||
| 1343 | (progn | 1253 | (progn |
| 1344 | (setq win (car (car win-start-end))) | 1254 | (setq win (car (car win-start-end))) |
| 1345 | (select-window win))) | 1255 | (select-window win))) |
| @@ -1347,7 +1257,7 @@ Return the selected window." | |||
| 1347 | win)) | 1257 | win)) |
| 1348 | 1258 | ||
| 1349 | 1259 | ||
| 1350 | ;; Select a window which will display the point if the windows would | 1260 | ;; Select a window that will display the point if the windows would |
| 1351 | ;; be redisplayed with the first window fixed. This is useful for | 1261 | ;; be redisplayed with the first window fixed. This is useful for |
| 1352 | ;; example when the user has pressed return at the bottom of a window | 1262 | ;; example when the user has pressed return at the bottom of a window |
| 1353 | ;; as the point is not visible in any window. | 1263 | ;; as the point is not visible in any window. |
| @@ -1725,7 +1635,7 @@ non-first windows in Follow Mode." | |||
| 1725 | (setq visible t) | 1635 | (setq visible t) |
| 1726 | (setq aligned nil)) | 1636 | (setq aligned nil)) |
| 1727 | ;; If we can position the cursor without moving the first | 1637 | ;; If we can position the cursor without moving the first |
| 1728 | ;; window, do it. This is the case which catches `RET' | 1638 | ;; window, do it. This is the case that catches `RET' |
| 1729 | ;; at the bottom of a window. | 1639 | ;; at the bottom of a window. |
| 1730 | ((follow-select-if-visible-from-first dest windows) | 1640 | ((follow-select-if-visible-from-first dest windows) |
| 1731 | (follow-debug-message "Below first") | 1641 | (follow-debug-message "Below first") |
| @@ -1846,7 +1756,7 @@ non-first windows in Follow Mode." | |||
| 1846 | 1756 | ||
| 1847 | (cond ((fboundp 'scroll-bar-drag) | 1757 | (cond ((fboundp 'scroll-bar-drag) |
| 1848 | ;;; | 1758 | ;;; |
| 1849 | ;;; Emacs 19 style scrollbars. | 1759 | ;;; Emacs style scrollbars. |
| 1850 | ;;; | 1760 | ;;; |
| 1851 | 1761 | ||
| 1852 | ;; Select the dragged window if it is a follower of the | 1762 | ;; Select the dragged window if it is a follower of the |
| @@ -1948,12 +1858,12 @@ WINDOW can be an object or a window." | |||
| 1948 | ;;}}} | 1858 | ;;}}} |
| 1949 | ;;{{{ Process output | 1859 | ;;{{{ Process output |
| 1950 | 1860 | ||
| 1951 | ;;; The following sections installs a spy which listens to process | 1861 | ;;; The following sections installs a spy that listens to process |
| 1952 | ;;; output and tries to reposition the windows whose buffers are in | 1862 | ;;; output and tries to reposition the windows whose buffers are in |
| 1953 | ;;; Follow mode. We play safe as much as possible... | 1863 | ;;; Follow mode. We play safe as much as possible... |
| 1954 | ;;; | 1864 | ;;; |
| 1955 | ;;; When follow-mode is activated all active processes are | 1865 | ;;; When follow-mode is activated all active processes are |
| 1956 | ;;; intercepted. All new processes which change their filter function | 1866 | ;;; intercepted. All new processes that change their filter function |
| 1957 | ;;; using `set-process-filter' are also intercepted. The reason is | 1867 | ;;; using `set-process-filter' are also intercepted. The reason is |
| 1958 | ;;; that a process can cause a redisplay recentering "tail" windows. | 1868 | ;;; that a process can cause a redisplay recentering "tail" windows. |
| 1959 | ;;; Note that it doesn't hurt to spy on more processes than needed. | 1869 | ;;; Note that it doesn't hurt to spy on more processes than needed. |
| @@ -1965,7 +1875,7 @@ WINDOW can be an object or a window." | |||
| 1965 | ;;; output filter. It also makes sure that the windows connected to | 1875 | ;;; output filter. It also makes sure that the windows connected to |
| 1966 | ;;; the buffer are aligned. | 1876 | ;;; the buffer are aligned. |
| 1967 | ;;; | 1877 | ;;; |
| 1968 | ;;; Discussion: How do we find processes which don't call | 1878 | ;;; Discussion: How do we find processes that don't call |
| 1969 | ;;; `set-process-filter'? (How often are processes created in a | 1879 | ;;; `set-process-filter'? (How often are processes created in a |
| 1970 | ;;; buffer after Follow mode are activated?) | 1880 | ;;; buffer after Follow mode are activated?) |
| 1971 | ;;; | 1881 | ;;; |
| @@ -2047,7 +1957,7 @@ magic stuff before the real process filter is called." | |||
| 2047 | ;;{{{ Start/stop interception of processes. | 1957 | ;;{{{ Start/stop interception of processes. |
| 2048 | 1958 | ||
| 2049 | ;; Normally, all new processed are intercepted by our `set-process-filter'. | 1959 | ;; Normally, all new processed are intercepted by our `set-process-filter'. |
| 2050 | ;; This is needed to intercept old processed which were started before we were | 1960 | ;; This is needed to intercept old processed that were started before we were |
| 2051 | ;; loaded, and processes we have forgotten by calling | 1961 | ;; loaded, and processes we have forgotten by calling |
| 2052 | ;; `follow-stop-intercept-process-output'. | 1962 | ;; `follow-stop-intercept-process-output'. |
| 2053 | 1963 | ||
| @@ -2247,7 +2157,7 @@ report this using the `follow-submit-feedback' function." | |||
| 2247 | ;; called every time a window in a frame changes size. Most notably, it | 2157 | ;; called every time a window in a frame changes size. Most notably, it |
| 2248 | ;; is called after the frame has been resized. | 2158 | ;; is called after the frame has been resized. |
| 2249 | ;; | 2159 | ;; |
| 2250 | ;; We basically call our post-command-hook for every buffer which is | 2160 | ;; We basically call our post-command-hook for every buffer that is |
| 2251 | ;; visible in any window in the resized frame, which is in follow-mode. | 2161 | ;; visible in any window in the resized frame, which is in follow-mode. |
| 2252 | ;; | 2162 | ;; |
| 2253 | ;; Since this function can be called indirectly from | 2163 | ;; Since this function can be called indirectly from |
| @@ -2363,7 +2273,7 @@ report this using the `follow-submit-feedback' function." | |||
| 2363 | (add-hook 'window-scroll-functions 'follow-avoid-tail-recenter t)) | 2273 | (add-hook 'window-scroll-functions 'follow-avoid-tail-recenter t)) |
| 2364 | 2274 | ||
| 2365 | 2275 | ||
| 2366 | ;; This prevents all packages which calls `sit-for' directly | 2276 | ;; This prevents all packages that calls `sit-for' directly |
| 2367 | ;; to recenter tail windows. | 2277 | ;; to recenter tail windows. |
| 2368 | 2278 | ||
| 2369 | (if follow-avoid-tail-recenter-p | 2279 | (if follow-avoid-tail-recenter-p |