From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: LISP routines for commenting Date: Sat, 09 Aug 2008 18:33:06 +0200 Message-ID: <87proi6tdp.fsf@tux.homenetwork> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1218299795 15001 80.91.229.12 (9 Aug 2008 16:36:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2008 16:36:35 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: weber Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 09 18:37:26 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 1KRrRV-0006vv-OF for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 18:37:26 +0200 Original-Received: from localhost ([127.0.0.1]:40712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRrQZ-0004zS-3J for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 12:36:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KRrQG-0004zN-6S for help-gnu-emacs@gnu.org; Sat, 09 Aug 2008 12:36:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KRrQD-0004zA-QB for help-gnu-emacs@gnu.org; Sat, 09 Aug 2008 12:36:07 -0400 Original-Received: from [199.232.76.173] (port=60553 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRrQD-0004z7-Jo for help-gnu-emacs@gnu.org; Sat, 09 Aug 2008 12:36:05 -0400 Original-Received: from nf-out-0910.google.com ([64.233.182.184]:28490) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KRrQC-0005SP-JU for help-gnu-emacs@gnu.org; Sat, 09 Aug 2008 12:36:05 -0400 Original-Received: by nf-out-0910.google.com with SMTP id c7so532609nfi.26 for ; Sat, 09 Aug 2008 09:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=H/L36fZU9oIPNO0x42weG2qETHjmlIAg9EeoN8qBcgI=; b=qrKa8c8Opy2t+pjetlxgZXy1a9pbGMdS+tvEOkhKH/M+S57XIXwMZc9MBGfq2Imx4V FGZY4Q6yi72yDJj9rk9DZeGYFAWuHutrCa5bAMJrh8JmN2NNdXtfUKO+QdvapMoxQlGd SDrh/VxvW0N66QeAM/Mk7rvQZ2DjnpB2HXxRU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; b=RKN6Isnzby9c2q60+mIyLjDNGOuyPgvZvhYCwdrILtUvYlf/P9ThIoEx8wD6yYOGgH w35V+ns+pspmmG7fVP1D/luj2VdBvlMdxykeRznku4LDGQMxhmK+i9d7e0uC6mdh0xHk Dn0dIqD8aU81mndUSeU2KbxvbTAttzk4lKV24= Original-Received: by 10.210.16.17 with SMTP id 17mr7084947ebp.127.1218299762122; Sat, 09 Aug 2008 09:36:02 -0700 (PDT) Original-Received: from tux.homenetwork ( [77.197.77.142]) by mx.google.com with ESMTPS id y37sm6870093iky.8.2008.08.09.09.36.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 09 Aug 2008 09:36:01 -0700 (PDT) In-Reply-To: (weber's message of "Sat, 9 Aug 2008 07:43:11 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:56365 Archived-At: Python-mode provide a command for indenting that is bind to: C-c # =3D=3D> comment C-u C-c # =3D=3D> uncomment The command is: `py-comment-region' It is better to comment with that instead of the usual M-; because it don't affect indentation after a block of commented code. I don't know if python.el provide the same. weber writes: > On Aug 8, 10:43=C2=A0pm, "Joel J. Adamson " wrot= e: >> >>>>> "Alex" =3D=3D Alex Gusarov writes: >> >> =C2=A0 =C2=A0 Alex> Hello, >> =C2=A0 =C2=A0 Alex> I want to implement some lisp functions for the foll= owing: >> =C2=A0 =C2=A0 Alex> 1. Insert comment - when mark some lines of code and= using it, insert >> =C2=A0 =C2=A0 Alex> ins-comments, like this: >> >> =C2=A0 =C2=A0 Alex> before: >> >> =C2=A0 =C2=A0 Alex> l =3D [] >> =C2=A0 =C2=A0 Alex> l.append(1) >> >> =C2=A0 =C2=A0 Alex> then mark it and use ins-func, after: >> >> =C2=A0 =C2=A0 Alex> # ins > , >> =C2=A0 =C2=A0 Alex> l =3D [] >> =C2=A0 =C2=A0 Alex> l.append(1) >> =C2=A0 =C2=A0 Alex> # ins < , >> >> If I understand correctly, you want to implement some lisp to comment >> your Python code? =C2=A0Have you tried Python mode? =C2=A0There is a com= monly used >> key (M-;) that comments lines and regions --- look up the function >> "comment-region." =C2=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://trashbir= d1240.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 > --=20 A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France