unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: Jacob Gerlach <jacobgerlach@gmail.com>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: Operate on each line in region
Date: Wed, 23 Apr 2014 18:03:00 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9892A75EC5@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <787a28ce-2ab1-4b11-92fd-ca4506447baa@googlegroups.com>

Jacob,

There are a whole bunch of `align' commands that might be worth looking at.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

Of course, shells have one feature that no other language has: subshells.

> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Jacob Gerlach
> Sent: Wednesday, 2014 April 23 13:46
> To: help-gnu-emacs@gnu.org
> Subject: Operate on each line in region
> 
> I am writing a function that will indent each line in a region to
> justify equals signs:
> 
>  foo = 1
>  longerfoo = bar
> 
> Would become
> 
>        foo = 1
>  longerfoo = bar
> 
> I believe I understand how to iterate through the lines in a region
> using either of two methods:
> 
> condition on the buffer positions for the start and end of the region:
> 
> (defun my-justify (start end)
> (interactive 'r')
> (while (< (point) end))
> ...body...
> (forward-line 1)))
> 
> Narrow the buffer to region and use similar conditioning with (eobp).
> 
> I'm wondering if there is a more straightforward way to accomplish
> this.
> 
> Thanks for any suggestions.
> Jake



  reply	other threads:[~2014-04-23 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 17:45 Operate on each line in region Jacob Gerlach
2014-04-23 18:03 ` Doug Lewan [this message]
2014-04-23 18:05 ` Stefan Monnier
2014-04-23 18:15 ` Pascal J. Bourguignon
     [not found] ` <mailman.20129.1398276348.10748.help-gnu-emacs@gnu.org>
2014-04-23 19:06   ` Barry Margolin
2014-04-23 19:18     ` Jacob Gerlach
2014-04-23 23:23       ` Jacob Gerlach
2014-04-23 23:44         ` Barry Margolin
2014-04-26  3:02           ` Jacob Gerlach

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=155DEC68569B714B86C2C7075F5EDA9892A75EC5@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=jacobgerlach@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).