Mercurial > emacs
comparison lisp/follow.el @ 78162:a09176483fa1
(follow-mode-hook, follow-mode-off-hook, follow-mode,
follow-delete-other-windows-and-split, follow-recenter,
follow-windows-aligned-p, follow-point-visible-all-windows-p, follow-redisplay,
follow-estimate-first-window-start, follow-xemacs-scrollbar-support,
follow-intercept-process-output): Fix typos in docstrings.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 18 Jul 2007 12:40:30 +0000 |
parents | e3694f1cb928 |
children | 9355f9b7bbff |
comparison
equal
deleted
inserted
replaced
78161:5929028583e4 | 78162:a09176483fa1 |
---|---|
276 :prefix "follow-" | 276 :prefix "follow-" |
277 :group 'windows | 277 :group 'windows |
278 :group 'convenience) | 278 :group 'convenience) |
279 | 279 |
280 (defcustom follow-mode-hook nil | 280 (defcustom follow-mode-hook nil |
281 "Hooks to run when follow-mode is turned on." | 281 "Hooks to run when Follow mode is turned on." |
282 :type 'hook | 282 :type 'hook |
283 :group 'follow) | 283 :group 'follow) |
284 | 284 |
285 (defcustom follow-mode-off-hook nil | 285 (defcustom follow-mode-off-hook nil |
286 "Hooks to run when follow-mode is turned off." | 286 "Hooks to run when Follow mode is turned off." |
287 :type 'hook | 287 :type 'hook |
288 :group 'follow) | 288 :group 'follow) |
289 | 289 |
290 | 290 |
291 ;;{{{ Keymap/Menu | 291 ;;{{{ Keymap/Menu |
579 window displaying that point is selected, if possible. This | 579 window displaying that point is selected, if possible. This |
580 makes it possible to walk between windows using normal cursor | 580 makes it possible to walk between windows using normal cursor |
581 movement commands. | 581 movement commands. |
582 | 582 |
583 Follow mode comes to its prime when used on a large screen and two | 583 Follow mode comes to its prime when used on a large screen and two |
584 side-by-side window are used. The user can, with the help of Follow | 584 side-by-side windows are used. The user can, with the help of Follow |
585 mode, use two full-height windows as though they would have been | 585 mode, use two full-height windows as though they would have been |
586 one. Imagine yourself editing a large function, or section of text, | 586 one. Imagine yourself editing a large function, or section of text, |
587 and being able to use 144 lines instead of the normal 72... (your | 587 and being able to use 144 lines instead of the normal 72... (your |
588 mileage may vary). | 588 mileage may vary). |
589 | 589 |
590 To split one large window into two side-by-side windows, the commands | 590 To split one large window into two side-by-side windows, the commands |
591 `\\[split-window-horizontally]' or \ | 591 `\\[split-window-horizontally]' or \ |
592 `M-x follow-delete-other-windows-and-split' can be used. | 592 `M-x follow-delete-other-windows-and-split' can be used. |
593 | 593 |
594 Only windows displayed in the same frame follow each-other. | 594 Only windows displayed in the same frame follow each other. |
595 | 595 |
596 If the variable `follow-intercept-processes' is non-nil, Follow mode | 596 If the variable `follow-intercept-processes' is non-nil, Follow mode |
597 will listen to the output of processes and redisplay accordingly. | 597 will listen to the output of processes and redisplay accordingly. |
598 \(This is the default.) | 598 \(This is the default.) |
599 | 599 |
723 "Create two side by side windows and enter Follow Mode. | 723 "Create two side by side windows and enter Follow Mode. |
724 | 724 |
725 Execute this command to display as much as possible of the text | 725 Execute this command to display as much as possible of the text |
726 in the selected window. All other windows, in the current | 726 in the selected window. All other windows, in the current |
727 frame, are deleted and the selected window is split in two | 727 frame, are deleted and the selected window is split in two |
728 side-by-side windows. Follow Mode is activated, hence the | 728 side-by-side windows. Follow Mode is activated, hence the |
729 two windows always will display two successive pages. | 729 two windows always will display two successive pages. |
730 \(If one window is moved, the other one will follow.) | 730 \(If one window is moved, the other one will follow.) |
731 | 731 |
732 If ARG is positive, the leftmost window is selected. If it negative, | 732 If ARG is positive, the leftmost window is selected. If negative, |
733 the rightmost is selected. If ARG is nil, the leftmost window is | 733 the rightmost is selected. If ARG is nil, the leftmost window is |
734 selected if the original window is the first one in the frame. | 734 selected if the original window is the first one in the frame. |
735 | 735 |
736 To bind this command to a hotkey, place the following line | 736 To bind this command to a hotkey, place the following line |
737 in your `~/.emacs' file, replacing [f7] by your favourite key: | 737 in your `~/.emacs' file, replacing [f7] by your favourite key: |
832 (defun follow-recenter (&optional arg) | 832 (defun follow-recenter (&optional arg) |
833 "Recenter the middle window around point. | 833 "Recenter the middle window around point. |
834 Rearrange all other windows around the middle window. | 834 Rearrange all other windows around the middle window. |
835 | 835 |
836 With a positive argument, place the current line ARG lines | 836 With a positive argument, place the current line ARG lines |
837 from the top. With a negative, place it -ARG lines from the | 837 from the top. With a negative argument, place it -ARG lines |
838 bottom." | 838 from the bottom." |
839 (interactive "P") | 839 (interactive "P") |
840 (if arg | 840 (if arg |
841 (let ((p (point)) | 841 (let ((p (point)) |
842 (arg (prefix-numeric-value arg))) | 842 (arg (prefix-numeric-value arg))) |
843 (if (>= arg 0) | 843 (if (>= arg 0) |
1063 ;; By `aligned' we mean that for all adjecent windows, the end of the | 1063 ;; By `aligned' we mean that for all adjecent windows, the end of the |
1064 ;; first is equal with the start of the successor. The first window | 1064 ;; first is equal with the start of the successor. The first window |
1065 ;; should start at a full screen line. | 1065 ;; should start at a full screen line. |
1066 | 1066 |
1067 (defsubst follow-windows-aligned-p (win-start-end) | 1067 (defsubst follow-windows-aligned-p (win-start-end) |
1068 "Non-nil if the follower WINDOWS are aligned." | 1068 "Non-nil if the follower windows are aligned." |
1069 (let ((res t)) | 1069 (let ((res t)) |
1070 (save-excursion | 1070 (save-excursion |
1071 (goto-char (window-start (car (car win-start-end)))) | 1071 (goto-char (window-start (car (car win-start-end)))) |
1072 (if (bolp) | 1072 (if (bolp) |
1073 nil | 1073 nil |
1083 | 1083 |
1084 ;; Check if the point is visible in all windows. (So that | 1084 ;; Check if the point is visible in all windows. (So that |
1085 ;; no one will be recentered.) | 1085 ;; no one will be recentered.) |
1086 | 1086 |
1087 (defun follow-point-visible-all-windows-p (win-start-end) | 1087 (defun follow-point-visible-all-windows-p (win-start-end) |
1088 "Non-nil when the window-point is visible in all windows." | 1088 "Non-nil when the `window-point' is visible in all windows." |
1089 (let ((res t)) | 1089 (let ((res t)) |
1090 (while (and res win-start-end) | 1090 (while (and res win-start-end) |
1091 (setq res (follow-pos-visible (window-point (car (car win-start-end))) | 1091 (setq res (follow-pos-visible (window-point (car (car win-start-end))) |
1092 (car (car win-start-end)) | 1092 (car (car win-start-end)) |
1093 win-start-end)) | 1093 win-start-end)) |
1211 ;; is nil. | 1211 ;; is nil. |
1212 | 1212 |
1213 (defun follow-redisplay (&optional windows win) | 1213 (defun follow-redisplay (&optional windows win) |
1214 "Reposition the WINDOWS around WIN. | 1214 "Reposition the WINDOWS around WIN. |
1215 Should the point be too close to the roof we redisplay everything | 1215 Should the point be too close to the roof we redisplay everything |
1216 from the top. WINDOWS should contain a list of windows to | 1216 from the top. WINDOWS should contain a list of windows to |
1217 redisplay, it is assumed that WIN is a member of the list. | 1217 redisplay, it is assumed that WIN is a member of the list. |
1218 Should WINDOWS be nil, the windows displaying the | 1218 Should WINDOWS be nil, the windows displaying the |
1219 same buffer as WIN, in the current frame, are used. | 1219 same buffer as WIN, in the current frame, are used. |
1220 Should WIN be nil, the selected window is used." | 1220 Should WIN be nil, the selected window is used." |
1221 (or win | 1221 (or win |
1292 ;; `exact' is disabled due to XEmacs and fonts of variable | 1292 ;; `exact' is disabled due to XEmacs and fonts of variable |
1293 ;; height. | 1293 ;; height. |
1294 (defun follow-estimate-first-window-start (windows win start) | 1294 (defun follow-estimate-first-window-start (windows win start) |
1295 "Estimate the position of the first window. | 1295 "Estimate the position of the first window. |
1296 | 1296 |
1297 Returns (EXACT . POS). If EXACT is non-nil, POS is the starting | 1297 Returns (EXACT . POS). If EXACT is non-nil, POS is the starting |
1298 position of the first window. Otherwise it is a good guess." | 1298 position of the first window. Otherwise it is a good guess." |
1299 (let ((pred (car (follow-split-followers windows win))) | 1299 (let ((pred (car (follow-split-followers windows win))) |
1300 (exact nil)) | 1300 (exact nil)) |
1301 (save-excursion | 1301 (save-excursion |
1302 (goto-char start) | 1302 (goto-char start) |
1303 ;(setq exact (bolp)) | 1303 ;(setq exact (bolp)) |
1745 | 1745 |
1746 | 1746 |
1747 (defun follow-xemacs-scrollbar-support (window) | 1747 (defun follow-xemacs-scrollbar-support (window) |
1748 "Redraw windows showing the same buffer as shown in WINDOW. | 1748 "Redraw windows showing the same buffer as shown in WINDOW. |
1749 WINDOW is either the dragged window, or a cons containing the | 1749 WINDOW is either the dragged window, or a cons containing the |
1750 window as its first element. This is called while the user drags | 1750 window as its first element. This is called while the user drags |
1751 the scrollbar. | 1751 the scrollbar. |
1752 | 1752 |
1753 WINDOW can be an object or a window." | 1753 WINDOW can be an object or a window." |
1754 (condition-case nil | 1754 (condition-case nil |
1755 (progn | 1755 (progn |
1875 | 1875 |
1876 (defun follow-intercept-process-output () | 1876 (defun follow-intercept-process-output () |
1877 "Intercept all active processes. | 1877 "Intercept all active processes. |
1878 | 1878 |
1879 This is needed so that Follow Mode can track all display events in the | 1879 This is needed so that Follow Mode can track all display events in the |
1880 system. (See `follow-mode')" | 1880 system. (See `follow-mode'.)" |
1881 (interactive) | 1881 (interactive) |
1882 (let ((list (process-list))) | 1882 (let ((list (process-list))) |
1883 (while list | 1883 (while list |
1884 (if (eq (process-filter (car list)) 'follow-generic-filter) | 1884 (if (eq (process-filter (car list)) 'follow-generic-filter) |
1885 nil | 1885 nil |
2082 (add-hook 'window-size-change-functions 'follow-window-size-change)) | 2082 (add-hook 'window-size-change-functions 'follow-window-size-change)) |
2083 | 2083 |
2084 | 2084 |
2085 (defun follow-window-size-change (frame) | 2085 (defun follow-window-size-change (frame) |
2086 "Redraw all windows in FRAME, when in Follow mode." | 2086 "Redraw all windows in FRAME, when in Follow mode." |
2087 ;; Below, we call `post-command-hook'. This makes sure that we | 2087 ;; Below, we call `post-command-hook'. This makes sure that we |
2088 ;; doesn't start a mutally recursive endless loop. | 2088 ;; don't start a mutually recursive endless loop. |
2089 (if follow-inside-post-command-hook | 2089 (if follow-inside-post-command-hook |
2090 nil | 2090 nil |
2091 (let ((buffers '()) | 2091 (let ((buffers '()) |
2092 (orig-window (selected-window)) | 2092 (orig-window (selected-window)) |
2093 (orig-buffer (current-buffer)) | 2093 (orig-buffer (current-buffer)) |
2153 | 2153 |
2154 ;;}}} | 2154 ;;}}} |
2155 ;;{{{ Tail window handling | 2155 ;;{{{ Tail window handling |
2156 | 2156 |
2157 ;; In Emacs (not XEmacs) windows showing nothing are sometimes | 2157 ;; In Emacs (not XEmacs) windows showing nothing are sometimes |
2158 ;; recentered. When in Follow Mode, this is not desireable for | 2158 ;; recentered. When in Follow Mode, this is not desirable for |
2159 ;; non-first windows in the window chain. This section tries to | 2159 ;; non-first windows in the window chain. This section tries to |
2160 ;; make the windows stay where they should be. | 2160 ;; make the windows stay where they should be. |
2161 ;; | 2161 ;; |
2162 ;; If the display is updated, all windows starting at (point-max) are | 2162 ;; If the display is updated, all windows starting at (point-max) are |
2163 ;; going to be recentered at the next redisplay, unless we do a | 2163 ;; going to be recentered at the next redisplay, unless we do a |