From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#26049: 25.2; Extra lines not added to comment Date: Tue, 28 Mar 2017 22:25:23 -0400 Message-ID: <87h92c3jl8.fsf@users.sourceforge.net> References: <29145.1489153275@localhost> <87r31i2i5a.fsf@users.sourceforge.net> <7171.1490705541@localhost> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490754320 16523 195.159.176.226 (29 Mar 2017 02:25:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Mar 2017 02:25:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 26049@debbugs.gnu.org To: Antonin Houska Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 29 04:25:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ct3II-0002uM-Bm for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Mar 2017 04:25:06 +0200 Original-Received: from localhost ([::1]:56145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct3IO-0004A1-Bk for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Mar 2017 22:25:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct3II-00047O-1T for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2017 22:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ct3IE-00087f-RO for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2017 22:25:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ct3IE-00087X-Mj for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2017 22:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ct3IE-0005qM-Fb for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2017 22:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Mar 2017 02:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26049 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26049-submit@debbugs.gnu.org id=B26049.149075425022398 (code B ref 26049); Wed, 29 Mar 2017 02:25:02 +0000 Original-Received: (at 26049) by debbugs.gnu.org; 29 Mar 2017 02:24:10 +0000 Original-Received: from localhost ([127.0.0.1]:49851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ct3HN-0005pB-WF for submit@debbugs.gnu.org; Tue, 28 Mar 2017 22:24:10 -0400 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:36697) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ct3HM-0005oz-6G for 26049@debbugs.gnu.org; Tue, 28 Mar 2017 22:24:08 -0400 Original-Received: by mail-it0-f43.google.com with SMTP id e75so78010441itd.1 for <26049@debbugs.gnu.org>; Tue, 28 Mar 2017 19:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Y+z+ZmiYTzzJStsBHZ1IgAwBvFe721kGQw8qFPko6kE=; b=A52z5Saqjm0KEejiPJCznomR/I3gHWzZcNdnWbBsK5FygrynX9Cyzn2zHASYOUZ2uZ 8zOx+wEP7/J/1oVQ9x3FmPXhRkrtiXA7Ukrgx+CYgK/ykoivqC0M8DX4tO49Gorn4ien O5AnZG2Il1pEv1Wn7/fFq8zv3ZqJrQrsfEseLJ0nomOFJ+4GE1G6FU9Ar+7FHDXHhfOb qxPO7yDkAOoOEW/nbHQtY1yyfU1THAtg2ApFvJfiu/lYUVdAaqoC4/+cvrGNGCld9UmO 4uWtEUE1n58amMBZ95WImFmQjTGghDGYWHwzxak4thOFvimUPCXhFJMaVtiUmTutLr3Y /Z1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Y+z+ZmiYTzzJStsBHZ1IgAwBvFe721kGQw8qFPko6kE=; b=t+QSqk917R47GxVjM9aerkilXrDVOpJtuq2m4F3znhRz7mHms+EQUrGKmfl0x7g/nx I/pXrsvbeL2D21C2VTf5UG4tDtVBMrem3HowPV8bpJ5VLSH91cJ10efjeeX91t0+xFZo FEUh5PNjz5wRsqiFikZkjARlpy0UzeZuwTXK0f0Scs0Twy1hg2rLUejdTePGiujOy0QE sZR4nA1faTLJPi/m8NYLdbtfq2YXdqKDPaE78RkdPt+P3LhZqr+KeMdQu1FEJrFGM4AV xFGeW7hfJtzPNP2wJHjCVLkHPbfgQlxkQwCx7zwytxypDU0aHhLtxoZxmcaHWiFveRaw wVaQ== X-Gm-Message-State: AFeK/H1aL7yv/ASrrAOJQiB4qPjcFsm42/l/W65mke80KrIee2kcoOmMl+DZDb3Z92hSEg== X-Received: by 10.36.124.139 with SMTP id a133mr20157849itd.84.1490754242460; Tue, 28 Mar 2017 19:24:02 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p70sm3040513itg.0.2017.03.28.19.24.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Mar 2017 19:24:01 -0700 (PDT) In-Reply-To: <7171.1490705541@localhost> (Antonin Houska's message of "Tue, 28 Mar 2017 14:52:21 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131041 Archived-At: Antonin Houska writes: > >> > (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") >> > (<= (point) end)) >> > (or block (not (string= "" comment-end))) >> > ! (or block (progn (goto-char beg) (search-forward >> > ! "\n" >> > ! (min (1+ end) (point-max)) t))))) > >> Maybe (re-search-forward "$" end t) is better? It's a bit unclear to me >> what exactly all those tests are looking for. That code could use some >> comments... > > I've just verified your approach - it does work too. "$" also matches at the end of buffer even if it doesn't end in newline (which is a very marginal corner case, I just happened to notice it because I didn't hit RET in my test buffer). > + ;; Trim trailing whitespace from cs if there's some. > + (setq cs (string-trim cs)) This would trim leading whitespace too, do we want that?