[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 06fb8b76208 4/7: Exempt text-scale-mode from erc-scrolltobottom-a
From: |
F. Jason Park |
Subject: |
master 06fb8b76208 4/7: Exempt text-scale-mode from erc-scrolltobottom-all |
Date: |
Mon, 2 Oct 2023 20:38:27 -0400 (EDT) |
branch: master
commit 06fb8b76208ad380d7d1e592394d3173249f31df
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Exempt text-scale-mode from erc-scrolltobottom-all
* lisp/erc/erc-goodies.el (erc--scrolltobottom-post-ignore-commands):
New variable, a list of commands that should not trigger a re-scroll.
(erc--scrolltobottom-on-post-command): Don't `recenter' when the
current command appears in `erc--scrolltobottom-post-ignore-commands'.
This fixes a bug that prevented managed recentering when disabling
`text-scale-mode'. Thanks to Corwin Brust for reporting this. Note
that this doesn't address any fill-related alignment issues involving
`text-scale-mode'. Nor does it address likely problems involving the
erroneous restoration of point after the insertion of invisible lines.
(erc-keep-place-enable, erc-keep-place-mode): Adjust hook depth to
fall within reserved interval.
(erc-keep-place-indicator-enable, erc-keep-place-indicator-mode,
erc--keep-place-indicator-on-global-module): Lower hook depth to fall
within reserved interval. Note that this hook has a buffer-local
value, so all members run after their global counterparts.
(Bug#66073)
---
lisp/erc/erc-goodies.el | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 6eb015fdd64..b77176d8ac7 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -128,6 +128,11 @@ may be nil, is the number of lines between `window-start'
and
That is, ERC recalculates the window's start instead of blindly
restoring it.")
+;; Unfortunately, this doesn't work when `erc-scrolltobottom-relaxed'
+;; is enabled (scaling up still moves the prompt).
+(defvar erc--scrolltobottom-post-ignore-commands '(text-scale-adjust)
+ "Commands to skip instead of force-scroll on `post-command-hook'.")
+
(defvar erc--scrolltobottom-relaxed-skip-commands
'(recenter-top-bottom scroll-down-command)
"Commands exempt from triggering a stash and restore of `window-start'.
@@ -158,7 +163,8 @@ unnarrowed."
((= (nth 2 found)
(count-screen-lines (window-start) (point-max)))))
(set-window-start (selected-window) (nth 1 found))
- (erc--scrolltobottom-confirm))
+ (unless (memq this-command erc--scrolltobottom-post-ignore-commands)
+ (erc--scrolltobottom-confirm)))
(setq erc--scrolltobottom-window-info nil)))
(defun erc--scrolltobottom-on-pre-command-relaxed ()
@@ -372,7 +378,7 @@ Put this function on `erc-insert-post-hook' and/or
`erc-send-post-hook'."
;;;###autoload(autoload 'erc-keep-place-mode "erc-goodies" nil t)
(define-erc-module keep-place nil
"Leave point above un-viewed text in other channels."
- ((add-hook 'erc-insert-pre-hook #'erc-keep-place 85))
+ ((add-hook 'erc-insert-pre-hook #'erc-keep-place 65))
((remove-hook 'erc-insert-pre-hook #'erc-keep-place)))
(defcustom erc-keep-place-indicator-style t
@@ -467,7 +473,7 @@ and `keep-place-indicator' in different buffers."
((memq 'keep-place erc-modules)
(erc-keep-place-mode +1))
;; Enable a local version of `keep-place-mode'.
- (t (add-hook 'erc-insert-pre-hook #'erc-keep-place 85 t)))
+ (t (add-hook 'erc-insert-pre-hook #'erc-keep-place 65 t)))
(if (pcase erc-keep-place-indicator-buffer-type
('target erc--target)
('server (not erc--target))
@@ -490,7 +496,7 @@ That is, ensure the local module can survive a user
toggling the
global one."
(if erc-keep-place-mode
(remove-hook 'erc-insert-pre-hook #'erc-keep-place t)
- (add-hook 'erc-insert-pre-hook #'erc-keep-place 85 t)))
+ (add-hook 'erc-insert-pre-hook #'erc-keep-place 65 t)))
(defun erc-keep-place-move (pos)
"Move keep-place indicator to current line or POS.
- master updated (ad2bb3e9f36 -> 3979f83cd60), F. Jason Park, 2023/10/02
- master a3c6ed0e364 6/7: Improve erc-warn-about-blank-lines behavior, F. Jason Park, 2023/10/02
- master 06fb8b76208 4/7: Exempt text-scale-mode from erc-scrolltobottom-all,
F. Jason Park <=
- master 019baf28599 1/7: Remove newline from erc-fill regexp, F. Jason Park, 2023/10/02
- master 6135fec6926 3/7: ; Increase ERC test server queue size, F. Jason Park, 2023/10/02
- master 8db56235cbc 5/7: Prefer ticks/hz pairs for some ERC timestamps on 29+, F. Jason Park, 2023/10/02
- master 3979f83cd60 7/7: Inhibit slash commands in erc--input-review-functions, F. Jason Park, 2023/10/02
- master ffd5d2f38d3 2/7: Fix wrong "User" column count in erc-ibuffer, F. Jason Park, 2023/10/02