From: pwr--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Redisplaying text in both display margins?
Date: Mon, 25 Jan 2021 18:28:11 +1000 [thread overview]
Message-ID: <01e529e1bfecb8e32c9d737ebfd26140@bydasein.com> (raw)
In-Reply-To: <8335yx7y8s.fsf@gnu.org>
On 2021-01-20 01:16, Eli Zaretskii wrote:
>> Feedback-ID: 791:353:null:purelymail
>> 2. When redisplaying a string in the left margin, how to right-align
>> it,
>> ideally padded with a couple of spaces away from the body text.
>>
>> I have read over (info "(elisp) Display Property") a few times, but
>> haven't been able to quite grok it for this specific problem.
>
> I think the node "Pixel Specification" there should tell you how to
> accomplish that, but if you already read that, please ask more
> specific questions, and/or show the code you tried that didn't work.
Thanks for the help. I had another read through and after some trial and
error got something working how I like. However I've run into some
behaviour that confuses me. I'll describe this first but this will be
clearer with the example below.
To achieve the desired result of a string in the left display margin
aligned with the body text I've put display text properties onto two
regions of text, one a space to fill most of the margin, and then the
string to display. However, when inserting enough body text to cause
these regions to wrap, the space in the margin begins to shrink.
To reproduce:
emacs -Q
(erase-buffer)
(set-window-margins nil 20)
(insert "foobarbaz")
(put-text-property 4 7 'display '((margin left-margin) (space :width (-
left-margin 2))))
(put-text-property 7 10 'display '((margin left-margin) "1"))
This should result in a window with something like:
1 foo
Then assuming a frame of 80 columns and `truncate-lines' is nil (or
visual-line-mode is enabled):
(goto-char (point-min))
(insert (make-string 45 ?x))
The "1" will appear to get pushed towards the left as more text is added
until the line wraps the window:
So my question becomes, how should I apply these display text properties
such that they will not be affected by line wrapping?
Thanks!
next prev parent reply other threads:[~2021-01-25 8:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 9:27 Redisplaying text in both display margins? pwr--- via Users list for the GNU Emacs text editor
2021-01-19 15:16 ` Eli Zaretskii
2021-01-25 8:28 ` pwr--- via Users list for the GNU Emacs text editor [this message]
2021-01-27 15:59 ` Eli Zaretskii
2021-01-27 18:02 ` Alan Third
2021-02-01 7:04 ` pwr--- via Users list for the GNU Emacs text editor
2021-02-01 15:02 ` Eli Zaretskii
2021-02-01 15:44 ` pwr--- via Users list for the GNU Emacs text editor
2021-02-01 16:10 ` moasenwood--- via Users list for the GNU Emacs text editor
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=01e529e1bfecb8e32c9d737ebfd26140@bydasein.com \
--to=help-gnu-emacs@gnu.org \
--cc=eliz@gnu.org \
--cc=pwr@bydasein.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 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.