From: Konstantin Shakhnov <kastian@mail.ru>
To: Rodolfo Medina <rodolfo.medina@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Indent first line of each paragraph of file in one hit
Date: Fri, 25 Nov 2016 13:48:12 +0300 [thread overview]
Message-ID: <20161125104812.GA8781@eee.birulevo.net> (raw)
In-Reply-To: <877f7ssxfz.fsf@gmail.com>
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)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
next prev parent reply other threads:[~2016-11-25 10:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 15:35 Indent first line of each paragraph of file in one hit Rodolfo Medina
2016-11-24 22:44 ` Rodolfo Medina
2016-11-25 10:48 ` Konstantin Shakhnov [this message]
2016-11-25 11:28 ` Rodolfo Medina
2016-11-25 11:52 ` Rodolfo Medina
2016-11-25 12:15 ` Konstantin Shakhnov
2016-11-25 12:20 ` Rodolfo Medina
2016-11-25 12:45 ` Konstantin Shakhnov
2016-11-25 15:39 ` [solved] " Rodolfo Medina
-- strict thread matches above, loose matches on Subject: below --
2016-11-24 20:18 Rodolfo Medina
2016-11-25 11:34 ` Andreas Röhler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161125104812.GA8781@eee.birulevo.net \
--to=kastian@mail.ru \
--cc=help-gnu-emacs@gnu.org \
--cc=rodolfo.medina@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.