bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stephen Leake
Subject: bug#35143: 26.1; ada-mode 6.1.0 moves point twice after begin RET
Date: Fri, 24 May 2019 08:56:47 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]