unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
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 15:15:52 +0300	[thread overview]
Message-ID: <20161125121552.GA11459@eee.birulevo.net> (raw)
In-Reply-To: <87k2brpyi0.fsf@gmail.com>

On Fri, Nov 25, 2016 at 11:52:55AM +0000, Rodolfo Medina wrote:
> This seems to work:
>
> (defun my-indent-first-line1 ()
>   "Indent the first line of each paragraph"
>   (interactive)
>     (backward-paragraph)
>     (next-line)
>     (insert "        ")
>     (fill-paragraph)
>     )


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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The Shire at this time had hardly any 'government'. Families for the
>>>>>most part managed their own affairs. Growing food and eating it
occupied most of their time. In other matters they were, as a rule,
....
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



  reply	other threads:[~2016-11-25 12:15 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
2016-11-25 11:28   ` Rodolfo Medina
2016-11-25 11:52     ` Rodolfo Medina
2016-11-25 12:15       ` Konstantin Shakhnov [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161125121552.GA11459@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).