From ef6f16da2f36278706ae787131062dee088f76ee Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 2 Oct 2022 14:05:53 +0200 Subject: [PATCH] Fix point movement when indenting in sieve-mode * lisp/net/sieve-mode.el (sieve-mode-indent-function): Fix point movement when point is at the start of the line (bug#58202). --- lisp/net/sieve-mode.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/net/sieve-mode.el b/lisp/net/sieve-mode.el index f62af03534a..695a3235a7b 100644 --- a/lisp/net/sieve-mode.el +++ b/lisp/net/sieve-mode.el @@ -200,7 +200,13 @@ Turning on Sieve mode runs `sieve-mode-hook'." (let ((depth (car (syntax-ppss)))) (when (looking-at "[ \t]*}") (setq depth (1- depth))) - (indent-line-to (* 2 depth))))) + (indent-line-to (* 2 depth)))) + ;; Skip to the end of the indentation if at the beginning of the + ;; line. + (when (save-excursion + (skip-chars-backward " \t") + (bolp)) + (skip-chars-forward " \t"))) (provide 'sieve-mode) -- 2.39.2