all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* I need a function that breaks all lines marked at 40 chars
@ 2013-07-29  8:51 gerlach
  2013-07-29  9:23 ` Thorsten Jolitz
  2013-07-29  9:26 ` Filipp Gunbin
  0 siblings, 2 replies; 3+ messages in thread
From: gerlach @ 2013-07-29  8:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm writing mails with emacs and I sometimes want to
break all text lines that I marked to say 40 chars.
But empty line (only returns) should not be filled to
40 chars. Entire words should not be cutted within the
word.

Can you help me writing such a function? I'm beginner ...

I want:
  1. mark the the text I want to break at 40 chars
  2. call a function (M-x .... ???? )
     and the text ist breaked

Perhaps emacs has such a function already build-in. Where?

The function may be placed in .emacs profile with hard
coded number of chars , e.g.  40

tia
Eckard


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

* Re: I need a function that breaks all lines marked at 40 chars
  2013-07-29  8:51 I need a function that breaks all lines marked at 40 chars gerlach
@ 2013-07-29  9:23 ` Thorsten Jolitz
  2013-07-29  9:26 ` Filipp Gunbin
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-07-29  9:23 UTC (permalink / raw)
  To: help-gnu-emacs

gerlach <jack@aiai.de> writes:

> Hi,
>
> I'm writing mails with emacs and I sometimes want to
> break all text lines that I marked to say 40 chars.
> But empty line (only returns) should not be filled to
> 40 chars. Entire words should not be cutted within the
> word.
>
> Can you help me writing such a function? I'm beginner ...
>
> I want:
>  1. mark the the text I want to break at 40 chars
>  2. call a function (M-x .... ???? )
>     and the text ist breaked
>
> Perhaps emacs has such a function already build-in. Where?
>
> The function may be placed in .emacs profile with hard
> coded number of chars , e.g.  40
>
> tia
> Eckard

#+begin_src emacs-lisp
  (defun tj/fill-region-at-40 ()
    "Fill region with `fill-column' set at 40 chars."
    (interactive)
    (and (region-active-p)
         (let ((fill-column 40))
           (fill-region (region-beginning) (region-end)))))
#+end_src

#+results:
: tj/fill-region-at-40


would turn this region:

,------------------------------------------------------------------------------
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
|
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
|
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla blablablabla blablablabla blablablabla
`------------------------------------------------------------------------------

into this:

,---------------------------------------
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
|
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
|
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
| blablablabla blablablabla blablablabla
`---------------------------------------



--
cheers,
Thorsten




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

* Re: I need a function that breaks all lines marked at 40 chars
  2013-07-29  8:51 I need a function that breaks all lines marked at 40 chars gerlach
  2013-07-29  9:23 ` Thorsten Jolitz
@ 2013-07-29  9:26 ` Filipp Gunbin
  1 sibling, 0 replies; 3+ messages in thread
From: Filipp Gunbin @ 2013-07-29  9:26 UTC (permalink / raw)
  To: gerlach; +Cc: help-gnu-emacs

On 29/07/2013 12:51 +0400, gerlach wrote:

> Hi,
>
> I'm writing mails with emacs and I sometimes want to
> break all text lines that I marked to say 40 chars.
> But empty line (only returns) should not be filled to
> 40 chars. Entire words should not be cutted within the
> word.
>
> Can you help me writing such a function? I'm beginner ...
>
> I want:
>  1. mark the the text I want to break at 40 chars
>  2. call a function (M-x .... ???? )
>     and the text ist breaked
>
> Perhaps emacs has such a function already build-in. Where?
>
> The function may be placed in .emacs profile with hard
> coded number of chars , e.g.  40
>
> tia
> Eckard
>
>

You are talking about filling, eval this with C-x C-e:  (info "(emacs)
Filling") .

Filipp



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

end of thread, other threads:[~2013-07-29  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29  8:51 I need a function that breaks all lines marked at 40 chars gerlach
2013-07-29  9:23 ` Thorsten Jolitz
2013-07-29  9:26 ` Filipp Gunbin

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.