aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2018-06-29 19:58:58 -0400
committerNoam Postavsky2018-07-09 19:39:03 -0400
commit8f7d35cabdbeb2404d53af39c5d7c12e870fa1cb (patch)
tree7840f69403e63c9ab2576b0b89cff311ebf58131
parentdb3f7797809ed9de8dd92ce38bf34f768ddc64ad (diff)
downloademacs-8f7d35cabdbeb2404d53af39c5d7c12e870fa1cb.tar.gz
emacs-8f7d35cabdbeb2404d53af39c5d7c12e870fa1cb.zip
Stop using indent-line-to in lisp-indent-line (Bug#32014)
This is partial revert of "Remove ignored argument from lisp-indent-line", because `indent-line-to' doesn't respect field boundaries. * lisp/emacs-lisp/lisp-mode.el (lisp-indent-line): Use delete-region and indent-to instead of `indent-line-to'. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-indent-with-read-only-field): Expect to pass. Don't merge to master, we will fix indent-line-to there instead.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el10
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el1
2 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 94be5acd6d3..3a03b56313d 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -867,7 +867,9 @@ by more than one line to cross a string literal."
867 (interactive) 867 (interactive)
868 (let ((pos (- (point-max) (point))) 868 (let ((pos (- (point-max) (point)))
869 (indent (progn (beginning-of-line) 869 (indent (progn (beginning-of-line)
870 (or indent (calculate-lisp-indent (lisp-ppss)))))) 870 (or indent (calculate-lisp-indent (lisp-ppss)))))
871 (shift-amt nil)
872 (beg (progn (beginning-of-line) (point))))
871 (skip-chars-forward " \t") 873 (skip-chars-forward " \t")
872 (if (or (null indent) (looking-at "\\s<\\s<\\s<")) 874 (if (or (null indent) (looking-at "\\s<\\s<\\s<"))
873 ;; Don't alter indentation of a ;;; comment line 875 ;; Don't alter indentation of a ;;; comment line
@@ -879,7 +881,11 @@ by more than one line to cross a string literal."
879 ;; as comment lines, not as code. 881 ;; as comment lines, not as code.
880 (progn (indent-for-comment) (forward-char -1)) 882 (progn (indent-for-comment) (forward-char -1))
881 (if (listp indent) (setq indent (car indent))) 883 (if (listp indent) (setq indent (car indent)))
882 (indent-line-to indent)) 884 (setq shift-amt (- indent (current-column)))
885 (if (zerop shift-amt)
886 nil
887 (delete-region beg (point))
888 (indent-to indent)))
883 ;; If initial point was within line's indentation, 889 ;; If initial point was within line's indentation,
884 ;; position after the indentation. Else stay at same point in text. 890 ;; position after the indentation. Else stay at same point in text.
885 (if (> (- (point-max) pos) (point)) 891 (if (> (- (point-max) pos) (point))
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)))