[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Indentation and visual-line-mode
From: |
Stephen Berman |
Subject: |
Re: Indentation and visual-line-mode |
Date: |
Fri, 25 Nov 2011 13:38:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) |
On Fri, 25 Nov 2011 13:52:37 +0200 Eli Zaretskii <address@hidden> wrote:
>> From: Tassilo Horn <address@hidden>
>> 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
Re: Indentation and visual-line-mode, Lennart Borgman, 2011/11/25
Re: Indentation and visual-line-mode, Stefan Monnier, 2011/11/25