[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32014: 26.1; lisp-indent-line fails in first line of Ielm

From: Noam Postavsky
Subject: bug#32014: 26.1; lisp-indent-line fails in first line of Ielm
Date: Sat, 30 Jun 2018 09:27:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Eli Zaretskii <address@hidden> 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:

>From a31918efdbdbf4c6d3f26ae7a73aba910f164116 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]