ada-mode-users
[Top][All Lists]
Advanced

[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: Ludovic Brenta
Subject: Re: [Ada-mode-users] [patch] ada-goto-declaration when point is on an operator
Date: Thu, 13 Apr 2017 13:45:31 +0100
User-agent: Roundcube Webmail/0.5.3

On Mon, 30 Jan 2017 16:14:57 -0600, Stephen Leake wrote:
Ludovic Brenta <address@hidden> writes:

Stephen Leake wrote:
Ludovic Brenta <address@hidden> writes:
This micro-patch fixes by enclosing the operators in word
delimiters,
\\< and \\>.

Thanks, applied.

Thanks.

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.

Interesting, I wasn't aware that was possible. I'd like to apply it in
an ada-mode-hook for our team. How do you achive that?

(modify-syntax-entry ?_ "w" ada-mode-syntax-table)

As it turned out there is a better solution: emacs regular expressions
have word delimiters \< and \> but also separate symbol delimiters
\_< and \_>.  Replacing word delimiters with symbol delimiters in the
regular expression solves the problem completely:

--- ada-mode.el     2017-04-11 11:50:02.953881000 +0200
+++ ada-mode.el     2017-04-12 16:44:25.000000000 +0200
@@ -2137,9 +2137,9 @@
   )

 (defvar ada-operator-re
- "\\+\\|-\\|/\\|\\*\\*\\|\\*\\|=\\|&\\|\\<\\(abs\\|mod\\|rem\\|and\\|not\\|or\\|xor\\)\\>\\|<=\\|<\\|>=\\|>" - ;; This can match 'or' in This_Or_That if '_' does not have word syntax (the default).
-  "Regexp matching Ada operator_symbol.")
+ "\\+\\|-\\|/\\|\\*\\*\\|\\*\\|=\\|&\\|\\_<\\(abs\\|mod\\|rem\\|and\\|not\\|or\\|xor\\)\\_>\\|<=\\|<\\|>=\\|>" + "Regexp matching Ada operator_symbol. Word operators like 'abs' must be delimited by whitespace, others consisting of
+punctuation need not.")

 (defun ada-identifier-at-point ()
   "Return the identifier around point, move point to start of


--
Ludovic Brenta.




reply via email to

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