unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Operate on each line in region
@ 2014-04-23 17:45 Jacob Gerlach
  2014-04-23 18:03 ` Doug Lewan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jacob Gerlach @ 2014-04-23 17:45 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-04-26  3:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 17:45 Operate on each line in region Jacob Gerlach
2014-04-23 18:03 ` Doug Lewan
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

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).