mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-17 03:10:58 -08:00
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.
This commit is contained in:
parent
db3f779780
commit
8f7d35cabd
2 changed files with 8 additions and 3 deletions
|
|
@ -867,7 +867,9 @@ by more than one line to cross a string literal."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((pos (- (point-max) (point)))
|
(let ((pos (- (point-max) (point)))
|
||||||
(indent (progn (beginning-of-line)
|
(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")
|
(skip-chars-forward " \t")
|
||||||
(if (or (null indent) (looking-at "\\s<\\s<\\s<"))
|
(if (or (null indent) (looking-at "\\s<\\s<\\s<"))
|
||||||
;; Don't alter indentation of a ;;; comment line
|
;; 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.
|
;; as comment lines, not as code.
|
||||||
(progn (indent-for-comment) (forward-char -1))
|
(progn (indent-for-comment) (forward-char -1))
|
||||||
(if (listp indent) (setq indent (car indent)))
|
(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,
|
;; If initial point was within line's indentation,
|
||||||
;; position after the indentation. Else stay at same point in text.
|
;; position after the indentation. Else stay at same point in text.
|
||||||
(if (> (- (point-max) pos) (point))
|
(if (> (- (point-max) pos) (point))
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,6 @@ Expected initialization file: `%s'\"
|
||||||
|
|
||||||
(ert-deftest lisp-indent-with-read-only-field ()
|
(ert-deftest lisp-indent-with-read-only-field ()
|
||||||
"Test indentation on line with read-only field (Bug#32014)."
|
"Test indentation on line with read-only field (Bug#32014)."
|
||||||
:expected-result :failed
|
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert (propertize "prompt> " 'field 'output 'read-only t
|
(insert (propertize "prompt> " 'field 'output 'read-only t
|
||||||
'rear-nonsticky t 'front-sticky '(read-only)))
|
'rear-nonsticky t 'front-sticky '(read-only)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue