From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Antonin Houska Newsgroups: gmane.emacs.bugs Subject: bug#26049: 25.2; Extra lines not added to comment Date: Wed, 29 Mar 2017 08:54:53 +0200 Message-ID: <20705.1490770493@localhost> References: <29145.1489153275@localhost> <87r31i2i5a.fsf@users.sourceforge.net> <7171.1490705541@localhost> <87h92c3jl8.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1490770582 20564 195.159.176.226 (29 Mar 2017 06:56:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Mar 2017 06:56:22 +0000 (UTC) Cc: 26049@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 29 08:56:18 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 1ct7Wd-0004AL-ML for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Mar 2017 08:56:11 +0200 Original-Received: from localhost ([::1]:56927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct7Wj-0006eA-NV for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Mar 2017 02:56:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct7WZ-0006cm-TU for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 02:56:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ct7WV-0005SF-Ti for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 02:56:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51806) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ct7WV-0005S1-QI for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 02:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ct7WU-0005sR-L7 for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 02:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Antonin Houska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Mar 2017 06:56: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.149077050422517 (code B ref 26049); Wed, 29 Mar 2017 06:56:02 +0000 Original-Received: (at 26049) by debbugs.gnu.org; 29 Mar 2017 06:55:04 +0000 Original-Received: from localhost ([127.0.0.1]:50004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ct7VY-0005r7-Fq for submit@debbugs.gnu.org; Wed, 29 Mar 2017 02:55:04 -0400 Original-Received: from mx1.mailbox.org ([80.241.60.212]:37539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ct7VX-0005qa-A4 for 26049@debbugs.gnu.org; Wed, 29 Mar 2017 02:55:03 -0400 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 3DB63456D3; Wed, 29 Mar 2017 08:54:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id p2RXZxYIi-Xo; Wed, 29 Mar 2017 08:54:55 +0200 (CEST) In-reply-to: <87h92c3jl8.fsf@users.sourceforge.net> Comments: In-reply-to npostavs@users.sourceforge.net message dated "Tue, 28 Mar 2017 22:25:23 -0400." 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:131050 Archived-At: npostavs@users.sourceforge.net wrote: > Antonin Houska writes: > > > >> > (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") > >> > (<=3D (point) end)) > >> > (or block (not (string=3D "" 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). IMO this is ok. If the 'extra-line value of `comment-style' tells that the comment should look like this /* * some comment */ it'd be kind of inconsistend if just a missing RET at the end of buffer resulted in this /* some comment */ which effectively means discrepancy from the customization setting. (The initial version of my patch ignored the `extra-line' setting in this special case, but it was a thinko rather than intention.) >=20 > > + ;; Trim trailing whitespace from cs if there's some. > > + (setq cs (string-trim cs)) >=20 > This would trim leading whitespace too, do we want that? I haven't noticed any related issue but yes, string-trim-right is more precise. If the (supposedly accidental) leading space should be removed from the value of `comment-start', it should probably happen elsewhere in the co= de because it's not specific to the 'extra-line style. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26 A-2700 Wiener Neustadt Web: http://www.postgresql-support.de, http://www.cybertec.at