From unknown Mon Aug 18 04:43:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21119: comment-dwim should have behavior on active, empty regions Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jul 2015 20:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 21119@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14375974903454 (code B ref -1); Wed, 22 Jul 2015 20:39:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Jul 2015 20:38:10 +0000 Received: from localhost ([127.0.0.1]:56665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZI0mI-0000te-Ca for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33783) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZI0mG-0000tQ-AY for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZI0mF-0001kV-8k for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mF-0001kR-5s for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mD-0005yl-UQ for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZI0mC-0001k4-KV for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:05 -0400 Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:35507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mC-0001jQ-Fp for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:04 -0400 Received: by oihq81 with SMTP id q81so152171233oih.2 for ; Wed, 22 Jul 2015 13:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=IeIMQlXkeMlKoI5+QulCq5tYQiF4ZoArLFAZXNpvbI8=; b=iVedz+gjld9Otzy4UUk+gV+ye9q10/jvTLuw19YVhHUE0PXdmZ7U4N1GUAVq6xrnuY vWsoG3zHsanPQ1TwO57EsZvVDAk2YWADkSEsO0UMKK/vIIfNyWaSnq5oruA7soJ/C2uP ljZwUFgz7epT486CA0QEzj1ZvpgdujszzWW4dMrP47GHnhjbFrJtzOpqWg/h94eba7FM bfdcmUIAqeNupl2IpQXoCVGPxuGchTQrzm7aA/VlQjhNmtrbotwySbjD82whL76U60Qe bkFdcXG1FuDALiqMQ9EUp5ZdhOkBx8zCPBQ9FvLUbyg8OM2fdKwMpIErGw4zD5KgBWiD t6YQ== X-Received: by 10.202.93.66 with SMTP id r63mr4320800oib.5.1437597482153; Wed, 22 Jul 2015 13:38:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.5.6 with HTTP; Wed, 22 Jul 2015 13:37:42 -0700 (PDT) From: Zachary Kanfer Date: Wed, 22 Jul 2015 16:37:42 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This patch is for the function comment-dwim, which is bound to C-; by default. Currently, when the region is not active, comment-dwim puts a comment at the end of the line. When the region is active, comment-dwim comments out the region by calling comment-or-uncomment-region. However, when the region is active, but empty, comment-or-uncomment-region does nothing; no text is inserted. I think this last action (upon active, empty region) is a bug. If the active region is empty, we should insert a comment at the end of the line, as we do when there's no region. This patch calls use-region-p to detect whether the region is active, rather than checking mark-active transient-mark-mode explicitly. The effect of this is, when the region is active, but empty, comment-dwim now acts as though the region was not active -- it puts a comment at the end of the line. Use-region-p does do the previous behavior (of checking mark-active and transient-mark-mode) by calling region-active-p. The patch follows: >From 6bdd96b07775c5c2fd0f3d6595b6655b4093dcf2 Mon Sep 17 00:00:00 2001 From: Zachary Kanfer Date: Mon, 20 Jul 2015 01:36:56 -0400 Subject: [PATCH] Make comment-dwim treat empty regions as inactive. When the region is active, but is empty (length 0), comment-dwim now acts as though the region was not active; that is, it puts a comment at the end of the line. --- lisp/newcomment.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 172a563..8d17a69 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1266,7 +1266,7 @@ Else, call `comment-indent'. You can configure `comment-style' to change the way regions are commented." (interactive "*P") (comment-normalize-vars) - (if (and mark-active transient-mark-mode) + (if (use-region-p) (comment-or-uncomment-region (region-beginning) (region-end) arg) (if (save-excursion (beginning-of-line) (not (looking-at "\\s-*$"))) ;; FIXME: If there's no comment to kill on this line and ARG is -- 1.9.1 From unknown Mon Aug 18 04:43:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21119: comment-dwim should have behavior on active, empty regions References: In-Reply-To: Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Aug 2015 05:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 21119@debbugs.gnu.org Received: via spool by 21119-submit@debbugs.gnu.org id=B21119.144056595331732 (code B ref 21119); Wed, 26 Aug 2015 05:13:02 +0000 Received: (at 21119) by debbugs.gnu.org; 26 Aug 2015 05:12:33 +0000 Received: from localhost ([127.0.0.1]:38488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUT0j-0008Fk-2o for submit@debbugs.gnu.org; Wed, 26 Aug 2015 01:12:33 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:34210) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUT0g-0008Fa-2M for 21119@debbugs.gnu.org; Wed, 26 Aug 2015 01:12:31 -0400 Received: by oiey141 with SMTP id y141so114694159oie.1 for <21119@debbugs.gnu.org>; Tue, 25 Aug 2015 22:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=w/CFi+rNbdpiaSeUaof85EaFs78eQSWorRnrUsJaRcU=; b=i9ckgOtdoVlRp8MRkWhIw31w4FbpVkDh9YfVgIHT+4mbXEg9zHyvHiawf5pzDAKAm1 3KuZa2+U65C147TTpNzsoKDJIdB73DJwzm3xjLQXPGbrxnef8X6eiYoFKVU2xfrI0vn3 hM3svXlrwOCqjLM8rk8wsYZpgMKuLATBNUjZnzJsfsUmz4A5U9GlGkNCF5e/3kYkO+ah rClfqFOkbU0/TSzAqwzUKzeG+alLDfbUBVumIMlZE4rx4sXzjm6eLyNdfeJ+U9RGxCwg a31L6jZbkQxW/LZ1wuNSrHEBvAhZ9jlBm3vEXFoKUZkczuMdMo5Tr/KQMjFTLQYvjR+c BbXA== X-Received: by 10.202.52.196 with SMTP id b187mr15451080oia.105.1440565949367; Tue, 25 Aug 2015 22:12:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.0.45 with HTTP; Tue, 25 Aug 2015 22:12:10 -0700 (PDT) From: Zachary Kanfer Date: Wed, 26 Aug 2015 01:12:10 -0400 Message-ID: Content-Type: multipart/alternative; boundary=001a113cc516b009dc051e2fe5de X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a113cc516b009dc051e2fe5de Content-Type: text/plain; charset=UTF-8 Is there anything I can do to make it easier to look at this patch? --001a113cc516b009dc051e2fe5de Content-Type: text/html; charset=UTF-8
Is there anything I can do to make it easier to look at this patch?
--001a113cc516b009dc051e2fe5de-- From unknown Mon Aug 18 04:43:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21119: comment-dwim should have behavior on active, empty regions Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Aug 2015 10:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Zachary Kanfer Cc: 21119@debbugs.gnu.org Reply-To: bruce.connor.am@gmail.com Received: via spool by 21119-submit@debbugs.gnu.org id=B21119.144075652412001 (code B ref 21119); Fri, 28 Aug 2015 10:09:01 +0000 Received: (at 21119) by debbugs.gnu.org; 28 Aug 2015 10:08:44 +0000 Received: from localhost ([127.0.0.1]:40819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVGaS-00037V-Ho for submit@debbugs.gnu.org; Fri, 28 Aug 2015 06:08:44 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:34666) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVGaQ-00037M-Ft for 21119@debbugs.gnu.org; Fri, 28 Aug 2015 06:08:43 -0400 Received: by laba3 with SMTP id a3so29286507lab.1 for <21119@debbugs.gnu.org>; Fri, 28 Aug 2015 03:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=II5VRhrHpUDL0R9IpURytsUI12Qp0B19cQrmPLValts=; b=d+SSNwQJcdDtNGGZkS8F6+1yV8FuOS3eVO1R38MUZ1EiBu/czqpH+AXjQuxUeQYmqU JIPzBH3I2EKccrOgaUykLvhPe1NSHNy78A+3FtO3l0/hp43JjJYeWMkhQYumArk9t6yM UpTQZUVqu37WvcmnSCRDKgZ3vsv9AA25brBbZgsIgCdDnniZD2zj3oDGmZZnKaQGN8A+ qaSqslMYC5dQJYUGcHxTJeIIqYPMDNbcUUEPmPiUF13B1dBgvUxV7D5D6kSydFHjLc9N nRCOvvFlNIitV/0NfVEVKdd8PwHhyRmWS8A0T2AolySh5NqidwSMjgwvFluriGW2gyX5 J8GQ== MIME-Version: 1.0 X-Received: by 10.112.205.6 with SMTP id lc6mr4308225lbc.95.1440756521760; Fri, 28 Aug 2015 03:08:41 -0700 (PDT) Received: by 10.25.213.202 with HTTP; Fri, 28 Aug 2015 03:08:41 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Aug 2015 11:08:41 +0100 X-Google-Sender-Auth: 6RZMSYwF5uw1s_rqe47qmHTDxck Message-ID: From: Artur Malabarba Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Looks reasonable. If nobody opposes I'll apply it tomorrow. 2015-08-26 6:12 GMT+01:00 Zachary Kanfer : > Is there anything I can do to make it easier to look at this patch? From unknown Mon Aug 18 04:43:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21119: comment-dwim should have behavior on active, empty regions Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Aug 2015 22:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: bruce.connor.am@gmail.com Cc: 21119@debbugs.gnu.org Received: via spool by 21119-submit@debbugs.gnu.org id=B21119.144097309032631 (code B ref 21119); Sun, 30 Aug 2015 22:19:01 +0000 Received: (at 21119) by debbugs.gnu.org; 30 Aug 2015 22:18:10 +0000 Received: from localhost ([127.0.0.1]:43153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWAvS-0008UD-7s for submit@debbugs.gnu.org; Sun, 30 Aug 2015 18:18:10 -0400 Received: from mail-ob0-f179.google.com ([209.85.214.179]:34220) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWAvQ-0008U6-E4 for 21119@debbugs.gnu.org; Sun, 30 Aug 2015 18:18:09 -0400 Received: by obbfr1 with SMTP id fr1so80472020obb.1 for <21119@debbugs.gnu.org>; Sun, 30 Aug 2015 15:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=nGkvTmOj9EUKaVHJuxMbPWti1pEAPaxabD9YdRwKnxQ=; b=JCLano15R3qew0JGbZdvIwNqz+yHuGuWLY54McWdYML3x4AOls6/dx79BTnnfuqFWX IaFQAUPJC16xurK/p26AHKC03ygBJRHeBL/Z5k2Di0UldLZgBvEU2yhVBmPivYpaykp8 XSWMnVzBfNeFH59//222Dn9HI3VU1nEzP5igSreaoGBoHFfreo9BsusxalydehoQb2PC BPdJGEYDxFwt19l+cGXGKrm/YcVyo/068cfXcU0n6yaj+FQMGL/0fOceb98CvepDrl38 3rNl0+YZxj6qq22MgXFjtdCf8VEsMWpYBgd/Jd4TfMCh0IXEsQkmUMi9D+hAvYqceoMb zpvw== X-Received: by 10.182.87.69 with SMTP id v5mr11277447obz.37.1440973087826; Sun, 30 Aug 2015 15:18:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.0.45 with HTTP; Sun, 30 Aug 2015 15:17:48 -0700 (PDT) In-Reply-To: References: From: Zachary Kanfer Date: Sun, 30 Aug 2015 18:17:48 -0400 Message-ID: Content-Type: multipart/alternative; boundary=089e013cb83207fe92051e8eb1fa X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e013cb83207fe92051e8eb1fa Content-Type: text/plain; charset=UTF-8 Thanks! On Fri, Aug 28, 2015 at 6:08 AM, Artur Malabarba wrote: > Looks reasonable. If nobody opposes I'll apply it tomorrow. > > 2015-08-26 6:12 GMT+01:00 Zachary Kanfer : > > Is there anything I can do to make it easier to look at this patch? > --089e013cb83207fe92051e8eb1fa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks!

On Fri, Aug 28, 2015 at 6:08 AM, Artur Malabarba <bruce.connor.am@gmail.com> wrote:
Looks reasonable. If nobody opposes I'll apply it tomorrow.

2015-08-26 6:12 GMT+01:00 Zachary Kanfer <zkanfer@gmail.com>:
> Is there anything I can do to make it easier to look at this patch?

--089e013cb83207fe92051e8eb1fa-- From unknown Mon Aug 18 04:43:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Zachary Kanfer Subject: bug#21119: closed (Re: bug#21119: comment-dwim should have behavior on active, empty regions) Message-ID: References: X-Gnu-PR-Message: they-closed 21119 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 21119@debbugs.gnu.org Date: Tue, 01 Sep 2015 02:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1441073882-6287-1" This is a multi-part message in MIME format... ------------=_1441073882-6287-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #21119: comment-dwim should have behavior on active, empty regions which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 21119@debbugs.gnu.org. --=20 21119: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21119 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1441073882-6287-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 21119-done) by debbugs.gnu.org; 1 Sep 2015 02:17:14 +0000 Received: from localhost ([127.0.0.1]:44527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWb8M-0001cT-AJ for submit@debbugs.gnu.org; Mon, 31 Aug 2015 22:17:14 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:35342) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWb8K-0001cL-8Z for 21119-done@debbugs.gnu.org; Mon, 31 Aug 2015 22:17:12 -0400 Received: by lbcbn3 with SMTP id bn3so70500226lbc.2 for <21119-done@debbugs.gnu.org>; Mon, 31 Aug 2015 19:17:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=JpbNCEhLrpkdzwY6xjGDsFnacVm0xKdaNa5CFo4o3hI=; b=idLlPOv9JHBjksawuMpticFzbXiPWl/x/O3X0icNnZfDjvdYsLCWU7xDKj2sqyrq36 8IOqGnxFAFsISkkYKubyfnJuu6v9h/coQ671phUYwgzKX+mPWM6ABRU+aETUsncjau2/ DQkjfRO1dlkzEZqKnMh6MJeGzCouUzq+RN4MT0HMb/bDJiAVBB9CWO8DKyPv3u2i67WN fS1k2zvy1Sn3n49UZAhYj49wxlcRUu+R128TXANNnP2CSyG5ZRcN9COCgbm2erwMbDfS Wfl9VYUb8ld/haQjmbbCAS7jrKSeJ65zysaYqZN3WKVyO3fo/6j4b5yDq1St1vOBBqYn UVNg== MIME-Version: 1.0 X-Received: by 10.112.77.10 with SMTP id o10mr11964864lbw.73.1441073831464; Mon, 31 Aug 2015 19:17:11 -0700 (PDT) Received: by 10.25.213.202 with HTTP; Mon, 31 Aug 2015 19:17:11 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Sep 2015 03:17:11 +0100 X-Google-Sender-Auth: Pjl97bnznWPYys1JTzxjJ2oglWg Message-ID: Subject: Re: bug#21119: comment-dwim should have behavior on active, empty regions From: Artur Malabarba To: Zachary Kanfer Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21119-done Cc: 21119-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: bruce.connor.am@gmail.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Fixed. Just FYI, Zachary. Your patch did not apply. Did you create it with git format-patch? ------------=_1441073882-6287-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Jul 2015 20:38:10 +0000 Received: from localhost ([127.0.0.1]:56665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZI0mI-0000te-Ca for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33783) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZI0mG-0000tQ-AY for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZI0mF-0001kV-8k for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mF-0001kR-5s for submit@debbugs.gnu.org; Wed, 22 Jul 2015 16:38:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mD-0005yl-UQ for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZI0mC-0001k4-KV for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:05 -0400 Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:35507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI0mC-0001jQ-Fp for bug-gnu-emacs@gnu.org; Wed, 22 Jul 2015 16:38:04 -0400 Received: by oihq81 with SMTP id q81so152171233oih.2 for ; Wed, 22 Jul 2015 13:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=IeIMQlXkeMlKoI5+QulCq5tYQiF4ZoArLFAZXNpvbI8=; b=iVedz+gjld9Otzy4UUk+gV+ye9q10/jvTLuw19YVhHUE0PXdmZ7U4N1GUAVq6xrnuY vWsoG3zHsanPQ1TwO57EsZvVDAk2YWADkSEsO0UMKK/vIIfNyWaSnq5oruA7soJ/C2uP ljZwUFgz7epT486CA0QEzj1ZvpgdujszzWW4dMrP47GHnhjbFrJtzOpqWg/h94eba7FM bfdcmUIAqeNupl2IpQXoCVGPxuGchTQrzm7aA/VlQjhNmtrbotwySbjD82whL76U60Qe bkFdcXG1FuDALiqMQ9EUp5ZdhOkBx8zCPBQ9FvLUbyg8OM2fdKwMpIErGw4zD5KgBWiD t6YQ== X-Received: by 10.202.93.66 with SMTP id r63mr4320800oib.5.1437597482153; Wed, 22 Jul 2015 13:38:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.5.6 with HTTP; Wed, 22 Jul 2015 13:37:42 -0700 (PDT) From: Zachary Kanfer Date: Wed, 22 Jul 2015 16:37:42 -0400 Message-ID: Subject: comment-dwim should have behavior on active, empty regions To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This patch is for the function comment-dwim, which is bound to C-; by default. Currently, when the region is not active, comment-dwim puts a comment at the end of the line. When the region is active, comment-dwim comments out the region by calling comment-or-uncomment-region. However, when the region is active, but empty, comment-or-uncomment-region does nothing; no text is inserted. I think this last action (upon active, empty region) is a bug. If the active region is empty, we should insert a comment at the end of the line, as we do when there's no region. This patch calls use-region-p to detect whether the region is active, rather than checking mark-active transient-mark-mode explicitly. The effect of this is, when the region is active, but empty, comment-dwim now acts as though the region was not active -- it puts a comment at the end of the line. Use-region-p does do the previous behavior (of checking mark-active and transient-mark-mode) by calling region-active-p. The patch follows: >From 6bdd96b07775c5c2fd0f3d6595b6655b4093dcf2 Mon Sep 17 00:00:00 2001 From: Zachary Kanfer Date: Mon, 20 Jul 2015 01:36:56 -0400 Subject: [PATCH] Make comment-dwim treat empty regions as inactive. When the region is active, but is empty (length 0), comment-dwim now acts as though the region was not active; that is, it puts a comment at the end of the line. --- lisp/newcomment.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 172a563..8d17a69 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1266,7 +1266,7 @@ Else, call `comment-indent'. You can configure `comment-style' to change the way regions are commented." (interactive "*P") (comment-normalize-vars) - (if (and mark-active transient-mark-mode) + (if (use-region-p) (comment-or-uncomment-region (region-beginning) (region-end) arg) (if (save-excursion (beginning-of-line) (not (looking-at "\\s-*$"))) ;; FIXME: If there's no comment to kill on this line and ARG is -- 1.9.1 ------------=_1441073882-6287-1-- From unknown Mon Aug 18 04:43:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21119: comment-dwim should have behavior on active, empty regions Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Sep 2015 02:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: bruce.connor.am@gmail.com Cc: 21119-done@debbugs.gnu.org Received: via spool by 21119-done@debbugs.gnu.org id=D21119.14410749477926 (code D ref 21119); Tue, 01 Sep 2015 02:36:01 +0000 Received: (at 21119-done) by debbugs.gnu.org; 1 Sep 2015 02:35:47 +0000 Received: from localhost ([127.0.0.1]:44539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWbQI-00023m-Sm for submit@debbugs.gnu.org; Mon, 31 Aug 2015 22:35:47 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:33085) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWbQH-00023e-DE for 21119-done@debbugs.gnu.org; Mon, 31 Aug 2015 22:35:45 -0400 Received: by obcji4 with SMTP id ji4so13471111obc.0 for <21119-done@debbugs.gnu.org>; Mon, 31 Aug 2015 19:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=HfFQ1tAI66yQgT16n+Vjj6U4OlyIOymwU2E7hcXDMCw=; b=VL5lpJyvvRSyk/8larc8PojUf7eFbOVCp+ZXDpq/ug70aks1IprHwrw11I5j6UT89g 6DhGDiE1z47/Eq3En4FeItw+O6kVsRNHDogxcbrKZsFCXr3iZ2Hul+AmQOcwwFk3psNK Dv4ZTRD23cf1IEcTT79RC61XWbNheRsuhD4HVOUk/tiQEvESdzqfrXSkX1bNWeJPSAsN Cy0+5sLyv98BLeh5UT3sTjEOfI1sjCVjbQ0CY5DZT1j625IOOIWXs5mjQZ6J2k7AtY+0 8ob5NiwMwxnboaSIQ2nxcoXyJQpg+YugyUzcyYnfjEBJ26fOtTvDO7FmqmdTdVMXqRdM kmmw== X-Received: by 10.60.131.74 with SMTP id ok10mr14989305oeb.83.1441074944755; Mon, 31 Aug 2015 19:35:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.0.45 with HTTP; Mon, 31 Aug 2015 19:35:25 -0700 (PDT) In-Reply-To: References: From: Zachary Kanfer Date: Mon, 31 Aug 2015 22:35:25 -0400 Message-ID: Content-Type: multipart/alternative; boundary=089e013cbd362d4f99051ea66846 X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e013cbd362d4f99051ea66846 Content-Type: text/plain; charset=UTF-8 Weird. I did use git format-patch. Might it be because I'm using git version 1.9? On Mon, Aug 31, 2015 at 10:17 PM, Artur Malabarba wrote: > Fixed. > > Just FYI, Zachary. Your patch did not apply. Did you create it with > git format-patch? > --089e013cbd362d4f99051ea66846 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Weird. I did use git format-patch. Might it be because I&#= 39;m using git version 1.9?

On Mon, Aug 31, 2015 at 10:17 PM, Artur Malabarba <bruce.connor.am@gmail.com> wrote:
Fixed.

Just FYI, Zachary. Your patch did not apply. Did you create it with
git format-patch?

--089e013cbd362d4f99051ea66846--