unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: linum.el: problem (bug ?) fix and improvement
Date: Thu, 12 May 2011 10:58:58 -0300	[thread overview]
Message-ID: <jwv4o50591y.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <BLU0-SMTP121D3D0379016D062C01293E2820@phx.gbl> (Toru TSUNEYOSHI's message of "Sat, 7 May 2011 23:50:28 +0900")

> It is displaying a wrong line number when there is an invisible line.
> (I don't know the problem is a bug clearly, but it is trouble to me.)

>     Example:
>     ====================================================================
>       In buffer (linum-mode is enabled).

>         1 abc
>         2 def
>         3 ghi
>         4 jkl

>       Make the 2nd line ("def\n") invisible (by `facemenu-set-invisible').

>         1 abc
>         2 ghi                   <= wrong
>         4 jkl
>     ====================================================================

Actually, it's even more interesting:

the line number displayed in front of `ghi' is sometimes 2 and sometimes
3, changing "at random" while editing that line or when mouse-1 clicking
in that window.

IIUC the problem is that Emacs "displays" both margin properties: the
one from the `def' line and the one from the `ghi' line, and since
in reality both can't be displayed it ends up choosing one of the two
and depending on how the redisplay happens it picks one or the other.

What we'd like here is for the redisplay to ignore the margin property
placed on invisible text.  This boils down to making Emacs ignore
`before-string' properties placed at the beginning of invisible text.
I don't think it's always right to ignore them, tho.  Maybe a good way
to make it work is to rely on the stickiness of the `before-string'
property: by making it rear-sticky (i.e. making the overlay's
front-advance non-nil) we'd be stating explicitly that the property
belongs to the hidden text and should hence be hidden as well.

> I fixed the problem.

Alternatively we can let linum do the hard work, like your patch
does, of course.

> Additionally, I improved about invisible buffer string.

>     the attached file: "linum-mode.el.2.diff"
>                        (including the above bug fix.)

>   (1) Indicating invisible line(s) by an underlined line number
>       when the following line(s) is/are invisible.

>     ====================================================================
>         _1_ abc                 <= underline
>          3  ghi
>          4  jkl
>     ====================================================================

>   (2) Indicating partial invisible string by a `strike-through' line
>       number when the line has partial invisible string.

>     ====================================================================
>         _1_ abc
>          3  ghi
>          4  jkl

>       Make the 3rd line ("hi") invisible partially.

>         _1_ abc
>         -3- g                   <= strike-through
>          4  jkl

>       Make the 1st line ("ab") invisible partially.

>         -_1_- c                 <= underline and strike-through
>          -3-  g
>           4   jkl
>     ====================================================================

Could you describe the context in which you've needed such a thing?
The strike-through info seems to be redundant with the fact that the
next line number is not the immediate successor, and I wonder when you'd
be so interested in knowing if there's some hidden text on
a particular line.


        Stefan



  reply	other threads:[~2011-05-12 13:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-07 14:50 linum.el: problem (bug ?) fix and improvement Toru TSUNEYOSHI
2011-05-12 13:58 ` Stefan Monnier [this message]
2011-05-12 17:21   ` Eli Zaretskii
2011-05-12 19:43     ` Stefan Monnier
2011-05-13 12:14   ` Toru TSUNEYOSHI
2011-05-13 14:15     ` Stefan Monnier
2011-05-13 15:55       ` Toru TSUNEYOSHI
2011-05-13 16:26         ` Stefan Monnier
2011-05-14  1:53           ` Toru TSUNEYOSHI

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv4o50591y.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=t_tuneyosi@hotmail.com \
    /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 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).