unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: weber <hugows@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: LISP routines for commenting
Date: Sat, 09 Aug 2008 18:33:06 +0200	[thread overview]
Message-ID: <87proi6tdp.fsf@tux.homenetwork> (raw)
In-Reply-To: <e0b4c0e2-7c83-498d-86c3-89d1454a70ab@f36g2000hsa.googlegroups.com> (weber's message of "Sat, 9 Aug 2008 07:43:11 -0700 (PDT)")

Python-mode provide a command for indenting that is bind to:

C-c # ==> comment
C-u C-c # ==> 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 <hugows@gmail.com> writes:

> On Aug 8, 10:43 pm, "Joel J. Adamson " <adams...@email.unc.edu> wrote:
>> >>>>> "Alex" == Alex Gusarov <alex.m.gusa...@gmail.com> writes:
>>
>>     Alex> Hello,
>>     Alex> I want to implement some lisp functions for the following:
>>     Alex> 1. Insert comment - when mark some lines of code and using it, insert
>>     Alex> ins-comments, like this:
>>
>>     Alex> before:
>>
>>     Alex> l = []
>>     Alex> l.append(1)
>>
>>     Alex> then mark it and use ins-func, after:
>>
>>     Alex> # ins > <username>, <current date and time>
>>     Alex> l = []
>>     Alex> l.append(1)
>>     Alex> # ins < <username>, <current date and time>
>>
>> If I understand correctly, you want to implement some lisp to comment
>> your Python code?  Have you tried Python mode?  There is a commonly used
>> key (M-;) that comments lines and regions --- look up the function
>> "comment-region."  In 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://trashbird1240.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
>

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




  reply	other threads:[~2008-08-09 16:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08  8:36 LISP routines for commenting Alex Gusarov
2008-08-09  1:43 ` Joel J. Adamson 
     [not found] ` <mailman.16147.1218246548.18990.help-gnu-emacs@gnu.org>
2008-08-09 14:43   ` weber
2008-08-09 16:33     ` Thierry Volpiatto [this message]
2008-08-09 16:42       ` Lennart Borgman (gmail)
2008-08-09 17:04         ` Thierry Volpiatto
2008-08-09 17:11           ` Lennart Borgman (gmail)
2008-08-09 17:19             ` Thierry Volpiatto
2008-08-09 17:38               ` Lennart Borgman (gmail)
2008-08-09 18:29                 ` Thierry Volpiatto
2008-08-14  8:07                   ` Alex Gusarov

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=87proi6tdp.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hugows@gmail.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).