From: Noam Postavsky <npostavs@gmail.com>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 32200@debbugs.gnu.org
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 [thread overview]
Message-ID: <8736wg879j.fsf@gmail.com> (raw)
In-Reply-To: <CAFyQvY3hTbFDRnkwa1U8vVf20NXmOJZM4btMx_GWQHhaa+EmTA@mail.gmail.com> (Kaushal Modi's message of "Wed, 18 Jul 2018 14:38:47 -0400")
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
tags 32200 + patch
quit
Kaushal Modi <kaushal.modi@gmail.com> 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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1647 bytes --]
From ded0a965022c57b61641f87be852e0451583823d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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
next prev parent reply other threads:[~2018-07-18 23:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 18:38 bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc Kaushal Modi
2018-07-18 23:16 ` Noam Postavsky [this message]
2018-07-19 12:40 ` Kaushal Modi
2018-07-22 15:10 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736wg879j.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=32200@debbugs.gnu.org \
--cc=kaushal.modi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).