From: Stephen Leake <stephen_leake@stephe-leake.org>
To: Ludovic Brenta <ludovic@ludovic-brenta.org>
Cc: 35143@debbugs.gnu.org, ada-mode-users@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 [thread overview]
Message-ID: <861s0nx034.fsf@stephe-leake.org> (raw)
In-Reply-To: <f240ec6ab70193b11e61819b9e2effc6@ludovic-brenta.org> (Ludovic Brenta's message of "Thu, 04 Apr 2019 17:08:29 +0200")
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
next prev parent reply other threads:[~2019-05-24 16:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 15:08 bug#35143: 26.1; ada-mode 6.1.0 moves point twice after begin RET Ludovic Brenta
[not found] ` <handler.35143.B.15543905268566.ack@debbugs.gnu.org>
2019-04-04 15:11 ` Ludovic Brenta
2019-05-24 16:52 ` Stephen Leake
2019-05-24 16:56 ` Stephen Leake [this message]
2019-08-18 16:53 ` bug#35143: Fixed in ada-mode 6.1.0 Stephen Leake
2019-08-18 16:54 ` bug#35143: close Stephen Leake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861s0nx034.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=35143@debbugs.gnu.org \
--cc=ada-mode-users@nongnu.org \
--cc=ludovic@ludovic-brenta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.