GNU bug report logs - #29198
Cursor fringe arrow indicator not updating.

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Tue, 7 Nov 2017 19:59:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

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 29198 in the body.
You can then email your comments to 29198 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


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Tue, 07 Nov 2017 19:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keith David Bershatsky <esq <at> lawlist.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Nov 2017 19:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Emacs Bug Reports <bug-gnu-emacs <at> gnu.org>
Subject: Cursor fringe arrow indicator not updating.
Date: Tue, 07 Nov 2017 11:57:49 -0800
The following code works fine with no user configuration in Emacs 25.3.  However, it does not work well with the current version of the master branch.  The overlay arrow indicator is not updating as the user moves up or down in the buffer with the keyboard arrow keys.

Step 1:  Open an Emacs built from the current master branch.

Step 2:  Got to the scratch buffer and evaluate the code below.

Step 3:  Maneuver up and down with the arrow keys navigating the code below.  The fringe bitmap indicator should track the vertical cursor position, but it does not work.


(defface +-left-fringe-cursor-face
  '((t (:foreground "firebrick")))
  "Face for `+-left-fringe-cursor-face'."
  :group '+-mode)

(defun set-fringe-cursor ()
"Doc-string"
  (if (not (and (eobp) (bolp)))
     (setq +-left-fringe-overlay-position (copy-marker (line-beginning-position)))
    (setq +-left-fringe-overlay-position  nil)))

(define-fringe-bitmap '+-cursor-left-fringe-bitmap [128 192 96 48 24 48 96 192 128] 9 8 'center)
(set-fringe-bitmap-face '+-cursor-left-fringe-bitmap '+-left-fringe-cursor-face)

;;; `overlay-arrow-bitmap' is a special SYMBOL defined in xdisp.c.
(defvar +-left-fringe-overlay-position nil
  "Doc-string.")
(make-variable-buffer-local '+-left-fringe-overlay-position)
(add-to-list 'overlay-arrow-variable-list '+-left-fringe-overlay-position)
(put '+-left-fringe-overlay-position 'overlay-arrow-bitmap '+-cursor-left-fringe-bitmap)

(add-hook 'post-command-hook 'set-fringe-cursor 'append 'local)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Tue, 07 Nov 2017 20:38:02 GMT) Full text and rfc822 format available.

Message #8 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Tue, 07 Nov 2017 22:37:43 +0200
> Date: Tue, 07 Nov 2017 11:57:49 -0800
> From: Keith David Bershatsky <esq <at> lawlist.com>
> 
> The following code works fine with no user configuration in Emacs 25.3.  However, it does not work well with the current version of the master branch.  The overlay arrow indicator is not updating as the user moves up or down in the buffer with the keyboard arrow keys.
> 
> Step 1:  Open an Emacs built from the current master branch.
> 
> Step 2:  Got to the scratch buffer and evaluate the code below.
> 
> Step 3:  Maneuver up and down with the arrow keys navigating the code below.  The fringe bitmap indicator should track the vertical cursor position, but it does not work.

Does it update if you type "M-x"?  If it does, you aren't triggering a
thorough enough redisplay.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Tue, 07 Nov 2017 20:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Tue, 07 Nov 2017 12:48:35 -0800
Yes, "M-x" triggers an immediate removal of the old indicator and places the new indicator at the current line position.

I would recommend adding an exception to the redisplay optimization to check for a change of placement to the built-in overlay fringe arrow indicator.  Since the fringe arrow indicator has been an existing feature of Emacs for quite some time (built-in to xdisp.c), it should (in my opinion) work out of the box without the need for the user to force a redisplay with additional Lisp code.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [11-07-2017 12:37:43] <07 Nov 2017 22:37:43 +0200>
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
> * * *
> 
> Does it update if you type "M-x"?  If it does, you aren't triggering a
> thorough enough redisplay.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Wed, 08 Nov 2017 03:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Wed, 08 Nov 2017 05:39:14 +0200
> Date:  Tue, 07 Nov 2017 12:48:35 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  29198 <at> debbugs.gnu.org
> 
> Yes, "M-x" triggers an immediate removal of the old indicator and places the new indicator at the current line position.
> 
> I would recommend adding an exception to the redisplay optimization to check for a change of placement to the built-in overlay fringe arrow indicator.  Since the fringe arrow indicator has been an existing feature of Emacs for quite some time (built-in to xdisp.c), it should (in my opinion) work out of the box without the need for the user to force a redisplay with additional Lisp code.

The other features which display the fringe arrow work correctly, so
evidently there is a way of moving it from Lisp.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Thu, 09 Nov 2017 04:27:02 GMT) Full text and rfc822 format available.

Message #17 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Wed, 08 Nov 2017 20:26:16 -0800
This feature was broken on February 23, 2017 with:

dee8674414fae2323fd9cbf05aa762e72fa575e5

I manually reversed the optimization that was applied with the above-mentioned patch, and built a new Emacs 26 downloaded today and am able to verify that this corrects the problem.  I.e., manually reversing *a575e5 as applied to xdisp.c makes everything work properly.

I used the lo-tech approach of trying out various builds until I found the date where the feature stopped working properly.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [11-07-2017 19:39:14] <08 Nov 2017 05:39:14 +0200>
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
> * * *
> 
> The other features which display the fringe arrow work correctly, so
> evidently there is a way of moving it from Lisp.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Thu, 09 Nov 2017 04:44:02 GMT) Full text and rfc822 format available.

Message #20 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Wed, 08 Nov 2017 20:43:47 -0800
I thought it may also be helpful for you to be aware that the slow-down that I reported on reddit with this feature was experienced with a build of Emacs _prior_ to February 23, 2017, when the following patch was applied dee8674414fae2323fd9cbf05aa762e72fa575e5.  [I am doing my Emacs C tinkering/development of new features and my daily workflow with an older version of Emacs master branch, that has certain patches applied such as line numbers and horizontal scrolling of the current line.]

Here is the relevent reddit thread from a few weeks ago:

https://www.reddit.com/r/emacs/comments/76a5nu/how_to_speed_up_fringe_overlay_cursor_arrow/dohj50i/?st=j9rzd34c&sh=f19a1d88

I did some profiling (in a version of Emacs prior to February 23, 2017) and can see that there is increased garbage collection, perhaps due to the placement of a marker, but I'm just guessing as to the cause.  It may have also been due to a full redisplay or something of that nature.

Keith




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 09 Nov 2017 16:30:02 GMT) Full text and rfc822 format available.

Notification sent to Keith David Bershatsky <esq <at> lawlist.com>:
bug acknowledged by developer. (Thu, 09 Nov 2017 16:30:02 GMT) Full text and rfc822 format available.

Message #25 received at 29198-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 29198-done <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Thu, 09 Nov 2017 18:29:14 +0200
> Date:  Wed, 08 Nov 2017 20:26:16 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  29198 <at> debbugs.gnu.org
> 
> This feature was broken on February 23, 2017 with:
> 
> dee8674414fae2323fd9cbf05aa762e72fa575e5
> 
> I manually reversed the optimization that was applied with the above-mentioned patch, and built a new Emacs 26 downloaded today and am able to verify that this corrects the problem.  I.e., manually reversing *a575e5 as applied to xdisp.c makes everything work properly.

Thanks.  Meanwhile I also arrived at the conclusion that this is a
bug, because the same recipe does work on TTY frames.

Of course, reverting the above changes is not the solution, because as
you yourself noticed, it caused redisplay to be significantly
snappier.  The problem with those changes is that they opened the path
for the code to use redisplay optimizations when overlay-arrows are
displayed, which (the optimizations) are incompatible with
overlay-arrow display.  So the correct solution would be to disable
those optimizations when overlay-arrows are displayed in the buffer.
Which I just did.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29198; Package emacs. (Fri, 10 Nov 2017 04:20:01 GMT) Full text and rfc822 format available.

Message #28 received at 29198 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29198 <at> debbugs.gnu.org
Subject: Re: bug#29198: Cursor fringe arrow indicator not updating.
Date: Thu, 09 Nov 2017 20:19:08 -0800
Thank you, Eli.

I have tested the patch with a current version of Emacs 26 branch and am able to verify that this feature is working well, and the prior issue with the lag has been rectified.

Great job!

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [11-09-2017 08:29:14] <09 Nov 2017 18:29:14 +0200>
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
> * * *
> 
> Thanks.  Meanwhile I also arrived at the conclusion that this is a
> bug, because the same recipe does work on TTY frames.
> 
> Of course, reverting the above changes is not the solution, because as
> you yourself noticed, it caused redisplay to be significantly
> snappier.  The problem with those changes is that they opened the path
> for the code to use redisplay optimizations when overlay-arrows are
> displayed, which (the optimizations) are incompatible with
> overlay-arrow display.  So the correct solution would be to disable
> those optimizations when overlay-arrows are displayed in the buffer.
> Which I just did.
> 
> Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Dec 2017 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.