[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Indent first line of each paragraph of file in one hit
From: |
Konstantin Shakhnov |
Subject: |
Re: Indent first line of each paragraph of file in one hit |
Date: |
Fri, 25 Nov 2016 13:48:12 +0300 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Thu, Nov 24, 2016 at 03:35:12PM +0000, Rodolfo Medina wrote:
> Suppose you have a large file, in which the first line of each paragraph is
> not
> indented; and want it to be with one single command for the whole file. Is
> that possible, and how?
I'm not great lisp master, but this dirty sketches works (just replace
">>>>" to what you need at the beginning of line):
;; Variant 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-indent-first-line1 ()
"Indent the first line of each paragraph"
(interactive)
(goto-char (point-min))
(while (not (= (point) (point-max)))
(forward-paragraph)
(next-line)
(insert ">>>>")
(fill-paragraph)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(fill-paragraph) - is optional, delete it if you don't want refill
paragraph after inserting
;; Variant 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-indent-first-line2 ()
"Indent the first line of each paragraph"
(interactive)
(replace-regexp "\n\n" "\n\n>>>>" nil (point-min) (point-max)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/24
- Re: Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/24
- Re: Indent first line of each paragraph of file in one hit,
Konstantin Shakhnov <=
- Re: Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/25
- Re: Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/25
- Re: Indent first line of each paragraph of file in one hit, Konstantin Shakhnov, 2016/11/25
- Re: Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/25
- Re: Indent first line of each paragraph of file in one hit, Konstantin Shakhnov, 2016/11/25
- [solved] Re: Indent first line of each paragraph of file in one hit, Rodolfo Medina, 2016/11/25