From: Chong Yidong <cyd@stupidchicken.com>
Subject: Re: Wrap around and comment function
Date: Mon, 28 Nov 2005 23:21:44 -0500 [thread overview]
Message-ID: <87acfo6q3r.fsf@stupidchicken.com> (raw)
In-Reply-To: 87y838xd9v.fsf@newsguy.com
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))))
next prev parent reply other threads:[~2005-11-29 4:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-29 3:56 Wrap around and comment function Harry Putnam
2005-11-29 4:21 ` Chong Yidong [this message]
2005-11-30 13:55 ` Harry Putnam
2005-11-30 14:36 ` Harry Putnam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87acfo6q3r.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).