unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57441: indent-according-to-mode indents incorrectly if previous line is blank
@ 2022-08-26 22:58 Lojze Gačnik
  0 siblings, 0 replies; only message in thread
From: Lojze Gačnik @ 2022-08-26 22:58 UTC (permalink / raw)
  To: 57441

The documentation of indent-according-to-mode claims that, if
indent-line-function is set to indent-relative-first-indent-point, it
will indent the line the same as the previous non-blank line.

But this is not the case - it only works if the immediately preceding
line is non-blank. If line 1 is indented 4 spaces, and line 2 is
blank, then indent-according-to-mode on line 3 will indent 0 spaces,
instead of the expected 4.

Calling indent-according-to-line on line 2, or calling
indent-relative-first-indent-point directly on line 2 or 3, behaves
correctly.

I reproduced this issue on emacs 29.0.50, using the following init.el file:

(electric-indent-mode -1)
(defun my/plain-indent ()
  (setq indent-line-function 'indent-relative-first-indent-point))
; Have to set it in a hook, otherwise it gets overrriden.
(add-hook 'prog-mode-hook 'my/plain-indent)
(add-hook 'text-mode-hook 'my/plain-indent)





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-26 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 22:58 bug#57441: indent-according-to-mode indents incorrectly if previous line is blank Lojze Gačnik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).