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

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

RE: Operate on each line in region


From: Doug Lewan
Subject: RE: Operate on each line in region
Date: Wed, 23 Apr 2014 18:03:00 +0000

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 via email to

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