From unknown Sat Sep 06 02:03:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34796: [PATCH] * lisp/simple.el (delete-indentation): Join lines in a region Resent-From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Mar 2019 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 34796@debbugs.gnu.org Cc: =?UTF-8?Q?=C5=81ukasz?= Stelmach X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155215436111455 (code B ref -1); Sat, 09 Mar 2019 18:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Mar 2019 17:59:21 +0000 Received: from localhost ([127.0.0.1]:37367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2gFl-0002yh-IE for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2gFj-0002yR-1K for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:19 -0500 Received: from lists.gnu.org ([209.51.188.17]:54147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2gFd-0006F7-GU for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2gFc-0004w3-LZ for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_BL_SPAMCOP_NET,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2gFb-0006EN-V2 for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:12 -0500 Received: from smtpo.poczta.interia.pl ([217.74.65.235]:60211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2gFa-0006BN-1n for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:11 -0500 X-Interia-R: Interia X-Interia-R-IP: 197.231.221.211 X-Interia-R-Helo: Received: from localhost (exit1.ipredator.se [197.231.221.211]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA; Sat, 9 Mar 2019 18:59:02 +0100 (CET) From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Date: Sat, 9 Mar 2019 18:56:34 +0100 Message-Id: <20190309175634.23262-1-stlman@poczta.fm> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1552154344; bh=apE1KsEUOSXwCW6OmffH/h39QVbjetulW2AQywShwv8=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Cc:Subject: Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Interia-Antivirus; b=dFmwu4TVHVaQ2XV86sW6/Z+iCOgdLpl6Yb8kkqN0ApWxHg+5Y5nX0bGtKlH3iVeLf vUgG2xf5pu9koq58/K5mWfUCZquewK0krQfI552euK+hNw90RA7w8o0FHFOqkyTYko /HII9JNvsPsDALb5WCzC32cXdgDUxNtT8g0x9apU= Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 217.74.65.235 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix string to cop [...] Content analysis details: (2.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: interia.pl] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stlman[at]poczta.fm) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=stlman%40poczta.fm; ip=209.51.188.92; r=debbugs.gnu.org] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix string to cop [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: interia.pl] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stlman[at]poczta.fm) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;id=stlman%40poczta.fm;ip=209.51.188.92;r=debbugs.gnu.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix str= ing to copy." (indent-to col 0) (goto-char pos))) =20 -(defun delete-indentation (&optional arg) +(defun delete-indentation (&optional arg beg end) "Join this line to previous and fix up whitespace at join. -If there is a fill prefix, delete it from the beginning of this line. -With argument, join this line to following line." - (interactive "*P") +If there is a fill prefix, delete it from the beginning of this +line. With argument, join this line to following line. With a +region active, join lines in the region. If both argument and +region are set, the region is ignored." + (interactive "*P\nr") + (if arg (forward-line 1) + (if (use-region-p) + (goto-char end))) (beginning-of-line) - (if arg (forward-line 1)) - (if (eq (preceding-char) ?\n) - (progn - (delete-region (point) (1- (point))) - ;; If the second line started with the fill prefix, - ;; delete the prefix. - (if (and fill-prefix - (<=3D (+ (point) (length fill-prefix)) (point-max)) - (string=3D fill-prefix - (buffer-substring (point) - (+ (point) (length fill-prefix))))) - (delete-region (point) (+ (point) (length fill-prefix)))) - (fixup-whitespace)))) + (while (eq (preceding-char) ?\n) + (progn + (delete-region (point) (1- (point))) + ;; If the second line started with the fill prefix, + ;; delete the prefix. + (if (and fill-prefix + (<=3D (+ (point) (length fill-prefix)) (point-max)) + (string=3D fill-prefix + (buffer-substring (point) + (+ (point) (length fill-prefix))))) + (delete-region (point) (+ (point) (length fill-prefix)))) + (fixup-whitespace) + (if (and beg + (not arg) + (< beg (point-at-bol))) + (beginning-of-line))))) =20 (defalias 'join-line #'delete-indentation) ; easier to find =20 --=20 2.20.1 From unknown Sat Sep 06 02:03:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34796: [PATCH] * lisp/simple.el (delete-indentation): Join lines in a region Resent-From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Mar 2019 08:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 34796@debbugs.gnu.org Received: via spool by 34796-submit@debbugs.gnu.org id=B34796.155220593910670 (code B ref 34796); Sun, 10 Mar 2019 08:19:02 +0000 Received: (at 34796) by debbugs.gnu.org; 10 Mar 2019 08:18:59 +0000 Received: from localhost ([127.0.0.1]:37647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2tff-0002m1-Bn for submit@debbugs.gnu.org; Sun, 10 Mar 2019 04:18:59 -0400 Received: from smtpo.poczta.interia.pl ([217.74.65.235]:47349) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2tfc-0002ln-Re for 34796@debbugs.gnu.org; Sun, 10 Mar 2019 04:18:58 -0400 X-Interia-R: Interia X-Interia-R-IP: 87.120.36.157 X-Interia-R-Helo: Received: from localhost (unknown [87.120.36.157]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA for <34796@debbugs.gnu.org>; Sun, 10 Mar 2019 08:14:04 +0100 (CET) From: =?UTF-8?Q?=C5=81ukasz?= Stelmach In-Reply-To: (GNU bug Tracking System's message of "Sat, 09 Mar 2019 18:00:02 +0000") References: <20190309175634.23262-1-stlman@poczta.fm> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Hashcash: 1:24:190310:stlman@poczta.fm::GSiZaxf81qXdBz8y:5Rje X-Hashcash: 1:24:190310:help-debbugs@gnu.org::m/wBEch4AEc3ZCxP:Cydr X-Hashcash: 1:24:190310:34796@debbugs.gnu.org::plcD8qU0ir8rRrfs:SEfC Date: Sun, 10 Mar 2019 08:14:03 +0100 Message-ID: <87d0mztd50.fsf_-_%stlman@poczta.fm> MIME-Version: 1.0 Content-Type: text/plain X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1552202045; bh=suE7ohH8NljeFk1PSByqb+NJ5EaPnM7ZiKzZXF+u5Hk=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Subject: In-Reply-To:References:User-Agent:X-Hashcash:X-Hashcash:X-Hashcash: Date:Message-ID:MIME-Version:Content-Type:X-Interia-Antivirus; b=SLJzsp8NwJMcFaRUe5m9OYh8ozOGArm+bEBTjYin90e2q90t5149q52zL6O5breSC /6ppgC4et/EUAJt9nhC2QCRVzDDWcKhxe5EsmUjoGpSb6+PbJkjV8g3Tz+K0hq7oac SlhvLecCOw4C9OQ3g6hsO/UIRgK3OWEsHO4fdeBY= X-EOM: H-lo10 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -1.0 (-) Control: tags -1 + patch From unknown Sat Sep 06 02:03:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34796: [PATCH] * lisp/simple.el (delete-indentation): Join lines in a region Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Mar 2019 08:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: =?UTF-8?Q?=C5=81ukasz?= Stelmach Cc: 34796@debbugs.gnu.org Received: via spool by 34796-submit@debbugs.gnu.org id=B34796.15526376655742 (code B ref 34796); Fri, 15 Mar 2019 08:15:01 +0000 Received: (at 34796) by debbugs.gnu.org; 15 Mar 2019 08:14:25 +0000 Received: from localhost ([127.0.0.1]:44355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h4hyz-0001UY-2B for submit@debbugs.gnu.org; Fri, 15 Mar 2019 04:14:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h4hyx-0001UL-K4 for 34796@debbugs.gnu.org; Fri, 15 Mar 2019 04:14:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4hys-0006CW-2c; Fri, 15 Mar 2019 04:14:18 -0400 Received: from [176.228.60.248] (port=2445 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h4hyr-0001Zj-3K; Fri, 15 Mar 2019 04:14:17 -0400 Date: Fri, 15 Mar 2019 10:13:59 +0200 Message-Id: <837ed01rnc.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <20190309175634.23262-1-stlman@poczta.fm> (message from =?UTF-8?Q?=C5=81ukasz?= Stelmach on Sat, 9 Mar 2019 18:56:34 +0100) References: <20190309175634.23262-1-stlman@poczta.fm> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.3 (/) > From: Łukasz Stelmach > Date: Sat, 9 Mar 2019 18:56:34 +0100 > Cc: Łukasz Stelmach > > If a region is active, join all the lines it spans. Thanks. Please provide a ChangeLog-style commit log message for your proposed changes, and also accompany them with suitable changes to NEWS and the user manual. > -(defun delete-indentation (&optional arg) > +(defun delete-indentation (&optional arg beg end) > "Join this line to previous and fix up whitespace at join. > -If there is a fill prefix, delete it from the beginning of this line. > -With argument, join this line to following line." > - (interactive "*P") > +If there is a fill prefix, delete it from the beginning of this > +line. With argument, join this line to following line. With a > +region active, join lines in the region. If both argument and > +region are set, the region is ignored." Please leave 2 spaces between sentences in the doc string. With those issues taken care of, I think this feature can be installed. From unknown Sat Sep 06 02:03:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34796: [PATCH] If the region is active, join all the lines it spans Resent-From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Mar 2019 21:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 34796@debbugs.gnu.org Cc: =?UTF-8?Q?=C5=81ukasz?= Stelmach Received: via spool by 34796-submit@debbugs.gnu.org id=B34796.155268404511702 (code B ref 34796); Fri, 15 Mar 2019 21:08:02 +0000 Received: (at 34796) by debbugs.gnu.org; 15 Mar 2019 21:07:25 +0000 Received: from localhost ([127.0.0.1]:45547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h4u33-00032g-GK for submit@debbugs.gnu.org; Fri, 15 Mar 2019 17:07:25 -0400 Received: from smtpo.poczta.interia.pl ([217.74.65.153]:37980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h4u31-00032N-9K for 34796@debbugs.gnu.org; Fri, 15 Mar 2019 17:07:24 -0400 X-Interia-R: Interia X-Interia-R-IP: 65.19.167.131 X-Interia-R-Helo: Received: from localhost (unknown [65.19.167.131]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA; Fri, 15 Mar 2019 22:07:12 +0100 (CET) From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Date: Fri, 15 Mar 2019 22:06:16 +0100 Message-Id: <20190315210616.1217-1-stlman@poczta.fm> X-Mailer: git-send-email 2.20.1 In-Reply-To: <837ed01rnc.fsf@gnu.org> References: <837ed01rnc.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1552684036; bh=cnIjJbtM9o+EaoAGoMiRFJ9aXNninnzZ5Dp0ObA7m/c=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Interia-Antivirus; b=bnvq07/MSidhTWbZSIBZBKCBwzrJQDCaKy0FG/0Sk+Ce94ynkd5na7FLMcASty+QS rVZpObLzpYGX/dW3BoVcp2ltpa0UJ32ATLria2Ckl/ABtMnWOZgyxK4Ltl/1yggHxT 0hF1EP0OB2tXgE3KcTsAQ1LidEFcCt1GRwccwm6E= X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.2 (/) * lisp/simple.el (delete-indentation): Join lines in the active region. * doc/misc/org.texi: Describe the arguments of delete-indentation. * etc/NEWS: Mention region support in delete-indentation. --- doc/emacs/indent.texi | 4 ++++ etc/NEWS | 4 ++++ lisp/simple.el | 42 +++++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi index a6aa75bbb4..61cf7332b5 100644 --- a/doc/emacs/indent.texi +++ b/doc/emacs/indent.texi @@ -110,6 +110,10 @@ parentheses, or if the junction follows another newline. If there is a fill prefix, @kbd{M-^} deletes the fill prefix if it appears after the newline that is deleted. @xref{Fill Prefix}. +With the universal prefix argument, join the current line line to the +following line. With the region active, join lines in the region. If +both the argument is set and the region is active, the region is ignored. + @item C-M-\ @kindex C-M-\ @findex indent-region diff --git a/etc/NEWS b/etc/NEWS index 000d211c1a..129d882735 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -370,6 +370,10 @@ region using a given replacement-function in a non-destructive manner arguments mitigating performance issues when operating on huge buffers. +** The command `delete-indentation` now can operate on the active +region + ++++ * Changes in Specialized Modes and Packages in Emacs 27.1 diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5ebb1f..7878272ec9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix string to copy." (indent-to col 0) (goto-char pos))) -(defun delete-indentation (&optional arg) +(defun delete-indentation (&optional arg beg end) "Join this line to previous and fix up whitespace at join. -If there is a fill prefix, delete it from the beginning of this line. -With argument, join this line to following line." - (interactive "*P") +If there is a fill prefix, delete it from the beginning of this +line. With prefix ARG, join the current line to the following line. +With the region active, join lines in the region. If both the +argument is set and the region is active, the region is ignored." + (interactive "*P\nr") + (if arg (forward-line 1) + (if (use-region-p) + (goto-char end))) (beginning-of-line) - (if arg (forward-line 1)) - (if (eq (preceding-char) ?\n) - (progn - (delete-region (point) (1- (point))) - ;; If the second line started with the fill prefix, - ;; delete the prefix. - (if (and fill-prefix - (<= (+ (point) (length fill-prefix)) (point-max)) - (string= fill-prefix - (buffer-substring (point) - (+ (point) (length fill-prefix))))) - (delete-region (point) (+ (point) (length fill-prefix)))) - (fixup-whitespace)))) + (while (eq (preceding-char) ?\n) + (progn + (delete-region (point) (1- (point))) + ;; If the second line started with the fill prefix, + ;; delete the prefix. + (if (and fill-prefix + (<= (+ (point) (length fill-prefix)) (point-max)) + (string= fill-prefix + (buffer-substring (point) + (+ (point) (length fill-prefix))))) + (delete-region (point) (+ (point) (length fill-prefix)))) + (fixup-whitespace) + (if (and beg + (not arg) + (< beg (point-at-bol))) + (beginning-of-line))))) (defalias 'join-line #'delete-indentation) ; easier to find -- 2.20.1 From unknown Sat Sep 06 02:03:17 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: =?UTF-8?Q?=C5=81ukasz?= Stelmach Subject: bug#34796: closed (Re: bug#34796: [PATCH] If the region is active, join all the lines it spans) Message-ID: References: <83mulns2c8.fsf@gnu.org> <20190309175634.23262-1-stlman@poczta.fm> X-Gnu-PR-Message: they-closed 34796 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 34796@debbugs.gnu.org Date: Fri, 22 Mar 2019 09:09:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1553245743-7240-1" This is a multi-part message in MIME format... ------------=_1553245743-7240-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #34796: [PATCH] * lisp/simple.el (delete-indentation): Join lines in a regi= on 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 34796@debbugs.gnu.org. --=20 34796: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D34796 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1553245743-7240-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 34796-done) by debbugs.gnu.org; 22 Mar 2019 09:09:01 +0000 Received: from localhost ([127.0.0.1]:53978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7GAe-0001sW-PA for submit@debbugs.gnu.org; Fri, 22 Mar 2019 05:09:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7GAd-0001sG-6y for 34796-done@debbugs.gnu.org; Fri, 22 Mar 2019 05:08:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7GAX-00013c-86; Fri, 22 Mar 2019 05:08:53 -0400 Received: from [176.228.60.248] (port=1673 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7GAW-0001aZ-Nh; Fri, 22 Mar 2019 05:08:53 -0400 Date: Fri, 22 Mar 2019 12:08:55 +0300 Message-Id: <83mulns2c8.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?=C5=81ukasz?= Stelmach In-reply-to: <20190315210616.1217-1-stlman@poczta.fm> (message from =?utf-8?Q?=C5=81ukasz?= Stelmach on Fri, 15 Mar 2019 22:06:16 +0100) Subject: Re: bug#34796: [PATCH] If the region is active, join all the lines it spans References: <837ed01rnc.fsf@gnu.org> <20190315210616.1217-1-stlman@poczta.fm> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 34796-done Cc: 34796-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.3 (/) > From: Łukasz Stelmach > Date: Fri, 15 Mar 2019 22:06:16 +0100 > Cc: Łukasz Stelmach > > * lisp/simple.el (delete-indentation): Join lines in the active region. > * doc/misc/org.texi: Describe the arguments of delete-indentation. > * etc/NEWS: Mention region support in delete-indentation. Thanks, I pushed this to the master branch (with some changes). P.S. Your patch was formatted almost, but exactly, like the command "git format-patch", so it needed some manual work. In the future, using "got format-patch" will be most appreciated. ------------=_1553245743-7240-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Mar 2019 17:59:21 +0000 Received: from localhost ([127.0.0.1]:37367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2gFl-0002yh-IE for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h2gFj-0002yR-1K for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:19 -0500 Received: from lists.gnu.org ([209.51.188.17]:54147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2gFd-0006F7-GU for submit@debbugs.gnu.org; Sat, 09 Mar 2019 12:59:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2gFc-0004w3-LZ for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_BL_SPAMCOP_NET,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2gFb-0006EN-V2 for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:12 -0500 Received: from smtpo.poczta.interia.pl ([217.74.65.235]:60211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2gFa-0006BN-1n for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2019 12:59:11 -0500 X-Interia-R: Interia X-Interia-R-IP: 197.231.221.211 X-Interia-R-Helo: Received: from localhost (exit1.ipredator.se [197.231.221.211]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA; Sat, 9 Mar 2019 18:59:02 +0100 (CET) From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= To: bug-gnu-emacs@gnu.org Subject: [PATCH] * lisp/simple.el (delete-indentation): Join lines in a region Date: Sat, 9 Mar 2019 18:56:34 +0100 Message-Id: <20190309175634.23262-1-stlman@poczta.fm> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1552154344; bh=apE1KsEUOSXwCW6OmffH/h39QVbjetulW2AQywShwv8=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Cc:Subject: Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Interia-Antivirus; b=dFmwu4TVHVaQ2XV86sW6/Z+iCOgdLpl6Yb8kkqN0ApWxHg+5Y5nX0bGtKlH3iVeLf vUgG2xf5pu9koq58/K5mWfUCZquewK0krQfI552euK+hNw90RA7w8o0FHFOqkyTYko /HII9JNvsPsDALb5WCzC32cXdgDUxNtT8g0x9apU= Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 217.74.65.235 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix string to cop [...] Content analysis details: (2.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: interia.pl] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stlman[at]poczta.fm) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=stlman%40poczta.fm; ip=209.51.188.92; r=debbugs.gnu.org] X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?=C5=81ukasz=20Stelmach?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix string to cop [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: interia.pl] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stlman[at]poczta.fm) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;id=stlman%40poczta.fm;ip=209.51.188.92;r=debbugs.gnu.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager If a region is active, join all the lines it spans. --- lisp/simple.el | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index d4ae5eb..1b3d1bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -593,25 +593,33 @@ When called from Lisp code, ARG may be a prefix str= ing to copy." (indent-to col 0) (goto-char pos))) =20 -(defun delete-indentation (&optional arg) +(defun delete-indentation (&optional arg beg end) "Join this line to previous and fix up whitespace at join. -If there is a fill prefix, delete it from the beginning of this line. -With argument, join this line to following line." - (interactive "*P") +If there is a fill prefix, delete it from the beginning of this +line. With argument, join this line to following line. With a +region active, join lines in the region. If both argument and +region are set, the region is ignored." + (interactive "*P\nr") + (if arg (forward-line 1) + (if (use-region-p) + (goto-char end))) (beginning-of-line) - (if arg (forward-line 1)) - (if (eq (preceding-char) ?\n) - (progn - (delete-region (point) (1- (point))) - ;; If the second line started with the fill prefix, - ;; delete the prefix. - (if (and fill-prefix - (<=3D (+ (point) (length fill-prefix)) (point-max)) - (string=3D fill-prefix - (buffer-substring (point) - (+ (point) (length fill-prefix))))) - (delete-region (point) (+ (point) (length fill-prefix)))) - (fixup-whitespace)))) + (while (eq (preceding-char) ?\n) + (progn + (delete-region (point) (1- (point))) + ;; If the second line started with the fill prefix, + ;; delete the prefix. + (if (and fill-prefix + (<=3D (+ (point) (length fill-prefix)) (point-max)) + (string=3D fill-prefix + (buffer-substring (point) + (+ (point) (length fill-prefix))))) + (delete-region (point) (+ (point) (length fill-prefix)))) + (fixup-whitespace) + (if (and beg + (not arg) + (< beg (point-at-bol))) + (beginning-of-line))))) =20 (defalias 'join-line #'delete-indentation) ; easier to find =20 --=20 2.20.1 ------------=_1553245743-7240-1--