GNU bug report logs - #32014
26.1; lisp-indent-line fails in first line of Ielm

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Fri, 29 Jun 2018 23:21:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 26.1

Fixed in version 26.2

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 32014 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: joaotavora <at> gmail.com, 32014 <at> debbugs.gnu.org
Subject: Re: bug#32014: 26.1; lisp-indent-line fails in first line of Ielm
Date: Sat, 30 Jun 2018 09:27:58 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> I'm not sure I'm okay with changing the behavior of
> forward/backward-to-indentation like that.  It's an incompatible
> change, isn't it?  The documentation doesn't seem to tell anything wrt
> the behavior in presence of fields, but that doesn't mean we can make
> such changes without considering the consequences.  Can you tell why
> you think this change is TRT?

Hmm, the more I look at it, the less I understand why these functions
even exist.  There are hardly any uses of them.  Maybe we should just do
this instead:

[v2-0001-Respect-field-boundaries-in-indent-line-to-Bug-32.patch (text/x-diff, inline)]
From a31918efdbdbf4c6d3f26ae7a73aba910f164116 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 30 Jun 2018 09:14:22 -0400
Subject: [PATCH v2] Respect field boundaries in indent-line-to (Bug#32014)

* lisp/indent.el (indent-line-to): Use the back-to-indentation point
as the end-point of whitespace removal, rather than
backward-to-indentation which doesn't respect field boundaries.
---
 lisp/indent.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index eb5b21e8e8..14efe8bfdf 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -300,8 +300,9 @@ indent-line-to
 			      (progn (skip-chars-backward " ") (point))))
 	   (indent-to column))
 	  ((> cur-col column) ; too far right (after tab?)
-	   (delete-region (progn (move-to-column column t) (point))
-			  (progn (backward-to-indentation 0) (point)))))))
+	   (let ((cur-indent (point)))
+             (delete-region (progn (move-to-column column t) (point))
+			    cur-indent))))))
 
 (defun current-left-margin ()
   "Return the left margin to use for this line.
-- 
2.11.0


This bug report was last modified 7 years and 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.