From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: PEDRO ANDRES ARANDA GUTIERREZ Newsgroups: gmane.emacs.devel Subject: Re: Just a thought about comment-line Date: Mon, 1 Jun 2020 07:29:38 +0200 Message-ID: References: <306c7cf5-6cfc-436e-a902-8ad4560b32d1@default> <47fc942f-62e1-4efc-9d67-db292177044e@default> <608b0cf8-ee1b-4c16-b15c-2eb7ac56d652@default> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000691b8105a6ff15a8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="27082"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuri Khan , emacs-devel@gnu.org, Dmitry Gutov To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 01 07:30:29 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfd1o-0006wa-MX for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Jun 2020 07:30:28 +0200 Original-Received: from localhost ([::1]:59872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfd1n-0008Uu-OQ for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Jun 2020 01:30:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfd1F-00084K-VQ for emacs-devel@gnu.org; Mon, 01 Jun 2020 01:29:53 -0400 Original-Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:46107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfd1E-0007fY-0l for emacs-devel@gnu.org; Mon, 01 Jun 2020 01:29:53 -0400 Original-Received: by mail-lj1-x230.google.com with SMTP id z6so6495094ljm.13 for ; Sun, 31 May 2020 22:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=it.uc3m.es; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WxNlSNcxLt44Q/eBZhembY7P6cWaR4BBVdIkCa1AaAQ=; b=a11WEbVw2wLJ9uVpul4A5F/rRMQLlezOepIXclvmwQrg3WJIdTDV9qnDb6cl5lvp7k +AEv3yMCLXkFCl6pu6XFSEMcO+SZ2IJ50rMKWORffze7aDLW2BXQfTbpd2kdUkxHuZCO Jazh47p7iy8myqIfnqbVY6et3Q+Ri+NTgTS+/LgQyZF5opC/VUAhMY1amz1iLbEzCTw+ /H5sT8PQsavai6Hn77mwqNCSpzeRwX8q6aK4bzGSXOiAAcMkHYvips6PIjqOfzwjAGhH 7r3kGNvlLUT8rsycIP/ESLlddqyApCH5kpQnD3rzMjkPx51swg6juYOZGguJpaY16PWf YL3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WxNlSNcxLt44Q/eBZhembY7P6cWaR4BBVdIkCa1AaAQ=; b=l6jgsimhSA9hlWAEIjpKn7MBgnxl/vQf/edQqxi1ZHMzFAh+/yn1GO5dvGOCTn/dss mhxEIlJdFOWATGU2wZobahucrjAFkvAWluQ6Q4kW5UESkEv2hk7ye/qaJKYaAIXbhHs6 IVCMomwsfwy1WUhwH4YrSbFsUTQfskwdhE8DunsYjon+Kk38n6Mn+4JPs59LwqFiHjVn i1xmsCnJwdPqRIlJaLAwoYdTD4ZEESOUHHgClpRgPZU30SviPOkiO79WST/LgJx9Bjb4 DTnz1GXWqOymKFOugJNNfm8kAgqqJmitqs0HIn2r+koFaX4gYQxSAmBzG4lqt7a6d4I6 3eCg== X-Gm-Message-State: AOAM532yo9UP6nH51u93Ri/nI0UmnqdbfDDfA7ScA9YXi6DtWea1mLru PsEw7A+Az+7P+Ep9w4r0k6WnEzESFDseXZ8Hq0/3QQ== X-Google-Smtp-Source: ABdhPJwOOk4p5r/aN4xToywPuWSBx7aBkwGXr+ICrMN2Bgfidtou75+MWye9QStSsRpKnJxoc1PbdSFUVGaGHVoEe4s= X-Received: by 2002:a2e:a48d:: with SMTP id h13mr9788260lji.120.1590989389622; Sun, 31 May 2020 22:29:49 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=paranda@it.uc3m.es; helo=mail-lj1-x230.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251710 Archived-At: --000000000000691b8105a6ff15a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable And BTW, my code looks like: (defun my-comment-line-region (beg end) "Comment all complete lines in a region using comment-line if the region does not start at a beginning of line, expand it" (interactive "r") (save-excursion (save-restriction (narrow-to-region (get-bol beg) end) (push-mark (point-min)) (goto-char (point-max)) (call-interactively 'comment-line) (pop-mark)))) It seems that narrowing helps avoiding that last comment. Don't know how much of an overkill this might be, but it works for me(tm) Best PA El lun., 1 jun. 2020 a las 7:18, PEDRO ANDRES ARANDA GUTIERREZ (< paranda@it.uc3m.es>) escribi=C3=B3: > Hey, > > thanks for all the answers so far. It's nice to see people getting > passionate about this. > I too had my code to deal with (bol-p end-of-region) and I'm passing it o= n > to people, > but I started writing a short introduction for students who get intereste= d > in Emacs by > seeing how I use it and well, it'd be so much better for Emacs if I could > get one of the > FAQ answered by something like 'customise variable so-and-so to get your > desired > behaviour' instead of 'include in your .emacs.d/functions.e= l > and bind function > sensible-comment-lines to M-;' > > I hope the discussion crystallises in some better future :-) > > Best, /PA > PS: and as my signature translates ;-) "questions exist to be made, not t= o > be answered" > > El dom., 31 may. 2020 a las 23:54, Drew Adams () > escribi=C3=B3: > >> > > You're fairly sure for whom? For you? Not for me. >> > >> > The only complaints against comment-dwim I have seen >> >> I wasn't complaining about `comment-dwim'. >> I was saying that it's not the be-all and >> end-all. I use it for end-of-line comments. >> And I use something else for block commenting. >> >> It doesn't matter to me if you use `M-;' for >> everything. If you're happy that way, great. >> >> > were along the lines "I want to micromanage >> > how comments are made", >> >> I see. If someone says your one-size-fits-all >> dream command doesn't fit all then their idea >> for doing something additional or different >> just wastes your time. Sorry to hear that. >> >> > and not "this code-writing scenario becomes >> > suboptimal". >> > >> > Are you still writing code? I'm surprised, >> >> Surprise! And irrelevant. >> >> > > Tell me why Common Lisp behavior for block comments >> > > (#|...|#) is missing? I don't mean that those macro >> > > chars are missing, but that the block-commenting >> > > behavior (nesting, unnesting) is missing. >> > >> > You might want to elaborate. >> >> I think I did. Maybe you can show us how >> `comment-dwim' provides the same behavior. >> >> > It definitely can create nested comments (i.e. in >> > the cases they are really needed, when you call it >> > on a region containing both commented and >> > non-commented lines). >> >> A bit of a tautology. I can leap over buildings >> in a single bound, in the cases where that's >> really needed, which is when the buildings are >> at most 1-foot tall. >> >> Anyway. The point of this thread is the problem >> with `comment-line' raised by the OP. If you're >> curious why `comment-line' was added, since we >> already had `comment-dwim', see the thread I >> pointed to, where `comment-line' was discussed >> and added. >> > > > -- > --- > PEDRO ANDRES ARANDA GUTIERREZ > Universidad Carlos III de Madrid > > "Fragen sind nicht da um beantwortet zu werden. > Fragen sind da, um gestellt zu werden" Georg Kreisler > --=20 --- PEDRO ANDRES ARANDA GUTIERREZ Universidad Carlos III de Madrid "Fragen sind nicht da um beantwortet zu werden. Fragen sind da, um gestellt zu werden" Georg Kreisler --000000000000691b8105a6ff15a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
And BTW, my code looks like:

(defun my-comment-line-region (beg e= nd)
=C2=A0 "Comment all complete lines in a region using comment-li= ne
if the region does not start at a beginning of line, expand it"<= br>=C2=A0 (interactive "r")
=C2=A0 (save-excursion
=C2=A0= =C2=A0 (save-restriction
=C2=A0=C2=A0 (narrow-to-region (get-bol beg) = end)
=C2=A0=C2=A0 (push-mark (point-min))
=C2=A0=C2=A0 (goto-char= (point-max))
=C2=A0=C2=A0 (call-interactively 'comment-line)
= =C2=A0=C2=A0 (pop-mark))))

It seems that n= arrowing helps avoiding that last comment. Don't know how much of an ov= erkill this might be, but
it works for me(tm)

=
Best PA

El lun., 1 jun. 2020 a las 7:18, PEDRO ANDRES= ARANDA GUTIERREZ (<paranda@it.uc3= m.es>) escribi=C3=B3:
Hey,

thanks for= all the answers so far. It's nice to see people getting passionate abo= ut this.
I too had my code to deal with (bol-p end-of-region) and= I'm passing it on to people,
but I started writing a short i= ntroduction for students who get interested in Emacs by
seeing ho= w I use it and well, it'd be so much better for Emacs if I could get on= e of the
FAQ answered by something like 'customise variable s= o-and-so to get your desired
behaviour' instead of 'inclu= de <listing 100> in your .emacs.d/functions.el and bind function
sensible-comment-lines to M-;'

I hop= e the discussion crystallises in some better future :-)

Best, /PA
PS: and as my signature translates ;-) "ques= tions exist to be made, not to be answered"

El dom., 31 may. = 2020 a las 23:54, Drew Adams (<drew.adams@oracle.com>) escribi=C3=B3:
> > You're fairly= sure for whom?=C2=A0 For you?=C2=A0 Not for me.
>
> The only complaints against comment-dwim I have seen

I wasn't complaining about `comment-dwim'.
I was saying that it's not the be-all and
end-all.=C2=A0 I use it for end-of-line comments.
And I use something else for block commenting.

It doesn't matter to me if you use `M-;' for
everything.=C2=A0 If you're happy that way, great.

> were along the lines "I want to micromanage
> how comments are made",

I see.=C2=A0 If someone says your one-size-fits-all
dream command doesn't fit all then their idea
for doing something additional or different
just wastes your time.=C2=A0 Sorry to hear that.

> and not "this code-writing scenario becomes
> suboptimal".
>
> Are you still writing code? I'm surprised,

Surprise!=C2=A0 And irrelevant.

> > Tell me why Common Lisp behavior for block comments
> > (#|...|#) is missing?=C2=A0 I don't mean that those macro
> > chars are missing, but that the block-commenting
> > behavior (nesting, unnesting) is missing.
>
> You might want to elaborate.

I think I did.=C2=A0 Maybe you can show us how
`comment-dwim' provides the same behavior.

> It definitely can create nested comments (i.e. in
> the cases they are really needed, when you call it
> on a region containing both commented and
> non-commented lines).

A bit of a tautology.=C2=A0 I can leap over buildings
in a single bound, in the cases where that's
really needed, which is when the buildings are
at most 1-foot tall.

Anyway.=C2=A0 The point of this thread is the problem
with `comment-line' raised by the OP.=C2=A0 If you're
curious why `comment-line' was added, since we
already had `comment-dwim', see the thread I
pointed to, where `comment-line' was discussed
and added.


--
---
PEDRO ANDRES ARANDA GUTIERREZ
Universidad Ca= rlos III de Madrid

"Fragen sind nicht da um b= eantwortet zu werden.
Fragen sind da, um gestellt zu werden"= Georg Kreisler


--
---
PEDRO ANDRES ARANDA GUT= IERREZ
Universidad Carlos III de Madrid

"F= ragen sind nicht da um beantwortet zu werden.
Fragen sind da, um = gestellt zu werden" Georg Kreisler
--000000000000691b8105a6ff15a8--