From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Will Farrington Newsgroups: gmane.emacs.devel Subject: Re: comment-dwim has no behavior to comment out the current line without a region Date: Wed, 10 Dec 2008 07:22:58 -0500 Message-ID: References: <972C2D7E-3A86-489B-AAE5-17A52B943DB3@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: multipart/alternative; boundary=Apple-Mail-11--651008314 X-Trace: ger.gmane.org 1228911802 14738 80.91.229.12 (10 Dec 2008 12:23:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Dec 2008 12:23:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 10 13:24:27 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LAO77-0000l8-So for ged-emacs-devel@m.gmane.org; Wed, 10 Dec 2008 13:24:26 +0100 Original-Received: from localhost ([127.0.0.1]:58757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAO5w-0000xU-JY for ged-emacs-devel@m.gmane.org; Wed, 10 Dec 2008 07:23:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAO5q-0000xF-4w for emacs-devel@gnu.org; Wed, 10 Dec 2008 07:23:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAO5n-0000wx-JX for emacs-devel@gnu.org; Wed, 10 Dec 2008 07:23:04 -0500 Original-Received: from [199.232.76.173] (port=49581 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAO5n-0000wu-Ce for emacs-devel@gnu.org; Wed, 10 Dec 2008 07:23:03 -0500 Original-Received: from yw-out-1718.google.com ([74.125.46.156]:26874) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAO5m-00023A-VE for emacs-devel@gnu.org; Wed, 10 Dec 2008 07:23:03 -0500 Original-Received: by yw-out-1718.google.com with SMTP id 9so210593ywk.66 for ; Wed, 10 Dec 2008 04:23:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:mime-version:subject:date:references :x-mailer; bh=LDDQAo4erz4L5ePDCa6vgJjQ6FrUX2yzyOTi+6Mo+I8=; b=CI7KX1iXuyi9x3BhO/KvfT5jEt1gLu7RX8it6+bonjtBXjo07a1PxPSoQsskDX93f9 JR6czb4Zsp1tXQ9glDWEj4bndUYBtiDiR9LR2J6bHDeESqLlmGqbaZUogRbKg4uaLWxx zQsUDGVED57JMsCfNfdgimLonE8wv0ezdIW2I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:mime-version:subject :date:references:x-mailer; b=kzeYoyWi42lvMeiY/OUhLB9IBZDKlO74h4nak8ZcT7Z1A66tHDt4PUO2NsHbjteLd8 K+Q7Wqxw6VTHyRQMRIi6m8kTdq/qW4E0px7vm5YH+H2w6XwArUqzjDHUkUwr6GWPzMlt 9O0lM3iPLNeclursCkTbN+6JQ0b0AufKaF6wg= Original-Received: by 10.101.69.10 with SMTP id w10mr995123ank.98.1228911781229; Wed, 10 Dec 2008 04:23:01 -0800 (PST) Original-Received: from lawn-128-61-25-5.lawn.gatech.edu (lawn-128-61-25-5.lawn.gatech.edu [128.61.25.5]) by mx.google.com with ESMTPS id d35sm1113016and.5.2008.12.10.04.22.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Dec 2008 04:23:00 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.929.2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:106746 Archived-At: --Apple-Mail-11--651008314 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On second inspection, C-M-; is not bound by default. How would you feel about binding the following function to that keybinding? (defun comment-dwim-line (&optional arg) "" (interactive "*P") (comment-normalize-vars) (if (not (region-active-p)) (comment-or-uncomment-region (line-beginning-position) (line- end-position)) (comment-dwim arg))) Obviously a better description than "" is needed, but the behavior of this has changed a bit since it can now afford to (being a different function and keybinding). Rather than relying on the position of (point), it has a clear established behavior of commenting out the current line unless the region is active. On Dec 9, 2008, at 2:48 PM, Stefan Monnier wrote: >> Generally speaking, what makes BOL a "common starting point" to >> perform >> comment-indent more-so than any other part of the line? > > I'm not sure it's much more so, but it's at least as common as > current-indentation, end of line, etc... > >> Additionally, is not BOL semantically the clearest place to run >> comment-dwim >> and expect it to comment out a given line rather than having it run >> comment-indent? > > Could be. I'm not saying your idea isn't good. I'm just saying > that it > is not compatible with the current behavior and that the current > behavior makes sense as well. You may find some other way to combine > comment-indent, comment-kill, and comment-region onto a single key. > E.g. M-; M-; is currently unused. > > > Stefan --Apple-Mail-11--651008314 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
On second inspection, = C-M-; is not bound by default.

How would you = feel about binding the following function to that = keybinding?

defun comment-dwim-line (&optional )
  ""
  interactive = "*P")
  )
  if (not ))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
(arg
On Dec 9, 2008, at 2:48 PM, Stefan = Monnier wrote:

Generally speaking, what = makes BOL a "common starting point" to = perform
comment-indent more-so = than any other part of the line?

I'm not sure it's = much more so, but it's at least as common as
current-indentation, end = of line, etc...

Additionally, is not = BOL semantically the clearest place to run = comment-dwim
and expect it to = comment out a given line rather than having it = run
comment-indent?

Could be.  I'm = not saying your idea isn't good.  I'm just saying that it
is not = compatible with the current behavior and that the current
behavior = makes sense as well.  You may find some other way to = combine
comment-indent, comment-kill, and comment-region onto a = single key.
E.g. M-; M-; is currently unused.


=        Stefan

= --Apple-Mail-11--651008314--