all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 18285@debbugs.gnu.org
Subject: bug#18285: 24.3.92; A combination of `display' on text and `invisible' and	`before/after-string' leads to the before/after string being	displayed twice
Date: Fri, 22 Aug 2014 04:58:55 +0400	[thread overview]
Message-ID: <53F695CF.1040606@yandex.ru> (raw)
In-Reply-To: <83mwaxbze5.fsf@gnu.org>

On 08/21/2014 08:06 PM, Eli Zaretskii wrote:

>> If the `invisible' starts even one character earlier, it *is* the other
>> way around.
>
> Yes, because then there's no doubt about the order of evaluating the
> various properties and acting upon them.  By contrast, when they all
> begin at the same buffer position, the order is
> implementation-defined.  The code is written to examine display
> properties before the invisible properties.

Okay, but I'll take this to mean that hitting the changed behavior in 
existing code would be pretty rare.

Anyway, how about the other way around? I'll like this less, but why not 
make `invisible' inactive when `display' is set?

This works is a more consistent fashion, and the text that would be 
invisible ("a") is replaced by `display' anyway:

(let ((pt (point)))
   (insert (propertize "a" 'display "bbb"))
   (let ((o (make-overlay pt (point))))
     (overlay-put o 'after-string "foo\nbar")))

looks like

bbbfoo
bar

>> Maybe. But at least it's consistent with the overlay priority rules.
>
> The priority is _per_buffer_position_.  We tend to forget that text
> properties and overlays in Emacs are _character_ properties, but the
> display engine is designed and implemented to support that, and in
> some obscure cases, like this one, it is impossible to understand its
> logic, unless one remembers this simple fact.

I'm just quoting Stefan from that discussion:

"""
Same problem: for two overlays of equal `priority', the shorter one has
higher priority, so your original example is already one of those
cases, AFAIC.
"""

Like in this example:

(let ((pt (point)))
   (insert "aaa")
   (let ((o (make-overlay pt (point))) (v (make-overlay (1+ pt) (1- 
(point)))))
     (overlay-put o 'face 'bold)
     (overlay-put v 'face 'default)))

the middle character has normal weight, even though it's also covered by 
an outer overlay that sets `face' to `bold'.

So, if I had to pick which single string to show (STRING1 or STRING2), 
the latter seems to be the more consistent choice.





  reply	other threads:[~2014-08-22  0:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 22:35 bug#18285: 24.3.92; A combination of `display' on text and `invisible' and `before/after-string' leads to the before/after string being displayed twice Dmitry
     [not found] ` <handler.18285.B.140831493931056.ack@debbugs.gnu.org>
2014-08-18  1:06   ` bug#18285: Acknowledgement (24.3.92; A combination of `display' on text and `invisible' and `before/after-string' leads to the before/after string being displayed twice) Dmitry Gutov
2014-08-18 15:07 ` bug#18285: 24.3.92; A combination of `display' on text and `invisible' and `before/after-string' leads to the before/after string being displayed twice Eli Zaretskii
2014-08-21 14:07   ` Dmitry Gutov
2014-08-21 14:57     ` Eli Zaretskii
2014-08-21 15:40       ` Dmitry Gutov
2014-08-21 16:06         ` Eli Zaretskii
2014-08-22  0:58           ` Dmitry Gutov [this message]
2014-08-22  6:41             ` Eli Zaretskii
2014-08-22 11:41               ` Dmitry Gutov
2014-08-22 13:31                 ` Eli Zaretskii
2014-08-22 20:01                   ` Dmitry Gutov
2014-08-22 20:55                     ` Eli Zaretskii
2014-08-24  1:28                       ` Dmitry Gutov
2014-08-24  2:44                         ` Eli Zaretskii
2014-08-23 23:21     ` Dmitry Gutov
2014-08-24  2:40       ` Eli Zaretskii
2014-08-24  2:48         ` Dmitry Gutov
2022-04-18 11:39   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53F695CF.1040606@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=18285@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.