unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Overlay behavior change
@ 2020-07-08  8:14 Gregory Heytings via Emacs development discussions.
  2020-07-08  8:48 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gregory Heytings via Emacs development discussions. @ 2020-07-08  8:14 UTC (permalink / raw)
  To: emacs-devel


Hi,

Since at least Emacs 21, overlays between two buffer positions, when these 
two positions are on different lines, extend to the right border of the 
window.  In Emacs 28.0.50 this is not the case anymore, overlays extend 
only one character position after the last character of the line.  Sample 
code (put the cursor on, say, 'lambda' and press C-t):

(global-set-key
  (kbd "C-t")
  (function
    (lambda ()
      (interactive)
      (let* ((start (point))
             (end (progn (save-excursion (forward-line 5) (point))))
             (o (make-overlay start end)))
     (overlay-put o 'face '(:background "green"))))))

Is this change intentional?  It does not seem to be documented in the 
NEWS, and I did not find it in the ChangeLogs either (but perhaps I did 
not look carefully enough).  How can one get the previous default 
behavior?

Gregory



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Overlay behavior change
  2020-07-08  8:14 Overlay behavior change Gregory Heytings via Emacs development discussions.
@ 2020-07-08  8:48 ` Eli Zaretskii
  2020-07-08  9:14   ` Gregory Heytings via Emacs development discussions.
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-07-08  8:48 UTC (permalink / raw)
  To: emacs-devel, Gregory Heytings,
	Gregory Heytings via Emacs development discussions.

On July 8, 2020 11:14:25 AM GMT+03:00, "Gregory Heytings via Emacs development discussions." <emacs-devel@gnu.org> wrote:
> 
> Hi,
> 
> Since at least Emacs 21, overlays between two buffer positions, when
> these 
> two positions are on different lines, extend to the right border of
> the 
> window.  In Emacs 28.0.50 this is not the case anymore, overlays
> extend 
> only one character position after the last character of the line. 
> Sample 
> code (put the cursor on, say, 'lambda' and press C-t):
> 
> (global-set-key
>   (kbd "C-t")
>   (function
>     (lambda ()
>       (interactive)
>       (let* ((start (point))
>              (end (progn (save-excursion (forward-line 5) (point))))
>              (o (make-overlay start end)))
>      (overlay-put o 'face '(:background "green"))))))
> 
> Is this change intentional?  It does not seem to be documented in the 
> NEWS, and I did not find it in the ChangeLogs either (but perhaps I
> did 
> not look carefully enough).  How can one get the previous default 
> behavior?

Yes, this is an intentional change: faces are no longer by default extended to end of line.  If you really need that, use the ':extend' attribute of the face.

This is in NEWS for Emacs 27, I guess you just didn't know which keyword to look for.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Overlay behavior change
  2020-07-08  8:48 ` Eli Zaretskii
@ 2020-07-08  9:14   ` Gregory Heytings via Emacs development discussions.
  2020-07-08 14:26     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gregory Heytings via Emacs development discussions. @ 2020-07-08  9:14 UTC (permalink / raw)
  To: emacs-devel


>
> Yes, this is an intentional change: faces are no longer by default 
> extended to end of line.  If you really need that, use the ':extend' 
> attribute of the face.
>
> This is in NEWS for Emacs 27, I guess you just didn't know which keyword 
> to look for.
>

Thanks!  Indeed, I looked at the NEWS for Emacs 28, but I think I wouldn't 
have find it in the NEWS for Emacs 27.  Indeed I "really" need that, or at 
least that's what I'm used to: I use (show-paren-mode) with (setq 
show-paren-style 'expression), and during the last twenty years or so it 
has implicitly used ":extend t".

Gregory



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Overlay behavior change
  2020-07-08  9:14   ` Gregory Heytings via Emacs development discussions.
@ 2020-07-08 14:26     ` Eli Zaretskii
  2020-07-08 15:12       ` Gregory Heytings via Emacs development discussions.
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-07-08 14:26 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: emacs-devel

> Date: Wed, 8 Jul 2020 11:14:37 +0200 (CEST)
> From: Gregory Heytings via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> Indeed I "really" need that, or at least that's what I'm used to: I
> use (show-paren-mode) with (setq show-paren-style 'expression), and
> during the last twenty years or so it has implicitly used ":extend t".

My suggestion is to try the new display first, you might like it after
some time.  There's no need to paint the entire line with the
background color, just the text should be enough.  That it looks
strange at first is just a (bad) habit we all have.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Overlay behavior change
  2020-07-08 14:26     ` Eli Zaretskii
@ 2020-07-08 15:12       ` Gregory Heytings via Emacs development discussions.
  2020-07-08 16:25         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gregory Heytings via Emacs development discussions. @ 2020-07-08 15:12 UTC (permalink / raw)
  To: emacs-devel


>
>> Indeed I "really" need that, or at least that's what I'm used to: I use 
>> (show-paren-mode) with (setq show-paren-style 'expression), and during 
>> the last twenty years or so it has implicitly used ":extend t".
>
> My suggestion is to try the new display first, you might like it after 
> some time.  There's no need to paint the entire line with the background 
> color, just the text should be enough.  That it looks strange at first 
> is just a (bad) habit we all have.
>

In fact, I very much like the fact that a block (of code) is displayed on 
my screen as a (visual) block.  And I don't like the staircase aspect of 
the current default.  But I promise I'll give it another try ;-)

What I would have liked to see is something that is neither the previous 
nor the current default behavior.  This idea will probably not be 
considered (let's name it the attribute ":visualblock t"), but here it is:

1. calculate the overlay as it would have been displayed by Emacs 21 to 
26.

2. remove all pixel columns on the right *and on the left* of the overlay 
which have no "content" (that is, no characters on the right, whitespace 
characters on the left).

This way the block (of code) would really be displayed on the screen as a 
block, even a deeply nested one.  The above "algorithm" would work with 
fixed and variable-width fonts, but could of course be made more efficient 
for fixed-width fonts.

Gregory



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Overlay behavior change
  2020-07-08 15:12       ` Gregory Heytings via Emacs development discussions.
@ 2020-07-08 16:25         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2020-07-08 16:25 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: emacs-devel

> Date: Wed, 8 Jul 2020 17:12:23 +0200 (CEST)
> From: Gregory Heytings via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> What I would have liked to see is something that is neither the previous 
> nor the current default behavior.  This idea will probably not be 
> considered (let's name it the attribute ":visualblock t"), but here it is:
> 
> 1. calculate the overlay as it would have been displayed by Emacs 21 to 
> 26.
> 
> 2. remove all pixel columns on the right *and on the left* of the overlay 
> which have no "content" (that is, no characters on the right, whitespace 
> characters on the left).
> 
> This way the block (of code) would really be displayed on the screen as a 
> block, even a deeply nested one.  The above "algorithm" would work with 
> fixed and variable-width fonts, but could of course be made more efficient 
> for fixed-width fonts.

Feel free to submit a feature-request bug report about this.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-08 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08  8:14 Overlay behavior change Gregory Heytings via Emacs development discussions.
2020-07-08  8:48 ` Eli Zaretskii
2020-07-08  9:14   ` Gregory Heytings via Emacs development discussions.
2020-07-08 14:26     ` Eli Zaretskii
2020-07-08 15:12       ` Gregory Heytings via Emacs development discussions.
2020-07-08 16:25         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).