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

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

Operate on each line in region


From: Jacob Gerlach
Subject: Operate on each line in region
Date: Wed, 23 Apr 2014 10:45:35 -0700 (PDT)
User-agent: G2/1.0

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]