[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ada-mode-users] [patch] ada-goto-declaration when point is on an op
From: |
Stephen Leake |
Subject: |
Re: [Ada-mode-users] [patch] ada-goto-declaration when point is on an operator |
Date: |
Mon, 30 Jan 2017 11:35:49 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (windows-nt) |
Ludovic Brenta <address@hidden> writes:
> First of all, thank you for applying the patch that I sent in
> ada-mode 5.2.1. However I have discovered a third bug which is
> still present (I don't know if it is a regression introduced by my
> patch or a pre-existing bug). This is triggered by identifiers
> whose name start with the name of an operator; for example:
>
> Modify (Absolute_Temperature);
> Nothing_Changed;
>
> If point is at the start of "Modify", ada-goto-declaration tries to
> jumps to an operator "mod" which may exit, or not; similarly if point
> is at the start of "Absolute_Temperature" it looks for "abs",
> Nothing_Changed goes to "not", Origin goes to "or", etc.
>
> This micro-patch fixes by enclosing the operators in word delimiters,
> \\< and \\>.
Thanks, applied.
> It is still not perfect, as "_" is a word delimiter, so "This_Or_That"
> will still jump to "or" if point is in the "Or". Suggestions for
> improvement welcome.
I always change '_' to have word syntax, which will fix this. I don't
think we can make that the default, though.
>
>
> --- ada-mode/ada-mode.el 2016-12-22 23:02:01.000000000 +0100
> +++ ada-mode/ada-mode.el 2017-01-27 12:03:53.000000000 +0100
> @@ -2126,7 +2126,7 @@
> )
>
> (defvar ada-operator-re
> -
> "\\+\\|-\\|/\\|\\*\\*\\|\\*\\|=\\|&\\|abs\\|mod\\|rem\\|and\\|not\\|or\\|xor\\|<=\\|<\\|>=\\|>"
> +
> "\\+\\|-\\|/\\|\\*\\*\\|\\*\\|=\\|&\\|\\<\\(abs\\|mod\\|rem\\|and\\|not\\|or\\|xor\\)\\>\\|<=\\|<\\|>=\\|>"
> "Regexp matching Ada operator_symbol.")
>
> (defun ada-identifier-at-point ()
--
-- Stephe