Package: emacs;
Reported by: "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it>
Date: Tue, 10 May 2016 20:12:01 UTC
Severity: normal
Done: Stephen Berman <stephen.berman <at> gmx.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23510 in the body.
You can then email your comments to 23510 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Tue, 10 May 2016 20:12:01 GMT) Full text and rfc822 format available."angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it>
:bug-gnu-emacs <at> gnu.org
.
(Tue, 10 May 2016 20:12:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it> To: bug-gnu-emacs <at> gnu.org Subject: Strange redisplay in global highlighted mode moving the scroll bar Date: Tue, 10 May 2016 21:31:26 +0200 (CEST)
Maybe this is not a bug but I want to flag for completeness.. The following should be reproducible with the following simple init.el: $ cat init.el ;; (global-hl-line-mode 1) Now, in the scratch buffer, copy and paste many times its text (;; This buffer...) so that the scratch buffer has many lines, not all contained in the Emacs window/frame. Move the cursor on a line, more or less at the center of the window. The line is highlighted (in green, by default). Now move slowly up/down the scroll bar, then the highlighted line seems to flicker as if it were redrawn at (almost) each pixel movement of the scroll bar. Is this to be expected? Other software with same feature do not show this "flickering" and the highlight moves synchronously with the text. The effect is visible not only with vertical scroll bar but also with the horizontal. I see this with my master builds on Windows, GNU/linux and OSX. Angelo
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Wed, 11 May 2016 08:14:01 GMT) Full text and rfc822 format available.Message #8 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it> Cc: 23510 <at> debbugs.gnu.org Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Wed, 11 May 2016 11:13:05 +0300
> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST) > From: "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it> > > (global-hl-line-mode 1) > > > Now, in the scratch buffer, copy and paste many times its text (;; This > buffer...) so that the scratch buffer has many lines, not all contained in the > Emacs window/frame. Move the cursor on a line, more or less at the center of > the window. The line is highlighted (in green, by default). Now move slowly > up/down the scroll bar, then the highlighted line seems to flicker as if it > were redrawn at (almost) each pixel movement of the scroll bar. > > Is this to be expected? I think so. HL-Line mode works by hooking both pre-command-hook and post-command-hook; it removes its highlight overlay in the former and reapplies it in the latter. When you move the scroll-bar thumb, the hooks are called several times (at least twice) per mouse drag event, and since Emacs tracks the mouse moves at pixel granularity, you usually have much more calls to the hooks. The result is constant redrawing of the highlighted line, and that causes flickering. > Other software with same feature do not show this > "flickering" and the highlight moves synchronously with the text. To reduce the number of redraws, hl-line.el should switch to a different method of moving the overlay, I think. I didn't try, so I cannot be sure this is doable with the existing facilities, but someone who is motivated enough should try using, e.g., pre-redisplay-function. It could also be that hl-line should be smarter, and refrain from removing and reapplying the overlay if point didn't move, or stays within the same screen line. Again, I didn't try that, so perhaps it won't work for some reason.
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Wed, 11 May 2016 09:26:01 GMT) Full text and rfc822 format available.Message #11 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510 <at> debbugs.gnu.org, "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it> Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Wed, 11 May 2016 11:25:24 +0200
On Wed, 11 May 2016 11:13:05 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST) >> From: "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it> >> >> (global-hl-line-mode 1) >> >> >> Now, in the scratch buffer, copy and paste many times its text (;; This >> buffer...) so that the scratch buffer has many lines, not all contained in the >> Emacs window/frame. Move the cursor on a line, more or less at the center of >> the window. The line is highlighted (in green, by default). Now move slowly >> up/down the scroll bar, then the highlighted line seems to flicker as if it >> were redrawn at (almost) each pixel movement of the scroll bar. >> >> Is this to be expected? > > I think so. HL-Line mode works by hooking both pre-command-hook and > post-command-hook; it removes its highlight overlay in the former and > reapplies it in the latter. When you move the scroll-bar thumb, the > hooks are called several times (at least twice) per mouse drag event, > and since Emacs tracks the mouse moves at pixel granularity, you > usually have much more calls to the hooks. The result is constant > redrawing of the highlighted line, and that causes flickering. > >> Other software with same feature do not show this >> "flickering" and the highlight moves synchronously with the text. > > To reduce the number of redraws, hl-line.el should switch to a > different method of moving the overlay, I think. I didn't try, so I > cannot be sure this is doable with the existing facilities, but > someone who is motivated enough should try using, e.g., > pre-redisplay-function. > > It could also be that hl-line should be smarter, and refrain from > removing and reapplying the overlay if point didn't move, or stays > within the same screen line. Again, I didn't try that, so perhaps it > won't work for some reason. What you say about the use of pre- and post-command-hook and moving overlays may well be (perhaps the main) part of the problem here, but I found out that there's an specific condition inducing it: I noticed that the flickering only happens when global-hl-line-mode is enabled, but not when hl-line-mode is enabled, and it turns out that the crucial difference between them is that in the former, global-hl-line-sticky-flag is nil by default, while in the latter, hl-line-sticky-flag is t by default: when I set global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the flickering no longer happens, and when I set hl-line-sticky-flag to nil and then enable hl-line-mode, the flickering does happen. Steve Berman
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Wed, 11 May 2016 09:45:02 GMT) Full text and rfc822 format available.Message #14 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Stephen Berman <stephen.berman <at> gmx.net> Cc: 23510 <at> debbugs.gnu.org, angelo.graziosi <at> libero.it Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Wed, 11 May 2016 12:44:43 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net> > Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, 23510 <at> debbugs.gnu.org > Date: Wed, 11 May 2016 11:25:24 +0200 > > What you say about the use of pre- and post-command-hook and moving > overlays may well be (perhaps the main) part of the problem here, but I > found out that there's an specific condition inducing it: I noticed that > the flickering only happens when global-hl-line-mode is enabled, but not > when hl-line-mode is enabled, and it turns out that the crucial > difference between them is that in the former, > global-hl-line-sticky-flag is nil by default, while in the latter, > hl-line-sticky-flag is t by default: when I set > global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the > flickering no longer happens, and when I set hl-line-sticky-flag to nil > and then enable hl-line-mode, the flickering does happen. If you can suggest a patch that fixes that and doesn't have any adverse effects, please do.
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Fri, 13 May 2016 19:59:01 GMT) Full text and rfc822 format available.Message #17 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: 23510 <at> debbugs.gnu.org Cc: Eli Zaretskii <eliz <at> gnu.org>, angelo.graziosi <at> libero.it Subject: Fwd: Strange redisplay in global highlighted mode moving the scroll bar Date: Fri, 13 May 2016 12:58:25 -0700
[Steve Berman asked me to forward the following, as he has had trouble sending email to debbugs.] -------- Forwarded Message -------- On Wed, 11 May 2016 12:44:43 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> From: Stephen Berman <stephen.berman <at> gmx.net> >> Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, >> 23510 <at> debbugs.gnu.org >> Date: Wed, 11 May 2016 11:25:24 +0200 >> >> What you say about the use of pre- and post-command-hook and moving >> overlays may well be (perhaps the main) part of the problem here, but I >> found out that there's an specific condition inducing it: I noticed that >> the flickering only happens when global-hl-line-mode is enabled, but not >> when hl-line-mode is enabled, and it turns out that the crucial >> difference between them is that in the former, >> global-hl-line-sticky-flag is nil by default, while in the latter, >> hl-line-sticky-flag is t by default: when I set >> global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the >> flickering no longer happens, and when I set hl-line-sticky-flag to nil >> and then enable hl-line-mode, the flickering does happen. > > If you can suggest a patch that fixes that and doesn't have any > adverse effects, please do. Ok, I've given it a try; patch below. Debugging showed that the flickering is caused by calling delete-overlay on pre-command-hook, so I eliminated the uses of this hook and replaced them with the new functions hl-line-maybe-unhighlight and global-hl-line-maybe-unhighlight added to post-command-hook that call delete-overlay under more specific conditions. According to my tests this does not lead to flickering and highlights and unhighlights as before (but others should test the code, in case I missed or messed up anything). I also noticed that the definition of global-hl-line-mode fails to remove global-hl-line-highlight from change-major-mode-hook when the mode is disabled; I assume this was an oversite, so I rectified it. If my fix is found acceptable, I assume it should go to master, since the flickering problem was probably always there, so is not a regression in emacs-25. With that in mind, I took the opportunity to make global-hl-line-mode automatically taken effect in all live windows when global-hl-line-sticky-flag is non-nil (the new function global-hl-line-highlight-all); in the current (and I assume original) implementation, enabling global-hl-line-mode only highlights the current line of the selected window, even when global-hl-line-sticky-flag is non-nil (the highlighting appears in other windows when they become selected). This change seems consistent with the idea of Global-Hl-Line mode, expressed in its doc string ("Toggle line highlighting in all buffers"). I tested it with three windows in each of two frames (the most that comfortably fit on my display), and the highlighting was as fast as with two windows on one frame, but I suppose it's possible that more windows on more frames might be slower. Steve Berman diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 25c8a08..642a8ba 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -126,6 +126,9 @@ hl-line-range-function This variable is expected to be made buffer-local by modes.") +(defvar hl-line-overlay-buffer nil + "Most recently visited buffer in which Hl-Line mode is enabled.") + ;;;###autoload (define-minor-mode hl-line-mode "Toggle highlighting of the current line (Hl-Line mode). @@ -142,22 +145,21 @@ hl-line-mode When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the line about point in the selected window only. In this case, it -uses the function `hl-line-unhighlight' on `pre-command-hook' in +uses the function `hl-line-maybe-unhighlight' in addition to `hl-line-highlight' on `post-command-hook'." :group 'hl-line (if hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) - (if hl-line-sticky-flag - (remove-hook 'pre-command-hook #'hl-line-unhighlight t) - (add-hook 'pre-command-hook #'hl-line-unhighlight nil t)) (hl-line-highlight) - (add-hook 'post-command-hook #'hl-line-highlight nil t)) + (setq hl-line-overlay-buffer (current-buffer)) + (add-hook 'post-command-hook #'hl-line-highlight nil t) + (add-hook 'post-command-hook #'hl-line-maybe-unhighlight)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) + (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -181,6 +183,22 @@ hl-line-unhighlight (when hl-line-overlay (delete-overlay hl-line-overlay))) +(defun hl-line-maybe-unhighlight () + "Maybe deactivate the Hl-Line overlay on the current line. +Specifically, when `hl-line-sticky-flag' is nil deactivate all +such overlays in all buffers except the current one." + (let ((hlob hl-line-overlay-buffer) + (curbuf (current-buffer))) + (when (and (not hl-line-sticky-flag) + (not (eq curbuf hlob)) + (not (minibufferp))) + (with-current-buffer hlob + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay)))) + (when (and (overlayp hl-line-overlay) + (eq (overlay-buffer hl-line-overlay) curbuf)) + (setq hl-line-overlay-buffer curbuf)))) + ;;;###autoload (define-minor-mode global-hl-line-mode "Toggle line highlighting in all buffers (Global Hl-Line mode). @@ -189,25 +207,24 @@ global-hl-line-mode the mode if ARG is omitted or nil. If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode -highlights the line about the current buffer's point in all +highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and -`global-hl-line-highlight' on `pre-command-hook' and `post-command-hook'." +Global-Hl-Line mode uses the functions `global-hl-line-highlight' +and `global-hl-line-maybe-unhighlight' on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (if global-hl-line-sticky-flag - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (add-hook 'pre-command-hook #'global-hl-line-unhighlight)) - (global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-highlight)) + (global-hl-line-highlight-all) + (add-hook 'post-command-hook #'global-hl-line-highlight) + (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) (global-hl-line-unhighlight-all) - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-highlight))) + (remove-hook 'post-command-hook #'global-hl-line-highlight) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) + (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." @@ -222,11 +239,33 @@ global-hl-line-highlight (selected-window))) (hl-line-move global-hl-line-overlay)))) +(defun global-hl-line-highlight-all () + "Highlight the current line in all live windows." + (walk-windows (lambda (w) + (with-current-buffer (window-buffer w) + (global-hl-line-highlight))) + nil t)) + (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." (when global-hl-line-overlay (delete-overlay global-hl-line-overlay))) +(defun global-hl-line-maybe-unhighlight () + "Maybe deactivate the Global-Hl-Line overlay on the current line. +Specifically, when `global-hl-line-sticky-flag' is nil deactivate +all such overlays in all buffers except the current one." + (mapc (lambda (ov) + (let ((ovb (overlay-buffer ov))) + (when (and (not global-hl-line-sticky-flag) + (bufferp ovb) + (not (eq ovb (current-buffer))) + (not (minibufferp))) + (with-current-buffer ovb + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay)))))) + global-hl-line-overlays)) + (defun global-hl-line-unhighlight-all () "Deactivate all Global-Hl-Line overlays." (mapc (lambda (ov)
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Sat, 14 May 2016 07:43:02 GMT) Full text and rfc822 format available.Message #20 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Angelo Graziosi <angelo.graziosi <at> alice.it> To: 23510 <at> debbugs.gnu.org Cc: Eli Zaretskii <eliz <at> gnu.org>, stephen.berman <at> gmx.net Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Sat, 14 May 2016 09:42:13 +0200
> If my fix is found acceptable I have tested the patch with this init.el file: ;; (global-hl-line-mode 1) and it seems to work.. Any other configuration for testing? Ciao, Angelo.
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 17:44:03 GMT) Full text and rfc822 format available.Message #23 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> rub.de> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510 <at> debbugs.gnu.org, angelo.graziosi <at> libero.it Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Fri, 13 May 2016 19:20:03 +0200
[I sent this last night, but it never arrived, so I resent it about an hour ago, but that also hasn't arrived, so now I'm sending again from a different email address.] On Wed, 11 May 2016 12:44:43 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> From: Stephen Berman <stephen.berman <at> gmx.net> >> Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, >> 23510 <at> debbugs.gnu.org >> Date: Wed, 11 May 2016 11:25:24 +0200 >> >> What you say about the use of pre- and post-command-hook and moving >> overlays may well be (perhaps the main) part of the problem here, but I >> found out that there's an specific condition inducing it: I noticed that >> the flickering only happens when global-hl-line-mode is enabled, but not >> when hl-line-mode is enabled, and it turns out that the crucial >> difference between them is that in the former, >> global-hl-line-sticky-flag is nil by default, while in the latter, >> hl-line-sticky-flag is t by default: when I set >> global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the >> flickering no longer happens, and when I set hl-line-sticky-flag to nil >> and then enable hl-line-mode, the flickering does happen. > > If you can suggest a patch that fixes that and doesn't have any > adverse effects, please do. Ok, I've given it a try; patch below. Debugging showed that the flickering is caused by calling delete-overlay on pre-command-hook, so I eliminated the uses of this hook and replaced them with the new functions hl-line-maybe-unhighlight and global-hl-line-maybe-unhighlight added to post-command-hook that call delete-overlay under more specific conditions. According to my tests this does not lead to flickering and highlights and unhighlights as before (but others should test the code, in case I missed or messed up anything). I also noticed that the definition of global-hl-line-mode fails to remove global-hl-line-highlight from change-major-mode-hook when the mode is disabled; I assume this was an oversite, so I rectified it. If my fix is found acceptable, I assume it should go to master, since the flickering problem was probably always there, so is not a regression in emacs-25. With that in mind, I took the opportunity to make global-hl-line-mode automatically taken effect in all live windows when global-hl-line-sticky-flag is non-nil (the new function global-hl-line-highlight-all); in the current (and I assume original) implementation, enabling global-hl-line-mode only highlights the current line of the selected window, even when global-hl-line-sticky-flag is non-nil (the highlighting appears in other windows when they become selected). This change seems consistent with the idea of Global-Hl-Line mode, expressed in its doc string ("Toggle line highlighting in all buffers"). I tested it with three windows in each of two frames (the most that comfortably fit on my display), and the highlighting was as fast as with two windows on one frame, but I suppose it's possible that more windows on more frames might be slower. Steve Berman diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 25c8a08..642a8ba 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -126,6 +126,9 @@ hl-line-range-function This variable is expected to be made buffer-local by modes.") +(defvar hl-line-overlay-buffer nil + "Most recently visited buffer in which Hl-Line mode is enabled.") + ;;;###autoload (define-minor-mode hl-line-mode "Toggle highlighting of the current line (Hl-Line mode). @@ -142,22 +145,21 @@ hl-line-mode When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the line about point in the selected window only. In this case, it -uses the function `hl-line-unhighlight' on `pre-command-hook' in +uses the function `hl-line-maybe-unhighlight' in addition to `hl-line-highlight' on `post-command-hook'." :group 'hl-line (if hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) - (if hl-line-sticky-flag - (remove-hook 'pre-command-hook #'hl-line-unhighlight t) - (add-hook 'pre-command-hook #'hl-line-unhighlight nil t)) (hl-line-highlight) - (add-hook 'post-command-hook #'hl-line-highlight nil t)) + (setq hl-line-overlay-buffer (current-buffer)) + (add-hook 'post-command-hook #'hl-line-highlight nil t) + (add-hook 'post-command-hook #'hl-line-maybe-unhighlight)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) + (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -181,6 +183,22 @@ hl-line-unhighlight (when hl-line-overlay (delete-overlay hl-line-overlay))) +(defun hl-line-maybe-unhighlight () + "Maybe deactivate the Hl-Line overlay on the current line. +Specifically, when `hl-line-sticky-flag' is nil deactivate all +such overlays in all buffers except the current one." + (let ((hlob hl-line-overlay-buffer) + (curbuf (current-buffer))) + (when (and (not hl-line-sticky-flag) + (not (eq curbuf hlob)) + (not (minibufferp))) + (with-current-buffer hlob + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay)))) + (when (and (overlayp hl-line-overlay) + (eq (overlay-buffer hl-line-overlay) curbuf)) + (setq hl-line-overlay-buffer curbuf)))) + ;;;###autoload (define-minor-mode global-hl-line-mode "Toggle line highlighting in all buffers (Global Hl-Line mode). @@ -189,25 +207,24 @@ global-hl-line-mode the mode if ARG is omitted or nil. If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode -highlights the line about the current buffer's point in all +highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and -`global-hl-line-highlight' on `pre-command-hook' and `post-command-hook'." +Global-Hl-Line mode uses the functions `global-hl-line-highlight' +and `global-hl-line-maybe-unhighlight' on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (if global-hl-line-sticky-flag - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (add-hook 'pre-command-hook #'global-hl-line-unhighlight)) - (global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-highlight)) + (global-hl-line-highlight-all) + (add-hook 'post-command-hook #'global-hl-line-highlight) + (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) (global-hl-line-unhighlight-all) - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-highlight))) + (remove-hook 'post-command-hook #'global-hl-line-highlight) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) + (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." @@ -222,11 +239,33 @@ global-hl-line-highlight (selected-window))) (hl-line-move global-hl-line-overlay)))) +(defun global-hl-line-highlight-all () + "Highlight the current line in all live windows." + (walk-windows (lambda (w) + (with-current-buffer (window-buffer w) + (global-hl-line-highlight))) + nil t)) + (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." (when global-hl-line-overlay (delete-overlay global-hl-line-overlay))) +(defun global-hl-line-maybe-unhighlight () + "Maybe deactivate the Global-Hl-Line overlay on the current line. +Specifically, when `global-hl-line-sticky-flag' is nil deactivate +all such overlays in all buffers except the current one." + (mapc (lambda (ov) + (let ((ovb (overlay-buffer ov))) + (when (and (not global-hl-line-sticky-flag) + (bufferp ovb) + (not (eq ovb (current-buffer))) + (not (minibufferp))) + (with-current-buffer ovb + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay)))))) + global-hl-line-overlays)) + (defun global-hl-line-unhighlight-all () "Deactivate all Global-Hl-Line overlays." (mapc (lambda (ov)
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 17:45:01 GMT) Full text and rfc822 format available.Message #26 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510 <at> debbugs.gnu.org, angelo.graziosi <at> libero.it Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Thu, 12 May 2016 22:41:01 +0200
[Resending, since I sent this last night but it apparently never arrived; if it took a wrong turn and arrives later, sorry for the duplication.] On Wed, 11 May 2016 12:44:43 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> From: Stephen Berman <stephen.berman <at> gmx.net> >> Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, >> 23510 <at> debbugs.gnu.org >> Date: Wed, 11 May 2016 11:25:24 +0200 >> >> What you say about the use of pre- and post-command-hook and moving >> overlays may well be (perhaps the main) part of the problem here, but I >> found out that there's an specific condition inducing it: I noticed that >> the flickering only happens when global-hl-line-mode is enabled, but not >> when hl-line-mode is enabled, and it turns out that the crucial >> difference between them is that in the former, >> global-hl-line-sticky-flag is nil by default, while in the latter, >> hl-line-sticky-flag is t by default: when I set >> global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the >> flickering no longer happens, and when I set hl-line-sticky-flag to nil >> and then enable hl-line-mode, the flickering does happen. > > If you can suggest a patch that fixes that and doesn't have any > adverse effects, please do. Ok, I've given it a try; patch below. Debugging showed that the flickering is caused by calling delete-overlay on pre-command-hook, so I eliminated the uses of this hook and replaced them with the new functions hl-line-maybe-unhighlight and global-hl-line-maybe-unhighlight added to post-command-hook that call delete-overlay under more specific conditions. According to my tests this does not lead to flickering and highlights and unhighlights as before (but others should test the code, in case I missed or messed up anything). I also noticed that the definition of global-hl-line-mode fails to remove global-hl-line-highlight from change-major-mode-hook when the mode is disabled; I assume this was an oversite, so I rectified it. If my fix is found acceptable, I assume it should go to master, since the flickering problem was probably always there, so is not a regression in emacs-25. With that in mind, I took the opportunity to make global-hl-line-mode automatically taken effect in all live windows when global-hl-line-sticky-flag is non-nil (the new function global-hl-line-highlight-all); in the current (and I assume original) implementation, enabling global-hl-line-mode only highlights the current line of the selected window, even when global-hl-line-sticky-flag is non-nil (the highlighting appears in other windows when they become selected). This change seems consistent with the idea of Global-Hl-Line mode, expressed in its doc string ("Toggle line highlighting in all buffers"). I tested it with three windows in each of two frames (the most that comfortably fit on my display), and the highlighting was as fast as with two windows on one frame, but I suppose it's possible that more windows on more frames might be slower. Steve Berman diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 25c8a08..642a8ba 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -126,6 +126,9 @@ hl-line-range-function This variable is expected to be made buffer-local by modes.") +(defvar hl-line-overlay-buffer nil + "Most recently visited buffer in which Hl-Line mode is enabled.") + ;;;###autoload (define-minor-mode hl-line-mode "Toggle highlighting of the current line (Hl-Line mode). @@ -142,22 +145,21 @@ hl-line-mode When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the line about point in the selected window only. In this case, it -uses the function `hl-line-unhighlight' on `pre-command-hook' in +uses the function `hl-line-maybe-unhighlight' in addition to `hl-line-highlight' on `post-command-hook'." :group 'hl-line (if hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) - (if hl-line-sticky-flag - (remove-hook 'pre-command-hook #'hl-line-unhighlight t) - (add-hook 'pre-command-hook #'hl-line-unhighlight nil t)) (hl-line-highlight) - (add-hook 'post-command-hook #'hl-line-highlight nil t)) + (setq hl-line-overlay-buffer (current-buffer)) + (add-hook 'post-command-hook #'hl-line-highlight nil t) + (add-hook 'post-command-hook #'hl-line-maybe-unhighlight)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) + (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -181,6 +183,22 @@ hl-line-unhighlight (when hl-line-overlay (delete-overlay hl-line-overlay))) +(defun hl-line-maybe-unhighlight () + "Maybe deactivate the Hl-Line overlay on the current line. +Specifically, when `hl-line-sticky-flag' is nil deactivate all +such overlays in all buffers except the current one." + (let ((hlob hl-line-overlay-buffer) + (curbuf (current-buffer))) + (when (and (not hl-line-sticky-flag) + (not (eq curbuf hlob)) + (not (minibufferp))) + (with-current-buffer hlob + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay)))) + (when (and (overlayp hl-line-overlay) + (eq (overlay-buffer hl-line-overlay) curbuf)) + (setq hl-line-overlay-buffer curbuf)))) + ;;;###autoload (define-minor-mode global-hl-line-mode "Toggle line highlighting in all buffers (Global Hl-Line mode). @@ -189,25 +207,24 @@ global-hl-line-mode the mode if ARG is omitted or nil. If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode -highlights the line about the current buffer's point in all +highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and -`global-hl-line-highlight' on `pre-command-hook' and `post-command-hook'." +Global-Hl-Line mode uses the functions `global-hl-line-highlight' +and `global-hl-line-maybe-unhighlight' on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (if global-hl-line-sticky-flag - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (add-hook 'pre-command-hook #'global-hl-line-unhighlight)) - (global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-highlight)) + (global-hl-line-highlight-all) + (add-hook 'post-command-hook #'global-hl-line-highlight) + (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) (global-hl-line-unhighlight-all) - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-highlight))) + (remove-hook 'post-command-hook #'global-hl-line-highlight) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) + (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." @@ -222,11 +239,33 @@ global-hl-line-highlight (selected-window))) (hl-line-move global-hl-line-overlay)))) +(defun global-hl-line-highlight-all () + "Highlight the current line in all live windows." + (walk-windows (lambda (w) + (with-current-buffer (window-buffer w) + (global-hl-line-highlight))) + nil t)) + (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." (when global-hl-line-overlay (delete-overlay global-hl-line-overlay))) +(defun global-hl-line-maybe-unhighlight () + "Maybe deactivate the Global-Hl-Line overlay on the current line. +Specifically, when `global-hl-line-sticky-flag' is nil deactivate +all such overlays in all buffers except the current one." + (mapc (lambda (ov) + (let ((ovb (overlay-buffer ov))) + (when (and (not global-hl-line-sticky-flag) + (bufferp ovb) + (not (eq ovb (current-buffer))) + (not (minibufferp))) + (with-current-buffer ovb + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay)))))) + global-hl-line-overlays)) + (defun global-hl-line-unhighlight-all () "Deactivate all Global-Hl-Line overlays." (mapc (lambda (ov)
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 18:56:01 GMT) Full text and rfc822 format available.Message #29 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510 <at> debbugs.gnu.org, angelo.graziosi <at> libero.it Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Thu, 12 May 2016 22:41:01 +0200
On Wed, 11 May 2016 12:44:43 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> From: Stephen Berman <stephen.berman <at> gmx.net> >> Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, >> 23510 <at> debbugs.gnu.org >> Date: Wed, 11 May 2016 11:25:24 +0200 >> >> What you say about the use of pre- and post-command-hook and moving >> overlays may well be (perhaps the main) part of the problem here, but I >> found out that there's an specific condition inducing it: I noticed that >> the flickering only happens when global-hl-line-mode is enabled, but not >> when hl-line-mode is enabled, and it turns out that the crucial >> difference between them is that in the former, >> global-hl-line-sticky-flag is nil by default, while in the latter, >> hl-line-sticky-flag is t by default: when I set >> global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the >> flickering no longer happens, and when I set hl-line-sticky-flag to nil >> and then enable hl-line-mode, the flickering does happen. > > If you can suggest a patch that fixes that and doesn't have any > adverse effects, please do. Ok, I've given it a try; patch below. Debugging showed that the flickering is caused by calling delete-overlay on pre-command-hook, so I eliminated the uses of this hook and replaced them with the new functions hl-line-maybe-unhighlight and global-hl-line-maybe-unhighlight added to post-command-hook that call delete-overlay under more specific conditions. According to my tests this does not lead to flickering and highlights and unhighlights as before (but others should test the code, in case I missed or messed up anything). I also noticed that the definition of global-hl-line-mode fails to remove global-hl-line-highlight from change-major-mode-hook when the mode is disabled; I assume this was an oversite, so I rectified it. If my fix is found acceptable, I assume it should go to master, since the flickering problem was probably always there, so is not a regression in emacs-25. With that in mind, I took the opportunity to make global-hl-line-mode automatically taken effect in all live windows when global-hl-line-sticky-flag is non-nil (the new function global-hl-line-highlight-all); in the current (and I assume original) implementation, enabling global-hl-line-mode only highlights the current line of the selected window, even when global-hl-line-sticky-flag is non-nil (the highlighting appears in other windows when they become selected). This change seems consistent with the idea of Global-Hl-Line mode, expressed in its doc string ("Toggle line highlighting in all buffers"). I tested it with three windows in each of two frames (the most that comfortably fit on my display), and the highlighting was as fast as with two windows on one frame, but I suppose it's possible that more windows on more frames might be slower. Steve Berman diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 25c8a08..642a8ba 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -126,6 +126,9 @@ hl-line-range-function This variable is expected to be made buffer-local by modes.") +(defvar hl-line-overlay-buffer nil + "Most recently visited buffer in which Hl-Line mode is enabled.") + ;;;###autoload (define-minor-mode hl-line-mode "Toggle highlighting of the current line (Hl-Line mode). @@ -142,22 +145,21 @@ hl-line-mode When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the line about point in the selected window only. In this case, it -uses the function `hl-line-unhighlight' on `pre-command-hook' in +uses the function `hl-line-maybe-unhighlight' in addition to `hl-line-highlight' on `post-command-hook'." :group 'hl-line (if hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) - (if hl-line-sticky-flag - (remove-hook 'pre-command-hook #'hl-line-unhighlight t) - (add-hook 'pre-command-hook #'hl-line-unhighlight nil t)) (hl-line-highlight) - (add-hook 'post-command-hook #'hl-line-highlight nil t)) + (setq hl-line-overlay-buffer (current-buffer)) + (add-hook 'post-command-hook #'hl-line-highlight nil t) + (add-hook 'post-command-hook #'hl-line-maybe-unhighlight)) (remove-hook 'post-command-hook #'hl-line-highlight t) (hl-line-unhighlight) (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) - (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) + (remove-hook 'post-command-hook #'hl-line-maybe-unhighlight t))) (defun hl-line-make-overlay () (let ((ol (make-overlay (point) (point)))) @@ -181,6 +183,22 @@ hl-line-unhighlight (when hl-line-overlay (delete-overlay hl-line-overlay))) +(defun hl-line-maybe-unhighlight () + "Maybe deactivate the Hl-Line overlay on the current line. +Specifically, when `hl-line-sticky-flag' is nil deactivate all +such overlays in all buffers except the current one." + (let ((hlob hl-line-overlay-buffer) + (curbuf (current-buffer))) + (when (and (not hl-line-sticky-flag) + (not (eq curbuf hlob)) + (not (minibufferp))) + (with-current-buffer hlob + (when (overlayp hl-line-overlay) + (delete-overlay hl-line-overlay)))) + (when (and (overlayp hl-line-overlay) + (eq (overlay-buffer hl-line-overlay) curbuf)) + (setq hl-line-overlay-buffer curbuf)))) + ;;;###autoload (define-minor-mode global-hl-line-mode "Toggle line highlighting in all buffers (Global Hl-Line mode). @@ -189,25 +207,24 @@ global-hl-line-mode the mode if ARG is omitted or nil. If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode -highlights the line about the current buffer's point in all +highlights the line about the current buffer's point in all live windows. -Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and -`global-hl-line-highlight' on `pre-command-hook' and `post-command-hook'." +Global-Hl-Line mode uses the functions `global-hl-line-highlight' +and `global-hl-line-maybe-unhighlight' on `post-command-hook'." :global t :group 'hl-line (if global-hl-line-mode (progn ;; In case `kill-all-local-variables' is called. (add-hook 'change-major-mode-hook #'global-hl-line-unhighlight) - (if global-hl-line-sticky-flag - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (add-hook 'pre-command-hook #'global-hl-line-unhighlight)) - (global-hl-line-highlight) - (add-hook 'post-command-hook #'global-hl-line-highlight)) + (global-hl-line-highlight-all) + (add-hook 'post-command-hook #'global-hl-line-highlight) + (add-hook 'post-command-hook #'global-hl-line-maybe-unhighlight)) (global-hl-line-unhighlight-all) - (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) - (remove-hook 'post-command-hook #'global-hl-line-highlight))) + (remove-hook 'post-command-hook #'global-hl-line-highlight) + (remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight) + (remove-hook 'post-command-hook #'global-hl-line-maybe-unhighlight))) (defun global-hl-line-highlight () "Highlight the current line in the current window." @@ -222,11 +239,33 @@ global-hl-line-highlight (selected-window))) (hl-line-move global-hl-line-overlay)))) +(defun global-hl-line-highlight-all () + "Highlight the current line in all live windows." + (walk-windows (lambda (w) + (with-current-buffer (window-buffer w) + (global-hl-line-highlight))) + nil t)) + (defun global-hl-line-unhighlight () "Deactivate the Global-Hl-Line overlay on the current line." (when global-hl-line-overlay (delete-overlay global-hl-line-overlay))) +(defun global-hl-line-maybe-unhighlight () + "Maybe deactivate the Global-Hl-Line overlay on the current line. +Specifically, when `global-hl-line-sticky-flag' is nil deactivate +all such overlays in all buffers except the current one." + (mapc (lambda (ov) + (let ((ovb (overlay-buffer ov))) + (when (and (not global-hl-line-sticky-flag) + (bufferp ovb) + (not (eq ovb (current-buffer))) + (not (minibufferp))) + (with-current-buffer ovb + (when (overlayp global-hl-line-overlay) + (delete-overlay global-hl-line-overlay)))))) + global-hl-line-overlays)) + (defun global-hl-line-unhighlight-all () "Deactivate all Global-Hl-Line overlays." (mapc (lambda (ov)
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 19:17:03 GMT) Full text and rfc822 format available.Message #32 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>, angelo.graziosi <at> libero.it Subject: Re: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Fri, 13 May 2016 19:52:56 +0200
On Wed, 11 May 2016 12:44:43 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> From: Stephen Berman <stephen.berman <at> gmx.net> >> Cc: "angelo.graziosi\@libero.it" <angelo.graziosi <at> libero.it>, >> 23510 <at> debbugs.gnu.org >> Date: Wed, 11 May 2016 11:25:24 +0200 >> >> What you say about the use of pre- and post-command-hook and moving >> overlays may well be (perhaps the main) part of the problem here, but I >> found out that there's an specific condition inducing it: I noticed that >> the flickering only happens when global-hl-line-mode is enabled, but not >> when hl-line-mode is enabled, and it turns out that the crucial >> difference between them is that in the former, >> global-hl-line-sticky-flag is nil by default, while in the latter, >> hl-line-sticky-flag is t by default: when I set >> global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the >> flickering no longer happens, and when I set hl-line-sticky-flag to nil >> and then enable hl-line-mode, the flickering does happen. > > If you can suggest a patch that fixes that and doesn't have any > adverse effects, please do. I have a patch, which I sent last night but it never arrived; I resent it twice today, once from the same email address and once from a different one, but neither of those have arrived, although other posts have appeared in the list since my attempts were sent. So this is just a test to see if I can get through at all; if so, I'll try to see if I can send the patch another way. Steve Berman
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 21:34:01 GMT) Full text and rfc822 format available.Message #35 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Angelo Graziosi <angelo.graziosi <at> alice.it> Cc: 23510 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Mon, 16 May 2016 23:33:01 +0200
On Sat, 14 May 2016 09:42:13 +0200 Angelo Graziosi <angelo.graziosi <at> alice.it> wrote: >> If my fix is found acceptable > > I have tested the patch with this init.el file: > > ;; > (global-hl-line-mode 1) > > > and it seems to work.. I take it you mean you see no flickering? That would confirm the patch fixes problem you reported. You should also see, when you make the frame have two (or more) windows, that the current line of only the selected window is highlighted; this is the default behavior without the patch and should obtain with the patch as well. > Any other configuration for testing? The default for global-hl-line-mode, which you tested with the above, is for the value of global-hl-line-sticky-flag to be nil; if you set it to non-nil, then when you make the frame display two (or more) windows, the current line is highlighted in all of them. A difference between the behavior of the existing version of hl-line.el and the behavior with my patch is that, in the former, the current line of each window displaying a different buffer becomes highlighted only as soon as that window is selected (and remains highlighted when another window is selected), while with my patch, the current line in all live (visible) windows is highlighted at once. So this is a new feature and the question is, do you prefer this behavior to the original behavior? (If all the windows display the same buffer, then with non-nil global-hl-line-sticky-flag the highlighting appears in all of them simultaneously both with and without the patch.) It would be helpful if you'd also test the behavior of the patch with the buffer local hl-line-mode. Here, the default is for the value of hl-line-sticky-flag to be non-nil, which means that if the same buffer is displayed in two (or more) windows of a frame, the current line is highlighted in each of these windows, and in addtion, when you select a window displaying a different buffer, the line in the previously selected window (displaying the buffer in which hl-line-mode was enabled) remains highlighted. If you set hl-line-sticky-flag to nil, then only the current line of the selected window is highlighted. These behaviors of hl-line-mode should still be the same with the patch. But without the patch, setting hl-line-sticky-flag to nil results in flickering of the highlighted line when moving the scroll bar with the mouse; with the patch, there should be no flickering. Steve Berman
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Mon, 16 May 2016 22:30:02 GMT) Full text and rfc822 format available.Message #38 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Angelo Graziosi <angelo.graziosi <at> alice.it> To: Stephen Berman <stephen.berman <at> gmx.net> Cc: 23510 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Tue, 17 May 2016 00:28:57 +0200
Stephen, I tried your patch without an init file and calling "M-x hl-line-mode" and then "M-x global-hl-line-mode" and I think I can reproduce all your arguments below. Now my init file contains (setq global-hl-line-sticky-flag t) (global-hl-line-mode 1) so that I can see the line in all windows of the frame. Obviously, no flickering in all case you describe below.. Angelo Il 16/05/2016 23:33, Stephen Berman ha scritto: > On Sat, 14 May 2016 09:42:13 +0200 Angelo Graziosi <angelo.graziosi <at> alice.it> wrote: > >>> If my fix is found acceptable >> >> I have tested the patch with this init.el file: >> >> ;; >> (global-hl-line-mode 1) >> >> >> and it seems to work.. > > I take it you mean you see no flickering? That would confirm the patch > fixes problem you reported. You should also see, when you make the > frame have two (or more) windows, that the current line of only the > selected window is highlighted; this is the default behavior without the > patch and should obtain with the patch as well. > >> Any other configuration for testing? > > The default for global-hl-line-mode, which you tested with the above, is > for the value of global-hl-line-sticky-flag to be nil; if you set it to > non-nil, then when you make the frame display two (or more) windows, the > current line is highlighted in all of them. A difference between the > behavior of the existing version of hl-line.el and the behavior with my > patch is that, in the former, the current line of each window displaying > a different buffer becomes highlighted only as soon as that window is > selected (and remains highlighted when another window is selected), > while with my patch, the current line in all live (visible) windows is > highlighted at once. So this is a new feature and the question is, do > you prefer this behavior to the original behavior? (If all the windows > display the same buffer, then with non-nil global-hl-line-sticky-flag > the highlighting appears in all of them simultaneously both with and > without the patch.) > > It would be helpful if you'd also test the behavior of the patch with > the buffer local hl-line-mode. Here, the default is for the value of > hl-line-sticky-flag to be non-nil, which means that if the same buffer > is displayed in two (or more) windows of a frame, the current line is > highlighted in each of these windows, and in addtion, when you select a > window displaying a different buffer, the line in the previously > selected window (displaying the buffer in which hl-line-mode was > enabled) remains highlighted. If you set hl-line-sticky-flag to nil, > then only the current line of the selected window is highlighted. These > behaviors of hl-line-mode should still be the same with the patch. But > without the patch, setting hl-line-sticky-flag to nil results in > flickering of the highlighted line when moving the scroll bar with the > mouse; with the patch, there should be no flickering. > > Steve Berman >
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Wed, 25 May 2016 22:14:02 GMT) Full text and rfc822 format available.Message #41 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Angelo Graziosi <angelo.graziosi <at> alice.it> To: Stephen Berman <stephen.berman <at> gmx.net> Cc: 23510 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Thu, 26 May 2016 00:13:28 +0200
Any news about this issue? I am still using an Emacs build with Stephen's patch and I see no problem... Angelo Il 17/05/2016 00:28, Angelo Graziosi ha scritto: > Stephen, > > I tried your patch without an init file and calling "M-x hl-line-mode" > and then "M-x global-hl-line-mode" and I think I can reproduce all your > arguments below. > > Now my init file contains > > (setq global-hl-line-sticky-flag t) > (global-hl-line-mode 1) > > so that I can see the line in all windows of the frame. > > Obviously, no flickering in all case you describe below.. > > > Angelo > > Il 16/05/2016 23:33, Stephen Berman ha scritto: >> On Sat, 14 May 2016 09:42:13 +0200 Angelo Graziosi >> <angelo.graziosi <at> alice.it> wrote: >> >>>> If my fix is found acceptable >>> >>> I have tested the patch with this init.el file: >>> >>> ;; >>> (global-hl-line-mode 1) >>> >>> >>> and it seems to work.. >> >> I take it you mean you see no flickering? That would confirm the patch >> fixes problem you reported. You should also see, when you make the >> frame have two (or more) windows, that the current line of only the >> selected window is highlighted; this is the default behavior without the >> patch and should obtain with the patch as well. >> >>> Any other configuration for testing? >> >> The default for global-hl-line-mode, which you tested with the above, is >> for the value of global-hl-line-sticky-flag to be nil; if you set it to >> non-nil, then when you make the frame display two (or more) windows, the >> current line is highlighted in all of them. A difference between the >> behavior of the existing version of hl-line.el and the behavior with my >> patch is that, in the former, the current line of each window displaying >> a different buffer becomes highlighted only as soon as that window is >> selected (and remains highlighted when another window is selected), >> while with my patch, the current line in all live (visible) windows is >> highlighted at once. So this is a new feature and the question is, do >> you prefer this behavior to the original behavior? (If all the windows >> display the same buffer, then with non-nil global-hl-line-sticky-flag >> the highlighting appears in all of them simultaneously both with and >> without the patch.) >> >> It would be helpful if you'd also test the behavior of the patch with >> the buffer local hl-line-mode. Here, the default is for the value of >> hl-line-sticky-flag to be non-nil, which means that if the same buffer >> is displayed in two (or more) windows of a frame, the current line is >> highlighted in each of these windows, and in addtion, when you select a >> window displaying a different buffer, the line in the previously >> selected window (displaying the buffer in which hl-line-mode was >> enabled) remains highlighted. If you set hl-line-sticky-flag to nil, >> then only the current line of the selected window is highlighted. These >> behaviors of hl-line-mode should still be the same with the patch. But >> without the patch, setting hl-line-sticky-flag to nil results in >> flickering of the highlighted line when moving the scroll bar with the >> mouse; with the patch, there should be no flickering. >> >> Steve Berman >>
bug-gnu-emacs <at> gnu.org
:bug#23510
; Package emacs
.
(Thu, 26 May 2016 02:45:01 GMT) Full text and rfc822 format available.Message #44 received at 23510 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Angelo Graziosi <angelo.graziosi <at> alice.it> Cc: 23510 <at> debbugs.gnu.org, stephen.berman <at> gmx.net Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Thu, 26 May 2016 05:44:48 +0300
> Cc: 23510 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> > From: Angelo Graziosi <angelo.graziosi <at> alice.it> > Date: Thu, 26 May 2016 00:13:28 +0200 > > Any news about this issue? I am still using an Emacs build with > Stephen's patch and I see no problem... Would someone please install that?
Stephen Berman <stephen.berman <at> gmx.net>
:"angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it>
:Message #49 received at 23510-done <at> debbugs.gnu.org (full text, mbox):
From: Stephen Berman <stephen.berman <at> gmx.net> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 23510-done <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it> Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar Date: Thu, 26 May 2016 11:34:34 +0200
On Thu, 26 May 2016 05:44:48 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote: >> Cc: 23510 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> >> From: Angelo Graziosi <angelo.graziosi <at> alice.it> >> Date: Thu, 26 May 2016 00:13:28 +0200 >> >> Any news about this issue? I am still using an Emacs build with >> Stephen's patch and I see no problem... > > Would someone please install that? Done in commit 16be3e90545972dec16014253a843229d5bdf388 to master and closing the bug. Steve Berman
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Thu, 23 Jun 2016 11:24:04 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.