diff options
author | Noam Postavsky <npostavs@gmail.com> | 2018-06-29 19:58:58 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2018-07-09 19:39:03 -0400 |
commit | 8f7d35cabdbeb2404d53af39c5d7c12e870fa1cb (patch) | |
tree | 7840f69403e63c9ab2576b0b89cff311ebf58131 /lisp/emacs-lisp/lisp-mode.el | |
parent | db3f7797809ed9de8dd92ce38bf34f768ddc64ad (diff) | |
download | emacs-8f7d35cabdbeb2404d53af39c5d7c12e870fa1cb.tar.gz |
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.
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 10 |
1 files changed, 8 insertions, 2 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." (interactive) (let ((pos (- (point-max) (point))) (indent (progn (beginning-of-line) - (or indent (calculate-lisp-indent (lisp-ppss)))))) + (or indent (calculate-lisp-indent (lisp-ppss))))) + (shift-amt nil) + (beg (progn (beginning-of-line) (point)))) (skip-chars-forward " \t") (if (or (null indent) (looking-at "\\s<\\s<\\s<")) ;; Don't alter indentation of a ;;; comment line @@ -879,7 +881,11 @@ by more than one line to cross a string literal." ;; as comment lines, not as code. (progn (indent-for-comment) (forward-char -1)) (if (listp indent) (setq indent (car indent))) - (indent-line-to indent)) + (setq shift-amt (- indent (current-column))) + (if (zerop shift-amt) + nil + (delete-region beg (point)) + (indent-to indent))) ;; If initial point was within line's indentation, ;; position after the indentation. Else stay at same point in text. (if (> (- (point-max) pos) (point)) |