unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: PEDRO ANDRES ARANDA GUTIERREZ <paranda@it.uc3m.es>
To: Drew Adams <drew.adams@oracle.com>
Cc: Yuri Khan <yuri.v.khan@gmail.com>,
	emacs-devel@gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: Just a thought about comment-line
Date: Mon, 1 Jun 2020 07:29:38 +0200	[thread overview]
Message-ID: <CAPoMwp16mWu-PUQnABggPmp9V+ezxWaSpSdC3fj=RXfRe4kTnQ@mail.gmail.com> (raw)
In-Reply-To: <CAPoMwp01+3LFu14OHOGQY9skJNogS9y+Lp++PCpfhdntDtqMvA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3832 bytes --]

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ó:

> 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 on
> to people,
> but I started writing a short introduction for students who get interested
> 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 <listing 100> in your .emacs.d/functions.el
> 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 to
> be answered"
>
> El dom., 31 may. 2020 a las 23:54, Drew Adams (<drew.adams@oracle.com>)
> escribió:
>
>> > > 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
>


-- 
---
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

[-- Attachment #2: Type: text/html, Size: 5231 bytes --]

  reply	other threads:[~2020-06-01  5:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31  7:39 Just a thought about comment-line PEDRO ANDRES ARANDA GUTIERREZ
2020-05-31  9:57 ` Yuri Khan
2020-05-31 16:58   ` Drew Adams
2020-05-31 17:15     ` Stefan Monnier
2020-05-31 18:05       ` Drew Adams
2020-05-31 19:05         ` Stefan Monnier
2020-05-31 21:53           ` Drew Adams
2020-05-31 17:42     ` Dmitry Gutov
2020-05-31 18:08       ` Drew Adams
2020-05-31 18:31         ` Dmitry Gutov
2020-05-31 21:54           ` Drew Adams
2020-06-01  5:18             ` PEDRO ANDRES ARANDA GUTIERREZ
2020-06-01  5:29               ` PEDRO ANDRES ARANDA GUTIERREZ [this message]
2020-05-31 14:40 ` Eli Zaretskii
2020-05-31 16:53 ` Drew Adams
2020-06-01  6:14 ` Clément Pit-Claudel

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='CAPoMwp16mWu-PUQnABggPmp9V+ezxWaSpSdC3fj=RXfRe4kTnQ@mail.gmail.com' \
    --to=paranda@it.uc3m.es \
    --cc=dgutov@yandex.ru \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=yuri.v.khan@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).