]> git.eshelyaron.com Git - emacs.git/commitdiff
Respect field boundaries in indent-line-to (Bug#32014)
authorNoam Postavsky <npostavs@gmail.com>
Sat, 30 Jun 2018 13:14:22 +0000 (09:14 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Tue, 10 Jul 2018 00:08:13 +0000 (20:08 -0400)
* 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.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-indent-with-read-only-field): Don't expect to fail.

lisp/indent.el
test/lisp/emacs-lisp/lisp-mode-tests.el

index 398585e1f90b7daa0b64dace146fe8c1299658ce..db811cf35cc4cb2e19b384aa7cf04136872519b2 100644 (file)
@@ -300,8 +300,9 @@ only if necessary.  It leaves point at end of indentation."
                              (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.
index 2ac0e5ce1d43a261043b0c99d8f4177005edd83e..8598d419788d02e24bc0df364fa7d61565cf6629 100644 (file)
@@ -226,7 +226,6 @@ Expected initialization file: `%s'\"
 
 (ert-deftest lisp-indent-with-read-only-field ()
   "Test indentation on line with read-only field (Bug#32014)."
-  :expected-result :failed
   (with-temp-buffer
     (insert (propertize "prompt> " 'field 'output 'read-only t
                         'rear-nonsticky t 'front-sticky '(read-only)))