GNU bug report logs - #35143
26.1; ada-mode 6.1.0 moves point twice after begin RET

Previous Next

Packages: ada-mode, emacs;

Reported by: Ludovic Brenta <ludovic <at> ludovic-brenta.org>

Date: Thu, 4 Apr 2019 15:09:02 UTC

Severity: minor

Found in version 26.1

Done: Stephen Leake <stephen_leake <at> stephe-leake.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stephen Leake <stephen_leake <at> stephe-leake.org>
To: Ludovic Brenta <ludovic <at> ludovic-brenta.org>
Cc: 35143 <at> debbugs.gnu.org, ada-mode-users <at> nongnu.org
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
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




This bug report was last modified 5 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.