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

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

Re: Keep-only-column


From: Marc Tfardy
Subject: Re: Keep-only-column
Date: Fri, 09 Feb 2007 13:49:33 +0100
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

weber schrieb:

Here's a version to apply the function to a region.
If there is a easier way plese tell me!

(defun keep-column-on-region (beg end &optional arg)
  "Apply keep-column over region."
  (interactive "r\np")
  (save-excursion
        (if mark-active
                (let ((beg (region-beginning))
                          (end (copy-marker (region-end))))
                  (goto-char beg)
                  (while (< (point) end)
                        (beginning-of-line)
                        (keep-column arg)
                        (next-line 1))))))

You use interactive "r" which put automatically boundary of region in
beg and end, but you still compute beg (and end) self in you code.
Why?

regards

Marc




reply via email to

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