* lisp/follow.el: Rework, eliminating reliance on advice.
(set-process-filter, process-filter, sit-for): Advice deleted. (follow-mode-off-hook): Obsolete hook removed. (follow-avoid-tail-recenter-p, follow-process-filter-alist): Vars deleted. (follow-auto): Use a :set function. (follow-mode): Rewritten. Don't advise process filters. (follow-switch-to-current-buffer-all, follow-scroll-up) (follow-scroll-down): Assume follow-mode is bound. (follow-comint-scroll-to-bottom) (follow-align-compilation-windows): New functions. (follow--window-sorter): New function. (follow-all-followers): Use it to explicitly sort windows by their positions; don't make assumptions about next-window order. (follow-windows-start-end, follow-delete-other-windows-and-split) (follow-calc-win-start): Doc fix. (follow-windows-aligned-p, follow-select-if-visible): Don't call vertical-motion unnecessarily. (follow-adjust-window): New function. (follow-post-command-hook): Use it. (follow-call-set-process-filter, follow-call-process-filter) (follow-intercept-process-output, follow-tidy-process-filter-alist) (follow-stop-intercept-process-output, follow-generic-filter): Functions deleted. (follow-scroll-bar-toolkit-scroll, follow-scroll-bar-drag) (follow-scroll-bar-scroll-up, follow-scroll-bar-scroll-down): New functions, replacing advice on scroll-bar-* commands. * lisp/comint.el (comint-adjust-point): New function. (comint-postoutput-scroll-to-bottom): Use it. Call follow-comint-scroll-to-bottom for Follow mode buffers.
This commit is contained in:
parent
eb0ae1d143
commit
782fbf2a33
4 changed files with 469 additions and 1030 deletions
7
etc/NEWS
7
etc/NEWS
|
@ -100,6 +100,13 @@ these commands now).
|
|||
** erc will look up server/channel names via auth-source and use the
|
||||
channel keys found, if any.
|
||||
|
||||
** Follow mode
|
||||
|
||||
*** The obsolete variable `follow-mode-off-hook' has been removed.
|
||||
|
||||
*** Follow mode no longer works by using advice.
|
||||
The option `follow-intercept-processes' has been removed.
|
||||
|
||||
** The `server-auth-key' variable can be used to set a permanent
|
||||
shared key for Emacs Server.
|
||||
|
||||
|
|
|
@ -1,3 +1,37 @@
|
|||
2012-05-01 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* follow.el: Eliminate advice.
|
||||
(set-process-filter, process-filter, sit-for): Advice deleted.
|
||||
(follow-mode-off-hook): Obsolete hook removed.
|
||||
(follow-avoid-tail-recenter-p, follow-process-filter-alist): Vars
|
||||
deleted.
|
||||
(follow-auto): Use a :set function.
|
||||
(follow-mode): Rewritten. Don't advise process filters.
|
||||
(follow-switch-to-current-buffer-all, follow-scroll-up)
|
||||
(follow-scroll-down): Assume follow-mode is bound.
|
||||
(follow-comint-scroll-to-bottom)
|
||||
(follow-align-compilation-windows): New functions.
|
||||
(follow--window-sorter): New function.
|
||||
(follow-all-followers): Use it to explicitly sort windows by their
|
||||
positions; don't make assumptions about next-window order.
|
||||
(follow-windows-start-end, follow-delete-other-windows-and-split)
|
||||
(follow-calc-win-start): Doc fix.
|
||||
(follow-windows-aligned-p, follow-select-if-visible): Don't call
|
||||
vertical-motion unnecessarily.
|
||||
(follow-adjust-window): New function.
|
||||
(follow-post-command-hook): Use it.
|
||||
(follow-call-set-process-filter, follow-call-process-filter)
|
||||
(follow-intercept-process-output, follow-tidy-process-filter-alist)
|
||||
(follow-stop-intercept-process-output, follow-generic-filter):
|
||||
Functions deleted.
|
||||
(follow-scroll-bar-toolkit-scroll, follow-scroll-bar-drag)
|
||||
(follow-scroll-bar-scroll-up, follow-scroll-bar-scroll-down): New
|
||||
functions, replacing advice on scroll-bar-* commands.
|
||||
|
||||
* comint.el (comint-adjust-point): New function.
|
||||
(comint-postoutput-scroll-to-bottom): Use it. Call
|
||||
follow-comint-scroll-to-bottom for Follow mode buffers.
|
||||
|
||||
2012-05-01 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* term/AT386.el, term/apollo.el, term/bobcat.el, term/cygwin.el:
|
||||
|
|
|
@ -2101,43 +2101,51 @@ This function should be a pre-command hook."
|
|||
(select-window selected))))
|
||||
nil t))))))
|
||||
|
||||
(defvar follow-mode)
|
||||
(declare-function follow-comint-scroll-to-bottom "follow" ())
|
||||
|
||||
(defun comint-postoutput-scroll-to-bottom (_string)
|
||||
"Go to the end of buffer in some or all windows showing it.
|
||||
Does not scroll if the current line is the last line in the buffer.
|
||||
Do not scroll if the current line is the last line in the buffer.
|
||||
Depends on the value of `comint-move-point-for-output' and
|
||||
`comint-scroll-show-maximum-output'.
|
||||
|
||||
This function should be in the list `comint-output-filter-functions'."
|
||||
(let* ((selected (selected-window))
|
||||
(current (current-buffer))
|
||||
(process (get-buffer-process current))
|
||||
(scroll comint-move-point-for-output))
|
||||
(let* ((current (current-buffer))
|
||||
(process (get-buffer-process current)))
|
||||
(unwind-protect
|
||||
(if process
|
||||
(walk-windows
|
||||
(lambda (window)
|
||||
(when (eq (window-buffer window) current)
|
||||
(select-window window)
|
||||
(if (and (< (point) (process-mark process))
|
||||
(or (eq scroll t) (eq scroll 'all)
|
||||
;; Maybe user wants point to jump to end.
|
||||
(and (eq scroll 'this) (eq selected window))
|
||||
(and (eq scroll 'others) (not (eq selected window)))
|
||||
;; If point was at the end, keep it at end.
|
||||
(and (marker-position comint-last-output-start)
|
||||
(>= (point) comint-last-output-start))))
|
||||
(goto-char (process-mark process)))
|
||||
;; Optionally scroll so that the text
|
||||
;; ends at the bottom of the window.
|
||||
(if (and comint-scroll-show-maximum-output
|
||||
(= (point) (point-max)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(recenter (- -1 scroll-margin))))
|
||||
(select-window selected)))
|
||||
nil t))
|
||||
(cond
|
||||
((null process))
|
||||
((bound-and-true-p follow-mode)
|
||||
(follow-comint-scroll-to-bottom))
|
||||
(t
|
||||
(let ((selected (selected-window)))
|
||||
(dolist (w (get-buffer-window-list current nil t))
|
||||
(select-window w)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(comint-adjust-point selected)
|
||||
;; Optionally scroll to the bottom of the window.
|
||||
(and comint-scroll-show-maximum-output
|
||||
(eobp)
|
||||
(recenter (- -1 scroll-margin))))
|
||||
(select-window selected))))))
|
||||
(set-buffer current))))
|
||||
|
||||
(defun comint-adjust-point (selected)
|
||||
"Move point in the selected window based on Comint settings.
|
||||
SELECTED is the window that was originally selected."
|
||||
(let ((process (get-buffer-process (current-buffer))))
|
||||
(and (< (point) (process-mark process))
|
||||
(or (memq comint-move-point-for-output '(t all))
|
||||
;; Maybe user wants point to jump to end.
|
||||
(eq comint-move-point-for-output
|
||||
(if (eq (selected-window) selected) 'this 'others))
|
||||
;; If point was at the end, keep it at end.
|
||||
(and (marker-position comint-last-output-start)
|
||||
(>= (point) comint-last-output-start)))
|
||||
(goto-char (process-mark process)))))
|
||||
|
||||
(defun comint-truncate-buffer (&optional _string)
|
||||
"Truncate the buffer to `comint-buffer-maximum-size'.
|
||||
This function could be on `comint-output-filter-functions' or bound to a key."
|
||||
|
|
1394
lisp/follow.el
1394
lisp/follow.el
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue