From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.bugs Subject: bug#11697: 24.1.50; ERC scroll-to-bottom functionality 'broken' in emacs 24.1.x Date: Wed, 13 Jun 2012 22:03:00 +0200 Message-ID: <4FD8F1F4.6080809@dogan.se> References: <87ipevji6m.fsf@pringles.terranpro.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020202080606020004000400" X-Trace: dough.gmane.org 1339617867 28072 80.91.229.3 (13 Jun 2012 20:04:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Jun 2012 20:04:27 +0000 (UTC) Cc: 11697@debbugs.gnu.org To: Brian Fransioli Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 13 22:04:25 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Setni-0003Wn-Dj for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jun 2012 22:04:22 +0200 Original-Received: from localhost ([::1]:40876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Setni-0007bx-6z for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jun 2012 16:04:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Setnd-0007bi-VZ for bug-gnu-emacs@gnu.org; Wed, 13 Jun 2012 16:04:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SetnZ-0008JF-ID for bug-gnu-emacs@gnu.org; Wed, 13 Jun 2012 16:04:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SetnZ-0008JB-ES for bug-gnu-emacs@gnu.org; Wed, 13 Jun 2012 16:04:13 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SetqH-0002NO-Tw for bug-gnu-emacs@gnu.org; Wed, 13 Jun 2012 16:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Deniz Dogan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jun 2012 20:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11697 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11697-submit@debbugs.gnu.org id=B11697.13396179759080 (code B ref 11697); Wed, 13 Jun 2012 20:07:01 +0000 Original-Received: (at 11697) by debbugs.gnu.org; 13 Jun 2012 20:06:15 +0000 Original-Received: from localhost ([127.0.0.1]:41255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SetpW-0002MO-CK for submit@debbugs.gnu.org; Wed, 13 Jun 2012 16:06:15 -0400 Original-Received: from mxf5.bahnhof.se ([213.80.101.29]:61210) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SetpQ-0002MB-VA for 11697@debbugs.gnu.org; Wed, 13 Jun 2012 16:06:13 -0400 Original-Received: from localhost (mxf5.local [127.0.0.1]) by mxf5-reinject (Postfix) with ESMTP id 14116CF0E6; Wed, 13 Jun 2012 22:03:20 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) Original-Received: from mxf5.bahnhof.se ([127.0.0.1]) by localhost (mxf5.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7nsqMW8tP0yn; Wed, 13 Jun 2012 22:03:17 +0200 (CEST) Original-Received: from [192.168.1.4] (h-149-227.a336.priv.bahnhof.se [37.123.149.227]) by mxf5.bahnhof.se (Postfix) with ESMTP id A9E86CF0D8; Wed, 13 Jun 2012 22:03:16 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120604 Thunderbird/13.0 In-Reply-To: <87ipevji6m.fsf@pringles.terranpro.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60950 Archived-At: This is a multi-part message in MIME format. --------------020202080606020004000400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-06-13 18:22,, Brian Fransioli wrote: > > After updating to emacs 24.1.x I noticed ERC scroll functionality > changed. Originally, it would recenter to force the prompt to be near > the bottom of the screen (according to `erc-input-line-position'). Now, > this recentering only happens when I enter text, or perform a mouse > event. Channel joins/parts and new messages hit the bottom of the > screen, and recentering moves the bottom line to the center of the > buffer. > > The overall effect is input by the user moves the screen to the bottom, > while channel/server inputs bounce around from middle to bottom and back > again. > > Looking in erc-goodies.el at `erc-add-scroll-bottom', it's easy to see > the documentation is also out of date. It states it uses > `window-scroll-functions' but instead adds the hook to > `post-command-hook'. > > Examining commits, I found the culprit: > > commit: > a1d63e03c3eda51dcec158d6027adf9dbdcfd8dd > > view changes via git emacs web: > http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/erc/erc-goodies.el?id=a1d63e03c3eda51dcec158d6027adf9dbdcfd8dd > > > I see that the changes were reported to fix a bug on tty's, but the > results are severe motion sickness for even moderately chatty channels. > > Reproduce by: > (erc-scrolltobottom-mode) > (setq erc-input-line-position -2) > > Regards, > Brian > Firstly, I agree with you completely that scrolltobottom needs improvements. I can't be sure why they changed the behavior, since the new method is clearly inferior, but I believe it's because window-scroll-functions is never meant to change "the way the window is scrolled". I've monkey-patched ERC myself to handle the whole thing better. I've attached the Lisp. Just evaluate all the code and you'll be all set. (I know it's not production-quality code, but it does the job and relieves you from ever thinking about it again.) Deniz --------------020202080606020004000400 Content-Type: text/plain; charset=windows-1252; name="erc-better-scroll.el" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="erc-better-scroll.el" (defun erc-display-line-1 (string buffer) "Display STRING in `erc-mode' BUFFER. Auxiliary function used in `erc-display-line'. The line gets filtered to interpret the control characters. Then, `erc-insert-pre-hook' gets called. If `erc-insert-this' is still t, STRING gets inserted into the buffer. Afterwards, `erc-insert-modify' and `erc-insert-post-hook' get called. If STRING is nil, the function does nothing." (when string (with-current-buffer (or buffer (process-buffer erc-server-process)) (let ((insert-position (or (marker-position erc-insert-marker) (point-max)))) (let ((string string) ;; FIXME! Can this be removed? (buffer-undo-list t) (inhibit-read-only t)) (unless (string-match "\n$" string) (setq string (concat string "\n")) (when (erc-string-invisible-p string) (erc-put-text-properties 0 (length string) '(invisible intangible) string))) (erc-log (concat "erc-display-line: " string (format "(%S)" string) " in buffer " (format "%s" buffer))) (setq erc-insert-this t) (run-hook-with-args 'erc-insert-pre-hook string) (if (null erc-insert-this) ;; Leave erc-insert-this set to t as much as possible. Fran ;; Litterio has seen erc-insert-this set to nil while ;; erc-send-pre-hook is running, which should never happen. This ;; may cure it. (setq erc-insert-this t) (save-excursion ;; to restore point in the new buffer (save-restriction (widen) (goto-char insert-position) (insert-before-markers string) ;; run insertion hook, with point at restored location (save-restriction (narrow-to-region insert-position (point)) (run-hooks 'erc-insert-modify-hook) (run-hooks 'erc-insert-post-hook) (when erc-remove-parsed-property (remove-text-properties (point-min) (point-max) '(erc-parsed nil)))))))) (erc-update-undo-list (- (or (marker-position erc-insert-marker) (point-max)) insert-position))) (run-hooks 'erc-display-post-hook)))) ;;; this line and only this line was added (defvar erc-display-post-hook nil "New hook!") (defun damd-erc-display-post-hook () (let ((windows (get-buffer-window-list (current-buffer) nil 'visible))) (dolist (w windows) (when (>= (point) erc-input-marker) (with-selected-window w (recenter -1)))))) (add-hook 'erc-display-post-hook 'damd-erc-display-post-hook) (defun damd-erc-send-post-hook () (when (>= (point) erc-input-marker) (goto-char (point-max)) (widen) (recenter -1))) (add-hook 'erc-send-post-hook 'damd-erc-send-post-hook) (defun damd-window-configuration-change-hook () (when (and (eq major-mode 'erc-mode) (>= (point) erc-input-marker)) (recenter -1))) (add-hook 'window-configuration-change-hook 'damd-window-configuration-change-hook) --------------020202080606020004000400--