Eli Zaretskii writes: >> From: Gabriel do Nascimento Ribeiro >> Date: Wed, 20 Jan 2021 22:07:33 -0300 >> >> Here is a proposal of patch for this bug. It seems to work well in all >> cases I have tested, but maybe I am missing some edge case. Suggestions >> are welcome. > > Thanks. > > While at that, would it be possible to fix some code there that I at > least consider strange? E.g., it calls delete-overlay, but doesn't > assign nil to the variable, so the overlayp predicate still returns > non-nil for the resulting invalid overlay. Also, it puts 2 functions > on the post-command-hook, but it looks like the code subtly depends on > the order of their execution (should hl-line-highlight run before or > after hl-line-maybe-unhighlight?). Hi Eli, Thanks for your suggestions. Please find attached a new patch that uses a single post-command-hook function and some other minor changes. The original issue is fixed.