unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joshua Lambert <jlambert.lis.tech@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Correct use of text properties?
Date: Thu, 2 Mar 2023 09:25:20 -0600	[thread overview]
Message-ID: <CAGGu9j2MOaqWYOdPxks+bTY-Rrvaekzmqi9rC6wCJuQFJC_seQ@mail.gmail.com> (raw)
In-Reply-To: <83sfenei8u.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

The pasted code may not have come through due to my copying and pasting
non-printing characters. Attached is the function in its own file.

On Thu, Mar 2, 2023 at 1:16 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Joshua Lambert <jlambert.lis.tech@gmail.com>
> > Date: Wed, 1 Mar 2023 22:21:14 -0600
> >

> > It seems to visually accomplish what I want, but line numbers and some
> > cursor motions don't treat the newlines like true newlines. Is that
> > expected behavior?
>
> Probably.  But you don't describe the behavior you found surprising,
> so it is hard to tell whether what you see is expected.  Please tell
> more about the behavior you observe that surprised you.

In the modeline and with display-line-numbers-mode the line number is always 1.
Also, pointer motions such as move-end-of-line and forward-paragraph jump to
the end of the file. Since I was adding newline characters as text properties, I
thought the line numbers might increment as I moved point down past those
newlines.

> If all you want is to break long lines on space characters, I suggest
> to try visual-line-mode instead: it does that automatically in
> low-level display code.  Did you try that?
>
I have to break the lines in specific places so this won't work. I only want to
break lines when there is a codepoint 29 or 30 in the file.

Thanks for your time and attention. Many if not all programs that manipulate
MARC records break/transform the data structure for human consumption and
then later remake it. I expected to have to do that in Emacs and then discovered
the display tables and text properties and thought I would explore those.

J. Lambert

[-- Attachment #2: marc-add-newlines.el --]
[-- Type: application/octet-stream, Size: 491 bytes --]

  reply	other threads:[~2023-03-02 15:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02  4:21 Correct use of text properties? Joshua Lambert
2023-03-02  7:15 ` Eli Zaretskii
2023-03-02 15:25   ` Joshua Lambert [this message]
2023-03-02 15:47     ` Eli Zaretskii
2023-03-02 17:20       ` Joshua Lambert
2023-03-03 12:36     ` Michael Heerdegen

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=CAGGu9j2MOaqWYOdPxks+bTY-Rrvaekzmqi9rC6wCJuQFJC_seQ@mail.gmail.com \
    --to=jlambert.lis.tech@gmail.com \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@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.
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).