unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 21468@debbugs.gnu.org
Subject: bug#21468: 24.5; When next-line (visual) crosses overlay with before-string="\n" point	goes to column 0
Date: Sun, 13 Sep 2015 13:30:52 +0300	[thread overview]
Message-ID: <834miybogz.fsf@gnu.org> (raw)
In-Reply-To: <CAM-tV-9eeQcMWTUdgOtVw70tHi_RUZ5kOWdmJ+yRV3W_hUV4Xg@mail.gmail.com>

> Date: Sun, 13 Sep 2015 01:17:39 -0400
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> 
> Run
> 
>     emacs -Q next-line-fail.el -l next-line-fail.el
> 
> where next-line-fail.el contains
> 
> (let ((pos 17))
>   (goto-char pos)
>   (overlay-put (make-overlay pos (1+ pos)) 'before-string
>                (propertize "\n" 'face 'highlight)))
> 
> The overlay will create a highlighted blank line below line 1.
> Move point forward so it's on line 1, column X (where X != 0), then do
> C-n (next-line).
> 
> Expected: point should be on line 2 column X.
> Actual: point goes to line 2, but in column 0.  Note that hitting C-n
> a second time goes to line 3 column X.

Fixed in commit 6514b30 on master.

Once again, I must respectfully request that Magit maintainers refrain
from these practices of (ab)using Emacs display features where simpler
alternatives are readily available.  The buffer displayed by Magit is
entirely ephemeral, i.e. does not come from any file, so a much
simpler way would be to arrange the text in that buffer as Magit
needs, instead of using overlays and display strings to show something
that is not in the buffer.

E.g., in this fragment, cited by the Magit issue:

  (ov rend (1+ rend) 'after-string
      (propertize (concat (propertize "\s" 'display '(space :height (1)))
      		          (propertize "\n" 'line-height t))
                  'face 'magit-diff-lines-boundary)))

why can't Magit simply change the buffer text to be what it wants to
display? why does it need to use an overlay string?  All those text
properties are supported on buffer text as well.  Overlay strings and
display strings with embedded newlines are especially painful wrt
vertical cursor motion; changing the buffer text instead to present
the same display makes vertical motion's job much simpler.

The Emacs display engine was not designed for too heavy use of these
features.  By over-using them, you make Magit much less stable than
necessary, certainly much less future-proof and consistent across
different Emacs releases.  Please don't.





  reply	other threads:[~2015-09-13 10:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-13  5:17 bug#21468: 24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0 Noam Postavsky
2015-09-13 10:30 ` Eli Zaretskii [this message]
2015-09-13 17:20   ` Noam Postavsky
2015-09-13 19:50     ` Eli Zaretskii
2015-09-13 20:22       ` Noam Postavsky
2015-09-14  6:17         ` Eli Zaretskii
2015-09-14 12:46           ` Noam Postavsky
2015-09-14 13:22             ` Stefan Monnier
2015-09-14 13:33             ` Eli Zaretskii
2015-09-14 13:55               ` Noam Postavsky
2015-09-14 15:14                 ` Eli Zaretskii
2015-09-14 20:50                   ` Noam Postavsky
2015-09-15  6:53                     ` Eli Zaretskii
2015-10-01 20:43                       ` Noam Postavsky
2015-10-02 10:01                         ` Eli Zaretskii
2015-10-02 19:58                           ` Noam Postavsky
2015-10-02 21:00                             ` Eli Zaretskii
2015-10-09 23:34                               ` Noam Postavsky
2015-10-10  7:14                                 ` Eli Zaretskii
2015-10-10 13:37                                   ` Noam Postavsky
2015-10-10 14:20                                     ` Eli Zaretskii
2015-10-10 16:51                                       ` Noam Postavsky
2015-10-10 17:09                                         ` Eli Zaretskii
2015-10-10 21:06                                           ` Noam Postavsky
2015-10-11  2:38                                             ` Eli Zaretskii
2015-10-10 17:03                                     ` Eli Zaretskii

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=834miybogz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21468@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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).