help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs indent function


From: Rodolfo Medina
Subject: Re: Emacs indent function
Date: Fri, 25 Nov 2016 14:02:00 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Константин <kastian@mail.ru> writes:

> Hello Rodolfo.
>
> There is some strange troubles with list, so send the ansver directly.
>
>>> Yes, I've just made something similar. But there is a trap - if your
>>> file doesn't starts with '\n' you'll get wrong indentation of the
>>> first paraghaph
>> Yes, I see.  No way to avoid that?
>
> (defun my-indent-first-line ()
>   "Indent the first line of current paragraph"
>   (interactive)
>   (backward-paragraph)
>   (if (= (line-beginning-position) (line-end-position))
>       (next-line))
>   (insert ">>>>")
>   (fill-paragraph))
>
>
> PS If you want to store cursor position you can use
>
> (defun my-indent-first-line ()
>   "Indent the first line of current paragraph"
>   (interactive)
>   (save-excursion             ; <- this
>     (backward-paragraph)
>     (if (= (line-beginning-position) (line-end-position))
>       (next-line))
>     (insert ">>>>")
>     (fill-paragraph)))


Fine, thanks.  But what about doing that over the whole file in one single hit?

Cheers,

Rodolfo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]