Subject: Re: bug#35143: 26.1; ada-mode 6.1.0 moves point twice after begin RET

From: Stephen Leake <[email-masked]>
Date: Fri, 24 May 2019 08:56:47 -0800

Here is the current implementation of 'ada-indent-newline-indent': using
it fixes this bug, as well as some other bad behavior.

(defun ada-indent-newline-indent ()
  "insert a newline, indent the old and new lines."
  (interactive "*")
  ;; point may be in the middle of a word, so insert newline first,
  ;; then go back and indent.
  (insert "\n")
  (unless (and (wisi-partial-parse-p (line-beginning-position) (line-end-position))
	       (save-excursion (progn (forward-char -1)(looking-back "begin\\|else" (line-beginning-position)))))
    ;; Partial parse may think 'begin' is just the start of a
    ;; statement, when it's actually part of a larger declaration. So
    ;; don't indent 'begin'. Similarly for 'else'; error recovery will
    ;; probably insert 'if then' immediately before it
    (forward-char -1)
    (funcall indent-line-function)
    (forward-char 1))
  (funcall indent-line-function))

--
-- Stephe