From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc. Date: Wed, 18 Jul 2018 19:16:08 -0400 Message-ID: <8736wg879j.fsf@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1531955710 23373 195.159.176.226 (18 Jul 2018 23:15:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2018 23:15:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32200@debbugs.gnu.org To: Kaushal Modi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 19 01:15:06 2018 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 1ffvez-0005xi-G3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Jul 2018 01:15:05 +0200 Original-Received: from localhost ([::1]:38643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffvh6-0006KE-4X for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2018 19:17:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffvgv-0006JJ-LH for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 19:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffvgs-0005TK-FE for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 19:17:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffvgs-0005TA-7A for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 19:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ffvgr-00042H-UT for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2018 19:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jul 2018 23:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32200 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32200-submit@debbugs.gnu.org id=B32200.153195577915457 (code B ref 32200); Wed, 18 Jul 2018 23:17:01 +0000 Original-Received: (at 32200) by debbugs.gnu.org; 18 Jul 2018 23:16:19 +0000 Original-Received: from localhost ([127.0.0.1]:47279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffvgB-00041A-D1 for submit@debbugs.gnu.org; Wed, 18 Jul 2018 19:16:19 -0400 Original-Received: from mail-io0-f176.google.com ([209.85.223.176]:45756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffvg8-00040o-8c; Wed, 18 Jul 2018 19:16:17 -0400 Original-Received: by mail-io0-f176.google.com with SMTP id l25-v6so5522156ioh.12; Wed, 18 Jul 2018 16:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=LJ8al/ul835CjwqJnel2iafDPAOmLL1/z3Gg85CHXtc=; b=cOB8O0JOtq86xvhSUU30oqDSawz9mxPpppaGR9b1FR2gD89jKpQxOGkdp8LCUna99p CErgotsdPwLIoUY3iH5rUBfPgknTnEk5sJoVmeY9mrn/8uxDxfbPgrgmUp3ZiTXi2Yul re5drZ4OVUpXHaXzdChMEMaKjfOakDEvQJEdSYWvnfgGxdGL4dWlleozwXSOOIJ1Mu9c Gc1Do5EmthDGg+yJ2Jy1LEkKx5clHeMlSq85VQxS5d5izcbF8oZL/gzk6RAmRU9tvN5I GtyKkSuO8o+EGk7r15yfV1BqYLqiYt8WL2LePeu2TLNievfJu1IoybHq7Ikaj/6WnEJ2 I3fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=LJ8al/ul835CjwqJnel2iafDPAOmLL1/z3Gg85CHXtc=; b=alqUklaDtVdhKlwL6r7GF848MYq0ydeBlqDewcUZ16jkqebZXCglVSIYbo0LEojKLC 8mv4VKE6orpWdrefZkKbZfPtz4HpS5ft4XW7GOCkabC1f++/eCoEHgiJ3rNPnb90PKh9 ni7rHgYSNYwEomqAeGN44Pwt+dCDVBbfStNaWd6U/6yNWTEjo6iOn414NbSG8ay6Z6XY LAV01ZN/3huhrEpYLUp2l/3u5G1qFNaupRIiUj+oQT5wk9ec4/rkUzzqOymZ6i22xdCz dCb+4KvrobkQzIEhhcArlXTH86BmVpBKekh3GHDq9iKyJn+vZ+B7yRQsLGLAML9vMHJ9 gETg== X-Gm-Message-State: AOUpUlHU+GBZ8hvSMNvbL023RST2MaBQY2Ard6rRa8DhCrpr0bcIf13s Gv9Z+iIop9V4p2PB+nzw0VaV5A== X-Google-Smtp-Source: AAOMgpeYdRDc73yGr/35Y9PMUkaIR26MUOkFXxIG2CUz6wg6U1eYIihi5ql6xntV3zTFZQb5aM+TEQ== X-Received: by 2002:a6b:ed11:: with SMTP id n17-v6mr6771969iog.132.1531955770749; Wed, 18 Jul 2018 16:16:10 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id o143-v6sm2096080itb.42.2018.07.18.16.16.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 16:16:09 -0700 (PDT) In-Reply-To: (Kaushal Modi's message of "Wed, 18 Jul 2018 14:38:47 -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:148648 Archived-At: --=-=-= Content-Type: text/plain tags 32200 + patch quit Kaushal Modi writes: > Hello, > > I find this regression from emacs 26.1. It can be very easily reproduced in > emacs -Q: > > 1. emacs -Q > 2. Press C-q C-l in the scratch buffer (this will insert the ^L character) > 3. Now hit RET, that character will go away. > 3-alternative: Select a region that contains that ^L char and do C-M-\ > (indent-region). That char will get deleted again. > > This regression is evident in all my emacs-lisp packages, because the ^L > chars used to separate the sections disappear when I auto-indent the whole > package. Ah, another weird quirk of indent-line-to. How about this: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Preserve-nonblank-whitespace-when-indenting-Bug-3.patch Content-Description: patch >From ded0a965022c57b61641f87be852e0451583823d Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 18 Jul 2018 19:11:23 -0400 Subject: [PATCH v1] Preserve nonblank whitespace when indenting (Bug#32200) * lisp/indent.el (indent-line-to): Remove only spaces and tabs, not any whitespace syntax characters. --- lisp/indent.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/indent.el b/lisp/indent.el index f7da0767dc..339d9cbe9a 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -292,7 +292,8 @@ indent-line-to "Indent current line to COLUMN. This function removes or adds spaces and tabs at beginning of line only if necessary. It leaves point at end of indentation." - (back-to-indentation) + (beginning-of-line 1) + (skip-chars-forward " \t") (let ((cur-col (current-column))) (cond ((< cur-col column) (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width) @@ -303,8 +304,10 @@ indent-line-to (delete-region (progn (move-to-column column t) (point)) ;; The `move-to-column' call may replace ;; tabs with spaces, so we can't reuse the - ;; previous `back-to-indentation' point. - (progn (back-to-indentation) (point))))))) + ;; previous start point. + (progn (beginning-of-line 1) + (skip-chars-forward " \t") + (point))))))) (defun current-left-margin () "Return the left margin to use for this line. -- 2.11.0 --=-=-=--