unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc.
@ 2018-07-18 18:38 Kaushal Modi
  2018-07-18 23:16 ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2018-07-18 18:38 UTC (permalink / raw)
  To: 32200

[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

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.

In GNU Emacs 27.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2018-07-16
Repository revision: 46d7c786324f98e73b7615fbc9515ce9a14fa5d4
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.8
(Santiago)

Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/master
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
 -I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES THREADS

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1991 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc.
  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
  2018-07-19 12:40   ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-07-18 23:16 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 32200

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc.
  2018-07-18 23:16 ` Noam Postavsky
@ 2018-07-19 12:40   ` Kaushal Modi
  2018-07-22 15:10     ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2018-07-19 12:40 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32200

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

Hello Noam,

On Wed, Jul 18, 2018 at 7:16 PM Noam Postavsky <npostavs@gmail.com> wrote:

> tags 32200 + patch
> quit
>
> Ah, another weird quirk of indent-line-to.  How about this:
>

Thanks for the prompt patch! That fix works for me.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 646 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#32200: 27.0.50; ^L characters gets auto-deleted on actions like indent-region, newline after ^L, etc.
  2018-07-19 12:40   ` Kaushal Modi
@ 2018-07-22 15:10     ` Noam Postavsky
  0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2018-07-22 15:10 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 32200

tags 32200 fixed
close 32200
quit

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Thanks for the prompt patch! That fix works for me.

Pushed to master.

[1: 8217998b0d]: 2018-07-22 10:52:48 -0400
  Preserve nonblank whitespace when indenting (Bug#32200)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8217998b0d59ec491116250c6a10f46052a21ef8





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-22 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-07-19 12:40   ` Kaushal Modi
2018-07-22 15:10     ` Noam Postavsky

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).