[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LISP routines for commenting

From: Alex Gusarov
Subject: Re: LISP routines for commenting
Date: Thu, 14 Aug 2008 15:07:40 +0700

Thanks to everebody, I just returned from buisness trip and read your answers.

weber - almost what I wanted, thank you for example, I will modify
your example for my needs.

On Sun, Aug 10, 2008 at 1:29 AM, Thierry Volpiatto
<address@hidden> wrote:
> "Lennart Borgman (gmail)" <address@hidden> writes:
>> Thierry Volpiatto wrote:
>>> "Lennart Borgman (gmail)" <address@hidden> writes:
>>>> Thierry Volpiatto wrote:
>>>>> "Lennart Borgman (gmail)" <address@hidden> writes:
>>>>>> Thierry Volpiatto wrote:
>>>>>>> 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.
>>>>>> Do you mean that this is a bug in the support for M-; in phyton-mode?
>>>>>> Or is it a bug in M-;
>>>>> I don't think it's a bug, it's just better to comment with the proper
>>>>> function in python, especially if there is complex level of indentation
>>>>> (loop followed with other loop and if if if...etc).
>>>> But isn't there a bug somewhere if M-; does not do the right thing?
>>> Well, if emacs is meant to use python with python.el and it is working
>>> fine with it, it is not a bug, but if M-; don't work properly with
>>> python.el, yes, it is a bug!
>> Don't you think that all major modes should support M-;? There are
>> easy ways to do that. The doc strings says
>> (comment-dwim arg)
>> Call the comment command you want (Do What I Mean).
>> If the region is active and `transient-mark-mode' is on, call
>>   `comment-region' (unless it only consists of comments, in which
>>   case it calls `uncomment-region').
>> Else, if the current line is empty, call `comment-insert-comment-function'
>> if it is defined, otherwise insert a comment and indent it.
>> Else if a prefix arg is specified, call `comment-kill'.
>> Else, call `comment-indent'.
>> You can configure `comment-style' to change the way regions are commented.
> Yes, i think that is enabled and working (indenting a comment block).
> That is not working always correctly is indenting code after a block of
> comment if this comment is commented with M-;. May be it's only because
> M-; comment with only one # with no space in front.
> Sure it can be corrected, i never ask myself about that as i use C-c #
> in python.
> --
> A + Thierry Volpiatto
> Location: Saint-Cyr-Sur-Mer - France

Best regards, Alex Gusarov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]