On Sun, 2002-08-11 at 04:01, Vasily Korytov wrote:
I've just wrote a comment-region-or-line function (analogically
to
upcase-region-or-word, except for argument threating), I think it's
useful as a keyboard shortcut. And I'm happy to contribute it back to
the wonderful editor XEmacs. =))
(defun comment-region-or-line (arg)
"Comment the selected region or the following line."
(interactive "p")
(if (region-active-p)
(comment-region (region-beginning) (region-end) arg)
(comment-region (line-beginning-position) (line-end-position) arg)))
Thanks, that looks useful. However line-(beginning|end)-position only
exists in XEmacs >= 21.5.7, so they'd have to be replaced with
point-at-bol and point-at-eol for cross version compatibility.
I'm thinking about including this in some of the XEmacs packages, maybe
xemacs-base or edit-utils. Suggestions welcome, about the package, and
the target .el (or should it be put into a new file)...
--
\/ille Skyttä
ville.skytta at iki.fi