From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: weber Newsgroups: gmane.emacs.help Subject: Re: LISP routines for commenting Date: Sat, 9 Aug 2008 07:43:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1218296470 6710 80.91.229.12 (9 Aug 2008 15:41:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2008 15:41:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 09 17:42:01 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KRqZp-0000K4-3b for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 17:41:57 +0200 Original-Received: from localhost ([127.0.0.1]:50883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRqYs-0000Bl-8I for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 11:40:58 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f36g2000hsa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: 189.32.111.130 Original-X-Trace: posting.google.com 1218292991 20528 127.0.0.1 (9 Aug 2008 14:43:11 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 9 Aug 2008 14:43:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f36g2000hsa.googlegroups.com; posting-host=189.32.111.130; posting-account=7GrjgQoAAAD6slWURausdJnhFDkmQYC8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:161013 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56360 Archived-At: On Aug 8, 10:43=A0pm, "Joel J. Adamson " wrote: > >>>>> "Alex" =3D=3D Alex Gusarov writes: > > =A0 =A0 Alex> Hello, > =A0 =A0 Alex> I want to implement some lisp functions for the following: > =A0 =A0 Alex> 1. Insert comment - when mark some lines of code and using = it, insert > =A0 =A0 Alex> ins-comments, like this: > > =A0 =A0 Alex> before: > > =A0 =A0 Alex> l =3D [] > =A0 =A0 Alex> l.append(1) > > =A0 =A0 Alex> then mark it and use ins-func, after: > > =A0 =A0 Alex> # ins > , > =A0 =A0 Alex> l =3D [] > =A0 =A0 Alex> l.append(1) > =A0 =A0 Alex> # ins < , > > If I understand correctly, you want to implement some lisp to comment > your Python code? =A0Have you tried Python mode? =A0There is a commonly u= sed > key (M-;) that comments lines and regions --- look up the function > "comment-region." =A0In each programming language mode, this function > inserts the proper comments for the language you are using (e.g., ";" > for lisp and "#" for Python, Perl, et al). > > Please be specific if you want something else. > > Joel > > -- > Joel J. Adamson > (303) 880-3109 > Public key:http://pgp.mit.eduhttp://www.unc.edu/~adamsonjhttp://trashbird= 1240.blogspot.com Alex, is this what you want? (defun ins-comment (beg end) (interactive "r") (let ((str (concat user-login-name ", " (format-time-string "%d/%m/ %y %Hh%Mmin")))) (goto-char end) (insert "# ins < " str) (goto-char beg) (insert "# ins > " str "\n"))) HTH, hugo