aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Levitt2011-12-31 10:25:48 +0200
committerEli Zaretskii2011-12-31 10:25:48 +0200
commit7c2b8880efc4c11f6c56b2bf13854d0e1bdd2d8d (patch)
treefee2c9b26fa24d575b14c909f11904b81871ceea
parent3778cdd8efa2a0a5ea06d00277499fd6e7300cd2 (diff)
downloademacs-7c2b8880efc4c11f6c56b2bf13854d0e1bdd2d8d.tar.gz
emacs-7c2b8880efc4c11f6c56b2bf13854d0e1bdd2d8d.zip
Fix bug #9246 with scrolling in ERC under word-wrap.
lisp/erc/erc-goodies.el (erc-scroll-to-bottom): Use post-command-hook rather than window-scroll-functions. Fixes a bug with scrolling under word-wrap on a tty.
-rw-r--r--lisp/erc/ChangeLog6
-rw-r--r--lisp/erc/erc-goodies.el32
2 files changed, 19 insertions, 19 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 1b67835cb07..354e8636702 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,9 @@
12011-12-31 Antoine Levitt <antoine.levitt@gmail.com>
2
3 * erc-goodies.el (erc-scroll-to-bottom): Use post-command-hook
4 rather than window-scroll-functions. Fixes a bug with word-wrap on
5 a tty. (Bug#9246)
6
12011-11-28 Mike Kazantsev <mk.fraggod@gmail.com> (tiny change) 72011-11-28 Mike Kazantsev <mk.fraggod@gmail.com> (tiny change)
2 8
3 * erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Updated regexp to 9 * erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Updated regexp to
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index b2cf9e35622..6f24c59f4bd 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -60,7 +60,7 @@ argument to `recenter'."
60 ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) 60 ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
61 (dolist (buffer (erc-buffer-list)) 61 (dolist (buffer (erc-buffer-list))
62 (with-current-buffer buffer 62 (with-current-buffer buffer
63 (remove-hook 'window-scroll-functions 'erc-scroll-to-bottom t))))) 63 (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
64 64
65(defun erc-add-scroll-to-bottom () 65(defun erc-add-scroll-to-bottom ()
66 "A hook function for `erc-mode-hook' to recenter output at bottom of window. 66 "A hook function for `erc-mode-hook' to recenter output at bottom of window.
@@ -70,35 +70,29 @@ the value of `erc-input-line-position'.
70 70
71This works whenever scrolling happens, so it's added to 71This works whenever scrolling happens, so it's added to
72`window-scroll-functions' rather than `erc-insert-post-hook'." 72`window-scroll-functions' rather than `erc-insert-post-hook'."
73 ;;(make-local-hook 'window-scroll-functions) 73 (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
74 (add-hook 'window-scroll-functions 'erc-scroll-to-bottom nil t))
75 74
76(defun erc-scroll-to-bottom (window display-start) 75(defun erc-scroll-to-bottom ()
77 "Recenter WINDOW so that `point' is on the last line. 76 "Recenter WINDOW so that `point' is on the last line.
78 77
79This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'. 78This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'.
80 79
81You can control which line is recentered to by customizing the 80You can control which line is recentered to by customizing the
82variable `erc-input-line-position'. 81variable `erc-input-line-position'."
83
84DISPLAY-START is ignored."
85 (if (window-live-p window)
86 ;; Temporarily bind resize-mini-windows to nil so that users who have it 82 ;; Temporarily bind resize-mini-windows to nil so that users who have it
87 ;; set to a non-nil value will not suffer from premature minibuffer 83 ;; set to a non-nil value will not suffer from premature minibuffer
88 ;; shrinkage due to the below recenter call. I have no idea why this 84 ;; shrinkage due to the below recenter call. I have no idea why this
89 ;; works, but it solves the problem, and has no negative side effects. 85 ;; works, but it solves the problem, and has no negative side effects.
90 ;; (Fran Litterio, 2003/01/07) 86 ;; (Fran Litterio, 2003/01/07)
91 (let ((resize-mini-windows nil)) 87 (let ((resize-mini-windows nil))
92 (erc-with-selected-window window 88 (save-restriction
93 (save-restriction 89 (widen)
94 (widen) 90 (when (and erc-insert-marker
95 (when (and erc-insert-marker 91 ;; we're editing a line. Scroll.
96 ;; we're editing a line. Scroll. 92 (> (point) erc-insert-marker))
97 (> (point) erc-insert-marker)) 93 (save-excursion
98 (save-excursion 94 (goto-char (point-max))
99 (goto-char (point-max)) 95 (recenter (or erc-input-line-position -1)))))))
100 (recenter (or erc-input-line-position -1))
101 (sit-for 0))))))))
102 96
103;;; Make read only 97;;; Make read only
104(define-erc-module readonly nil 98(define-erc-module readonly nil