all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Filling a string?
@ 2015-07-17  7:06 Marcin Borkowski
  2015-07-17  8:11 ` Tassilo Horn
  2015-07-17 23:42 ` Emanuel Berg
  0 siblings, 2 replies; 7+ messages in thread
From: Marcin Borkowski @ 2015-07-17  7:06 UTC (permalink / raw
  To: Help Gnu Emacs mailing list

Hi all,

so I want part of the buffer to have wrapped lines (preferably at word
boundaries), and part to have not (like having toggle-truncate lines
only for a region).  I suspect this is not possible, so my next bet is
to have a filling function for a string (so that I can fill it before
inserting into a buffer).  Is there anything like that in Emacs or
should I just use a temp buffer and the built-in filling functions?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
       [not found] <mailman.7037.1437116822.904.help-gnu-emacs@gnu.org>
@ 2015-07-17  7:26 ` Pascal J. Bourguignon
  0 siblings, 0 replies; 7+ messages in thread
From: Pascal J. Bourguignon @ 2015-07-17  7:26 UTC (permalink / raw
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi all,
>
> so I want part of the buffer to have wrapped lines (preferably at word
> boundaries), and part to have not (like having toggle-truncate lines
> only for a region).  I suspect this is not possible, so my next bet is
> to have a filling function for a string (so that I can fill it before
> inserting into a buffer).  Is there anything like that in Emacs or
> should I just use a temp buffer and the built-in filling functions?

You can use set-justification-left et al. to insert newlines in paragraph (and refill a paragraph).

You can use set-justification-left et al. to insert newlines in
paragraph (and refill a paragraph).

So you can have both kind of paragraphs in the same buffer.

You can reset the justification after inserting the string in the
buffer.  If you do that by program, you may use the set-justification
function.

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
  2015-07-17  7:06 Filling a string? Marcin Borkowski
@ 2015-07-17  8:11 ` Tassilo Horn
  2015-07-17  8:49   ` Vaidheeswaran C
  2015-07-17 23:42 ` Emanuel Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2015-07-17  8:11 UTC (permalink / raw
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

Hi Marcin,

> so I want part of the buffer to have wrapped lines (preferably at word
> boundaries), and part to have not (like having toggle-truncate lines
> only for a region).  I suspect this is not possible

Can't you just insert unwrapped lines and use `fill-region' on the parts
you want to have wrapped?

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
  2015-07-17  8:11 ` Tassilo Horn
@ 2015-07-17  8:49   ` Vaidheeswaran C
  2015-07-17 10:58     ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Vaidheeswaran C @ 2015-07-17  8:49 UTC (permalink / raw
  To: help-gnu-emacs

On Friday 17 July 2015 01:41 PM, Tassilo Horn wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
> 
> Hi Marcin,
> 
>> > so I want part of the buffer to have wrapped lines (preferably at word
>> > boundaries), and part to have not (like having toggle-truncate lines
>> > only for a region).  I suspect this is not possible
> Can't you just insert unwrapped lines and use `fill-region' on the parts
> you want to have wrapped?

I have a feeling that he wants the "fill" to be "soft" on certain
paragraphs of his choosing.  The only mode that I know of where in
Emacs "persists" text properties is "Enriched Mode".

    (info "(emacs) Hard and Soft Newlines")

In other words, the user wants to configure right/left margins and
importantly the width of the text area on per-paragraph basis. In the
actual file, a paragraph will have no newline at all howsoever it may
be displayed.

> Bye,
> Tassilo
> 
> 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
  2015-07-17  8:49   ` Vaidheeswaran C
@ 2015-07-17 10:58     ` Tassilo Horn
  2015-07-17 12:14       ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2015-07-17 10:58 UTC (permalink / raw
  To: Vaidheeswaran C; +Cc: help-gnu-emacs

Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com> writes:

>>> > so I want part of the buffer to have wrapped lines (preferably at
>>> > word boundaries), and part to have not (like having
>>> > toggle-truncate lines only for a region).  I suspect this is not
>>> > possible
>> Can't you just insert unwrapped lines and use `fill-region' on the
>> parts you want to have wrapped?
>
> I have a feeling that he wants the "fill" to be "soft" on certain
> paragraphs of his choosing.  The only mode that I know of where in
> Emacs "persists" text properties is "Enriched Mode".
>
>     (info "(emacs) Hard and Soft Newlines")
>
> In other words, the user wants to configure right/left margins and
> importantly the width of the text area on per-paragraph basis. In the
> actual file, a paragraph will have no newline at all howsoever it may
> be displayed.

Ah, ok.  I think it's possible, too.  There are left-margin and
right-margin text properties.

,----[ (info "(elisp)Format Properties") ]
| These text properties affect the behavior of the fill commands.  They
| are used for representing formatted text.  *Note Filling::, and *note
| Margins::.
| 
| [...]
| 
| ‘right-margin’
|      This property specifies an extra right margin for filling this part
|      of the text.
| 
| ‘left-margin’
|      This property specifies an extra left margin for filling this part
|      of the text.
`----

So possibly adding these properties to some paragraphs in your buffer +
`visual-line-mode' might do the trick.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
  2015-07-17 10:58     ` Tassilo Horn
@ 2015-07-17 12:14       ` Tassilo Horn
  0 siblings, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2015-07-17 12:14 UTC (permalink / raw
  To: Vaidheeswaran C; +Cc: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Ah, ok.  I think it's possible, too.  There are left-margin and
> right-margin text properties.
>
> ,----[ (info "(elisp)Format Properties") ]
> | These text properties affect the behavior of the fill commands.  They
> | are used for representing formatted text.  *Note Filling::, and *note
> | Margins::.
> | 
> | [...]
> | 
> | ‘right-margin’
> |      This property specifies an extra right margin for filling this part
> |      of the text.
> | 
> | ‘left-margin’
> |      This property specifies an extra left margin for filling this part
> |      of the text.
> `----
>
> So possibly adding these properties to some paragraphs in your buffer
> + `visual-line-mode' might do the trick.

I just had some time to test this, and sadly it seems to apply only to
hard filling with `fill-paragraph' and friends.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling a string?
  2015-07-17  7:06 Filling a string? Marcin Borkowski
  2015-07-17  8:11 ` Tassilo Horn
@ 2015-07-17 23:42 ` Emanuel Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2015-07-17 23:42 UTC (permalink / raw
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> so I want part of the buffer to have wrapped lines
> (preferably at word boundaries), and part to have
> not (like having toggle-truncate lines only for
> a region).

Can't you just enable/disable filling in the portions
where it is desired/undesired?

> , so my next bet is to have a filling function for
> a string (so that I can fill it before inserting
> into a buffer). Is there anything like that in Emacs
> or should I just use a temp buffer and the built-in
> filling functions?

Make a region and then `fill-region'!

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-17 23:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17  7:06 Filling a string? Marcin Borkowski
2015-07-17  8:11 ` Tassilo Horn
2015-07-17  8:49   ` Vaidheeswaran C
2015-07-17 10:58     ` Tassilo Horn
2015-07-17 12:14       ` Tassilo Horn
2015-07-17 23:42 ` Emanuel Berg
     [not found] <mailman.7037.1437116822.904.help-gnu-emacs@gnu.org>
2015-07-17  7:26 ` Pascal J. Bourguignon

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.