From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Tassilo Horn <tassilo@member.fsf.org>, emacs-devel@gnu.org
Subject: Re: Indentation and visual-line-mode
Date: Fri, 25 Nov 2011 13:38:10 +0100 [thread overview]
Message-ID: <87bos0l6ml.fsf@escher.home> (raw)
In-Reply-To: <83k46o8lmi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 25 Nov 2011 13:52:37 +0200")
On Fri, 25 Nov 2011 13:52:37 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Tassilo Horn <tassilo@member.fsf.org>
>> Date: Fri, 25 Nov 2011 10:34:25 +0100
>>
>> --8<---------------cut here---------------start------------->8---
>> \begin{itemize}
>> \item Foo bar baz foo
>> bar baz foo
>> \item Bar baz foo bar
>> baz
>> \end{itemize}
>> --8<---------------cut here---------------end--------------->8---
>>
>> which looks pretty weird. Is there some option that allows the wrapped
>> lines to be visually indented relative to the current logical line?
>
> I doubt that, because logical indentation and display-time wrap or
> prefixing are two very different features on two very different
> levels. Logical indentation is actually present in the buffer, while
> display-time features are produced by the display engine on the fly,
> without any consideration of previous lines.
>
>> Checking the docs, I think something like that can be achieved using the
>> variables or text properties `line-prefix' and `wrap-prefix', but what
>> is a stretch-glyph?
>
> That's the empty space generated by the display engine when you use
> :width, :relative-width, or :align-to display specs, see the node
> "Specified Space" in the ELisp manual. (I will clarify the text in
> the manual in this regard.) But the variables you mention are
> supposed to have constant values, so you cannot put there a Lisp
> expression that needs to be evaluated. Therefore, I think you will
> only be able to use them in your situation if you manually set them to
> the amount of space derived from the logical indentation, or invoke
> some hook that does that when the file is visited
I use the following (added to a major-mode defun) to achieve the visual
effect described:
(defun srb-wrap-and-indent ()
"Use word wrapping on long lines and indent with a wrap prefix.
The amount of indentation is given by user option `srb-indent-to-here'."
(set (make-local-variable 'word-wrap) t)
(set (make-local-variable 'wrap-prefix) (make-string srb-indent-to-here 32))
(unless (member '(continuation) fringe-indicator-alist)
(push '(continuation) fringe-indicator-alist)))
> (assuming you never
> want to change the indentation during editing).
A while ago there was a thread about implementing a minor mode to get
visual indentation with wrap-prefix using fill-context-prefix, in which
I proposed an adaptation of the above; see
<http://permalink.gmane.org/gmane.emacs.devel/125268>. AFAIK there was
no followup to my proposal.
Steve Berman
next prev parent reply other threads:[~2011-11-25 12:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 9:34 Indentation and visual-line-mode Tassilo Horn
2011-11-25 11:52 ` Eli Zaretskii
2011-11-25 12:38 ` Stephen Berman [this message]
2011-11-25 13:54 ` Tassilo Horn
2011-11-25 14:52 ` Stefan Monnier
2011-11-25 14:58 ` Lennart Borgman
2011-11-25 15:15 ` Tassilo Horn
2011-11-25 13:49 ` Lennart Borgman
2011-11-25 14:36 ` Tassilo Horn
2011-11-25 14:47 ` Lennart Borgman
2011-11-25 15:37 ` Juanma Barranquero
2011-11-25 15:46 ` Lennart Borgman
2011-11-25 14:00 ` Stefan Monnier
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=87bos0l6ml.fsf@escher.home \
--to=stephen.berman@gmx.net \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tassilo@member.fsf.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.