aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2018-06-30 09:14:22 -0400
committerNoam Postavsky2018-07-09 20:08:13 -0400
commite4ad2d1a8fad8c8c786b61083b05cfaa1ea5669c (patch)
treed56221de41e6d1d1b43edd025c1bba379684a312
parent737481cc624c62bdbd210b3eda8a6de0f23d4505 (diff)
downloademacs-e4ad2d1a8fad8c8c786b61083b05cfaa1ea5669c.tar.gz
emacs-e4ad2d1a8fad8c8c786b61083b05cfaa1ea5669c.zip
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. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-indent-with-read-only-field): Don't expect to fail.
-rw-r--r--lisp/indent.el5
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el1
2 files changed, 3 insertions, 3 deletions
diff --git a/lisp/indent.el b/lisp/indent.el
index 398585e1f90..db811cf35cc 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -300,8 +300,9 @@ only if necessary. It leaves point at end of indentation."
300 (progn (skip-chars-backward " ") (point)))) 300 (progn (skip-chars-backward " ") (point))))
301 (indent-to column)) 301 (indent-to column))
302 ((> cur-col column) ; too far right (after tab?) 302 ((> cur-col column) ; too far right (after tab?)
303 (delete-region (progn (move-to-column column t) (point)) 303 (let ((cur-indent (point)))
304 (progn (backward-to-indentation 0) (point))))))) 304 (delete-region (progn (move-to-column column t) (point))
305 cur-indent))))))
305 306
306(defun current-left-margin () 307(defun current-left-margin ()
307 "Return the left margin to use for this line. 308 "Return the left margin to use for this line.
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 2ac0e5ce1d4..8598d419788 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -226,7 +226,6 @@ Expected initialization file: `%s'\"
226 226
227(ert-deftest lisp-indent-with-read-only-field () 227(ert-deftest lisp-indent-with-read-only-field ()
228 "Test indentation on line with read-only field (Bug#32014)." 228 "Test indentation on line with read-only field (Bug#32014)."
229 :expected-result :failed
230 (with-temp-buffer 229 (with-temp-buffer
231 (insert (propertize "prompt> " 'field 'output 'read-only t 230 (insert (propertize "prompt> " 'field 'output 'read-only t
232 'rear-nonsticky t 'front-sticky '(read-only))) 231 'rear-nonsticky t 'front-sticky '(read-only)))