• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:end +defs:of +defs:output

11 ;; This file is part of GNU Emacs.
14 ;; it under the terms of the GNU General Public License as published by
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; You should have received a copy of the GNU General Public License
35 ;; The feeling of a "virtual window" has been accomplished by the use
36 ;; of two major techniques:
38 ;; * The windows always displays adjacent sections of the buffer.
42 ;; * Should the point (cursor) end up outside a window, another
48 ;; side-by-side window are used. The user can, with the help of Follow
50 ;; one. Imagine yourself editing a large function, or section of text,
51 ;; and being able to use 144 lines instead of the normal 72... (your
79 ;; immediately below the end of the left-hand window. As long as
83 ;; Jump to the beginning or end. Press `Cursor down' at the last
84 ;; line of the left-hand window. Enter new lines into the
94 ;; visible area of the current buffer.
104 ;; There exists two system variables that controls the appearence of
116 ;; Since the display of XEmacs is pixel-oriented, a line could be
117 ;; clipped in half at the bottom of the window.
150 ;; The following is a list of commands useful when follow-mode is active.
159 ;; Maximise the visible area of the current buffer,
165 ;; Place the point in the center of the middle window,
166 ;; or a specified number of lines from either top or bottom.
209 ;; kernel of the display routines, making sure that the windows (using
216 ;; 2) After a process output has been perfomed.
222 ;; Note that only the selected window is checked, for the reason of
253 ;; of course, lead to some occasional unintended evaluation...
296 ;; (Control-C dot <key>). (As of Emacs 19.29 the keys
301 ;; above for an example of how to bind the keys the way you like.
310 The value of this variable is checked as part of loading Follow mode.
332 ;; Replace the standard `end-of-buffer', when in Follow Mode. (I
334 ;; could be enhanced in Follow mode. End-of-buffer is a special
336 ;; the look and feel of Follow mode.)
337 (define-key mainmap [remap end-of-buffer] 'follow-end-of-buffer)
408 ;; Didn't find the last item, Adding to the top of
460 Defaults to \" Follow\". Examples of other values
471 "When non-nil, Follow Mode will monitor process output."
478 A \"tail window\" is a window that displays only the end of
481 Follow Mode it breaks the display when the end is displayed
491 XEmacs, as of 19.12, does not recenter windows, good!")
495 "List of commands that don't require recalculation.
498 contents of the buffer, nor should it change selected window or current
528 (defvar follow-windows-start-end-cache nil
529 "Cache used by `follow-window-start-end'.")
571 The feeling of a \"virtual window\" has been accomplished by the use
572 of two major techniques:
574 * The windows always displays adjacent sections of the buffer.
578 * Should the point (cursor) end up outside a window, another
584 side-by-side window are used. The user can, with the help of Follow
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
597 will listen to the output of processes and redisplay accordingly.
607 (follow-intercept-process-output))
646 ;; the top or bottom... In our case however, we end up outside the
661 If called with no ARG, the `next-screen-context-lines' last lines of
676 (end (window-end (car (reverse windows)))))
677 (if (eq end (point-max))
678 (signal 'end-of-buffer nil)
680 ;; `window-end' might return nil.
681 (if end
682 (goto-char end))
690 If called with no ARG, the `next-screen-context-lines' top lines of
707 (signal 'beginning-of-buffer nil)
725 Execute this command to display as much as possible of the text
878 ;;{{{ End of buffer
880 (defun follow-end-of-buffer (&optional arg)
881 "Move point to the end of the buffer, Follow Mode style.
883 If the end is not visible, it will be displayed in the last possible
887 of the way from the true end."
893 ((follow-select-if-end-visible
894 (follow-windows-start-end followers)))
899 (end-of-buffer arg))))
946 (defun follow-calc-win-end (&optional win)
947 "Calculate the presumed window end for WIN.
949 Actually, the position returned is the start of the next
950 window, normally is the end plus one.
954 Returns (end-pos end-of-buffer-p)"
956 ;; XEmacs can calculate the end of the window by using
958 (let ((end (window-end win t)))
959 (if (= end (funcall (symbol-function 'point-max)
961 (list end t)
962 (list (+ end 1) nil)))
963 ;; Emacs: We have to calculate the end by ourselves.
969 buffer-end-p)
975 (setq buffer-end-p
980 ;; The start of the window is assumed to
981 ;; coinside with the start of a line.
984 (list (point) buffer-end-p))
998 (setq pos (car (inline (follow-calc-win-end (car windows)))))
1004 ;; The result from `follow-windows-start-end' is cached when using
1008 "Test if the cached value of `follow-windows-start-end' can be used.
1011 (cache follow-windows-start-end-cache))
1023 "Force `follow-windows-start-end' to recalculate the end of the window."
1024 (setq follow-windows-start-end-cache nil))
1027 ;; Build a list of windows and their start and end positions.
1028 ;; Useful to avoid calculating start/end position whenever they are needed.
1030 ;; ((Win Start End End-of-buffer-visible-p) ...)
1033 ;; redraws of the display. Check if I used it for anything.
1036 (defun follow-windows-start-end (windows)
1037 "Builds a list of (WIN START END BUFFER-END-P) for every window in WINDOWS."
1039 follow-windows-start-end-cache
1040 (let ((win-start-end '())
1044 (setq win-start-end
1047 (follow-calc-win-end)))
1048 win-start-end))
1051 (setq follow-windows-start-end-cache (nreverse win-start-end))
1052 follow-windows-start-end-cache)))
1055 (defsubst follow-pos-visible (pos win win-start-end)
1057 (let ((wstart-wend-bend (cdr (assq win win-start-end))))
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
1067 (defsubst follow-windows-aligned-p (win-start-end)
1071 (goto-char (window-start (car (car win-start-end))))
1074 (vertical-motion 0 (car (car win-start-end)))
1075 (setq res (eq (point) (window-start (car (car win-start-end)))))))
1076 (while (and res (cdr win-start-end))
1078 (setq res (eq (car (cdr (cdr (car win-start-end))))
1079 (car (cdr (car (cdr win-start-end))))))
1080 (setq win-start-end (cdr win-start-end)))
1087 (defun follow-point-visible-all-windows-p (win-start-end)
1090 (while (and res win-start-end)
1091 (setq res (follow-pos-visible (window-point (car (car win-start-end)))
1092 (car (car win-start-end))
1093 win-start-end))
1094 (setq win-start-end (cdr win-start-end)))
1098 ;; Make sure WIN always starts at the beginning of an whole screen
1100 ;; will lead to a redisplay of the screen later on.
1104 ;; (Without the update, the start of the window will move as the
1106 ;; will move the start of the window in the wrong direction.)
1109 "Make sure that the start of WIN starts at a full screen line."
1128 (defun follow-select-if-visible (dest win-start-end)
1132 (while (and (not win) win-start-end)
1134 ;; possible to later select the last window after a `end-of-buffer'
1136 (if (follow-pos-visible dest (car (car win-start-end)) win-start-end)
1138 (setq win (car (car win-start-end)))
1140 (setq win-start-end (cdr win-start-end)))
1144 ;; Lets select a window showing the end. Make sure we only select it if it
1148 ;; (Compability cludge: in Emacs `window-end' is equal to `point-max';
1150 ;; checking `window-end' now when I check `end-of-buffer' explicitly?)
1152 (defun follow-select-if-end-visible (win-start-end)
1153 "Select and return a window, if end is visible in it."
1155 (while (and (not win) win-start-end)
1157 ;; possible to later select the last window after a `end-of-buffer'
1159 (if (and (eq (point-max) (nth 2 (car win-start-end)))
1160 (nth 3 (car win-start-end))
1161 ;; `window-end' might return nil.
1162 (let ((end (window-end (car (car win-start-end)))))
1163 (and end
1164 (eq (point-max) (min (point-max) end)))))
1166 (setq win (car (car win-start-end)))
1168 (setq win-start-end (cdr win-start-end)))
1174 ;; example when the user has pressed return at the bottom of a window
1180 end-pos-end-p)
1183 ;; Make sure the line start in the beginning of a real screen
1193 (setq end-pos-end-p (follow-calc-win-end (car windows)))
1194 (goto-char (car end-pos-end-p))
1195 ;; Visible, if dest above end, or if eob is visible inside
1197 (if (or (car (cdr end-pos-end-p))
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.
1228 ;; Redisplay a chain of windows. Start every window directly after the
1229 ;; end of the previous window, to make sure long lines are displayed
1236 (setq pos (car (follow-calc-win-end (car windows))))
1247 ;; (setq pos (car (follow-calc-win-end (car windows))))
1251 ;; Return the start of the first window.
1260 ;; The worst case peformace of probably very bad, but it is very
1265 "Calculate the start of the first window.
1267 WINDOWS is a chain of windows to work with. WIN is the window
1292 ;; `exact' is disabled due to XEmacs and fonts of variable
1295 "Estimate the position of the first window.
1298 position of the first window. Otherwise it is a good guess."
1383 ;; window-start position is equal to (point-max) of the buffer it
1397 "Make sure windows displaying the end of a buffer aren't recentered.
1399 This is done by reading and rewriting the start position of
1405 (who '()) ; list of (buffer . frame)
1435 ;; This is not as complicated as it seems. It is simply a list of common
1439 ;; We divide the check into two parts; whether we are at the end or not.
1440 ;; This is due to the fact that the end can actaually be visible
1465 ;; mode, lets find the current state of the display and
1469 (win-start-end (inline
1471 (follow-windows-start-end windows)))
1472 (aligned (follow-windows-aligned-p win-start-end))
1473 (visible (follow-pos-visible dest win win-start-end)))
1481 ;; We're at the end, we have to be careful since
1493 ;; end of the file, character are removed
1504 ;; If the end is visible, and the window
1507 ((follow-select-if-end-visible win-start-end)
1508 (follow-debug-message "Max: end visible")
1512 ;; Just show the end...
1520 ;; We're not at the end, here life is much simpler.
1530 ;; at the beginning of the window.
1531 ((follow-select-if-visible dest win-start-end)
1545 (setq win-start-end (follow-windows-start-end windows))
1551 ;; at the bottom of a window.
1558 ;; None of the above. For simplicity, we stick to the
1574 (follow-pos-visible dest win win-start-end))
1578 (setq win-start-end (follow-windows-start-end windows))
1584 (follow-windows-aligned-p win-start-end)))
1586 win-start-end))))
1590 (setq win-start-end (follow-windows-start-end windows))
1593 ;; happends when dest is in the beginning of the
1597 ;; difference between the width of the windows.
1601 (if (follow-pos-visible dest win win-start-end)
1603 (follow-select-if-visible dest win-start-end)
1612 (selected-window) windows win-start-end))
1617 ;; (follow-windows-start-end windows)))
1634 ;; Not perfect, as the point can't be placed at window end, only at
1635 ;; end-1. This will highlight a little bit in windows above
1638 (defun follow-maximize-region (win windows win-start-end)
1645 (setq data (assq (car pred) win-start-end))
1649 (set-window-point (car succ) (nth 1 (assq (car succ) win-start-end)))
1658 ;; all its follower stick to it blindly. If one of them is scrolled,
1660 ;; released. If the selected window is not a follower of the dragged
1674 ;; Select the dragged window if it is a follower of the
1677 ;; Generate advices of the form:
1771 ;;{{{ Process output
1774 ;; output and tries to reposition the windows whose buffers are in
1786 ;; output into the buffer, if the buffer originally didn't have an
1787 ;; output filter. It also makes sure that the windows connected to
1799 ;; Do not call this with 'follow-generic-filter as the name of the
1803 "Ensure process output will be displayed correctly in Follow Mode buffers.
1869 ;;{{{ Start/stop interception of processes.
1874 ;; `follow-stop-intercept-process-output'.
1876 (defun follow-intercept-process-output ()
1892 (defun follow-stop-intercept-process-output ()
1922 ;; process output to work with Follow mode. Whenever the start of the
1925 ;; the normal redisplay functions of Emacs will scroll it right
1928 (defun follow-generic-filter (proc output)
1929 "Process output filter for process connected to buffers in Follow mode."
1945 ;; Output the `output'.
1950 (funcall filter proc output))
1952 ;; No filter, but we've got a buffer. Just output into it.
1964 (insert-before-markers output)
1978 (win-start-end (follow-windows-start-end windows))
1982 ;; The start of the selected window was repositioned.
1985 ;; chain. This will create the effect that the output
1994 ;; tries to reposition the start of the window in order
1995 ;; to view the tail of the output.
2000 (setq win-start-end (follow-windows-start-end windows))
2002 win-start-end)
2006 (setq win-start-end (follow-windows-start-end windows)))
2018 (setq win-start-end
2019 (follow-windows-start-end windows)))
2020 ;; None of the above. We stick to the current window.
2028 (point) (selected-window) win-start-end))
2032 (setq win-start-end
2033 (follow-windows-start-end windows))))
2036 (not (follow-windows-aligned-p win-start-end)))
2051 ;; windows showing only the end of a buffer is unconditionally
2133 ;; configuration is restored, with the exception of the beginning of
2134 ;; the start of the window for the selected window. This is not much
2139 ;; of text is visible.
2194 Avoid to recenter windows displaying only the end of a file as when
2206 Don't recenter windows showing only the end of a buffer.
2220 '(window-end
2232 follow-calc-win-end
2235 follow-windows-start-end
2248 ;;{{{ The end
2262 ;; | is ten seconds. Time is valuable and ten seconds' worth of it is well |
2263 ;; | worth the investment of a day's happy activity working out a way to |