|
From: | Chong Yidong |
Subject: | Re: Wrap around and comment function |
Date: | Mon, 28 Nov 2005 23:21:44 -0500 |
User-agent: | Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Harry Putnam <reader@newsguy.com> writes: > I'm hoping there is something that does what I describe below > somewhere in a repository. Or at least something that is close enough > to allow a (seriously) lisp challenged emacs user to get this from it. > > I'd like a function that acts on region by inserting a line like this > above region: > > # [HP DATE - NOTE: <Here I get queried for a few words then <RET>> > # Then region is commented > # with whatever comment style > # is dictated by mode. > # Finally insert a line below region like: > # ==* END HP NOTE *== ] Probably something like this: (defun foo (beg end string) (interactive "*r\nsEnter a few words: ") (let ((fin (copy-marker end))) (goto-char beg) (insert "[HP DATE - NOTE: " string "\n") (goto-char (marker-position fin)) (set-marker fin nil) (insert "\n==* END HP NOTE *== ]\n") (comment-region beg (point))))
[Prev in Thread] | Current Thread | [Next in Thread] |