Commit 7dba1767 authored by Eli Zaretskii's avatar Eli Zaretskii Committed by Paul Eggert
Browse files

Fix problems caused by new implementation of sub-word mode

* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.

* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.

* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'.  (Bug#22560)

* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.

* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.

[This reapplies commit c1d32a65,
which was inadvertently lost by merge commit
c71e7cc1.]
parent 22cd92a0
......@@ -191,18 +191,25 @@ in the opposite direction.
@node Word Motion
@subsection Motion by Words
These functions for parsing words use the syntax table to decide
whether a given character is part of a word. @xref{Syntax Tables}.
The functions for parsing words described below use the syntax table
to decide whether a given character is part of a word. @xref{Syntax
Tables}.
@deffn Command forward-word &optional count
This function moves point forward @var{count} words (or backward if
@var{count} is negative). If @var{count} is omitted or @code{nil}, it
defaults to 1.
defaults to 1. In an interactive call, @var{count} is specified by
the numeric prefix argument.
``Moving one word'' means moving until point crosses a
word-constituent character and then encounters a word-separator
character. However, this function cannot move point past the boundary
of the accessible portion of the buffer, or across a field boundary
word-constituent character, which indicates the beginning of a word,
and then continue moving until the word ends. By default, characters
that begin and end words, known as @dfn{word boundaries}, are defined
by the current buffer's syntax table (@pxref{Syntax Class Table}), but
modes can override that by setting up a suitable
@code{find-word-boundary-function-table}, described below. In any
case, this function cannot move point past the boundary of the
accessible portion of the buffer, or across a field boundary
(@pxref{Fields}). The most common case of a field boundary is the end
of the prompt in the minibuffer.
......@@ -214,8 +221,6 @@ the buffer boundary or field boundary.
If @code{inhibit-field-text-motion} is non-@code{nil},
this function ignores field boundaries.
In an interactive call, @var{count} is specified by the numeric prefix
argument.
@end deffn
@deffn Command backward-word &optional count
......@@ -225,10 +230,10 @@ backward until encountering the front of a word, rather than forward.
@defopt words-include-escapes
@c Emacs 19 feature
This variable affects the behavior of @code{forward-word} and everything
that uses it. If it is non-@code{nil}, then characters in the
escape and character-quote syntax classes count as part of
words. Otherwise, they do not.
This variable affects the behavior of @code{forward-word} and
@code{backward-word}, and everything that uses them. If it is
non-@code{nil}, then characters in the escape and character-quote
syntax classes count as part of words. Otherwise, they do not.
@end defopt
@defvar inhibit-field-text-motion
......@@ -237,6 +242,37 @@ If this variable is non-@code{nil}, certain motion functions including
@code{forward-paragraph} ignore field boundaries.
@end defvar
@defvar find-word-boundary-function-table
This variable affects the behavior of @code{forward-word} and
@code{backward-word}, and everything that uses them. Its value is a
char-table (@pxref{Char-Tables}) of functions to search for word
boundaries. If a character has a non-@code{nil} entry in this table,
then when a word starts or ends with that character, the corresponding
function will be called with 2 arguments: @var{pos} and @var{limit}.
The function should return the position of the other word boundary.
Specifically, if @var{pos} is smaller than @var{limit}, then @var{pos}
is at the beginning of a word, and the function should return the
position after the last character of the word; otherwise, @var{pos} is
at the last character of a word, and the function should return the
position of that word's first character.
@end defvar
@defun forward-word-strictly &optional count
This function is like @code{forward-word}, but it is not affected by
@code{find-word-boundary-function-table}. Lisp programs that should
not change behavior when word movement is modified by modes which set
that table, such as @code{subword-mode}, should use this function
instead of @code{forward-word}.
@end defun
@defun backward-word-strictly &optional count
This function is like @code{backward-word}, but it is not affected by
@code{find-word-boundary-function-table}. Like with
@code{forward-word-strictly}, use this function instead of
@code{backward-word} when movement by words should only consider
syntax tables.
@end defun
@node Buffer End Motion
@subsection Motion to an End of the Buffer
@cindex move to beginning or end of buffer
......
......@@ -1629,6 +1629,14 @@ eliminated.
Removed font-lock-beginning-of-syntax-function and the SYNTAX-BEGIN
slot in font-lock-defaults.
+++
** The new implementation of Subword mode affects word movement everywhere.
When Subword mode is turned on, `forward-word', `backward-word', and
everything that uses them will move by sub-words, effectively
overriding the buffer's syntax table. Lisp programs that shouldn't be
affected by Subword mode should call the new functions
`forward-word-strictly' and `backward-word-strictly' instead.
+++
** `package-initialize' now sets `package-enable-at-startup' to nil if
called during startup. Users who call this function in their init
......
......@@ -700,7 +700,7 @@ of `let' or `let*', grab those variable names."
;; Snart args...
(up-list -1)
(forward-char 1)
(forward-word 1)
(forward-word-strictly 1)
(skip-chars-forward "* \t\n")
(let ((arglst (read (buffer-substring-no-properties
(point)
......
......@@ -258,7 +258,7 @@ can handle the @menu environment.")
(when (not parenthetical)
;; We are in parentheses. Are they the types of parens
;; belonging to a texinfo construct?
(forward-word -1)
(forward-word-strictly -1)
(when (looking-at "@\\w+{")
(setq done (point))))))
;; If we are not in a parenthetical node, then find a block instead.
......@@ -287,7 +287,7 @@ can handle the @menu environment.")
;; If we can't go up, we can't do this either.
t
;; We moved, so now we need to skip into whatever this thing is.
(forward-word 1) ;; skip the command
(forward-word-strictly 1) ;; skip the command
(if (looking-at "\\s-*{")
;; In a short command. Go in.
(down-list 1)
......
......@@ -542,13 +542,13 @@ But only if it is longer than `completion-min-length'."
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
(forward-word 1)
(forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char saved-point)))
;; Remove chars to ignore at the end.
(cond ((= (char-syntax (char-after (1- cmpl-symbol-end))) ?w)
(goto-char cmpl-symbol-end)
(forward-word -1)
(forward-word-strictly -1)
(setq cmpl-symbol-end (point))
(goto-char saved-point)))
;; Return completion if the length is reasonable.
......@@ -584,7 +584,7 @@ Returns nil if there isn't one longer than `completion-min-length'."
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
(forward-word 1)
(forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char cmpl-symbol-end)))
;; Return value if long enough.
......@@ -597,12 +597,12 @@ Returns nil if there isn't one longer than `completion-min-length'."
(let ((saved-point (point)))
(setq cmpl-symbol-start (scan-sexps saved-point -1))
;; take off chars. from end
(forward-word -1)
(forward-word-strictly -1)
(setq cmpl-symbol-end (point))
;; remove chars to ignore at the start
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
(forward-word 1)
(forward-word-strictly 1)
(setq cmpl-symbol-start (point))))
;; Restore state.
(goto-char saved-point)
......@@ -653,7 +653,7 @@ Returns nil if there isn't one longer than `completion-min-length'."
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
(forward-word 1)
(forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char cmpl-symbol-end)))
;; Return completion if the length is reasonable.
......@@ -821,7 +821,7 @@ This is sensitive to `case-fold-search'."
;; symbol char to ignore at end. Are we at end ?
(progn
(setq saved-point-2 (point))
(forward-word -1)
(forward-word-strictly -1)
(prog1
(= (char-syntax (preceding-char)) ? )
(goto-char saved-point-2)))))
......@@ -1850,7 +1850,7 @@ Prefix args ::
(cond ((looking-at "\\(define\\|ifdef\\)\\>")
;; skip forward over definition symbol
;; and add it to database
(and (forward-word 2)
(and (forward-word-strictly 2)
(setq string (symbol-before-point))
;;(push string foo)
(add-completion-to-tail-if-new string)))))
......@@ -1868,7 +1868,7 @@ Prefix args ::
;; move to next separator char.
(goto-char
(setq next-point (scan-sexps (point) 1))))
(forward-word -1)
(forward-word-strictly -1)
;; add to database
(if (setq string (symbol-under-point))
;; (push string foo)
......@@ -1876,7 +1876,7 @@ Prefix args ::
;; Local TMC hack (useful for parsing paris.h)
(if (and (looking-at "_AP") ;; "ansi prototype"
(progn
(forward-word -1)
(forward-word-strictly -1)
(setq string
(symbol-under-point))))
(add-completion-to-tail-if-new string)))
......
......@@ -1580,7 +1580,7 @@ mouse-[0-3]\\)\\)\\>"))
(if (and sym (boundp sym) (fboundp sym)
(save-excursion
(goto-char mb)
(forward-word -1)
(forward-word-strictly -1)
(not (looking-at
"variable\\|option\\|function\\|command\\|symbol"))))
(if (checkdoc-autofix-ask-replace
......@@ -1596,7 +1596,7 @@ mouse-[0-3]\\)\\)\\>"))
nil t nil nil "variable")))
(goto-char (1- mb))
(insert disambiguate " ")
(forward-word 1))
(forward-word-strictly 1))
(setq ret
(format "Disambiguate %s by preceding w/ \
function,command,variable,option or symbol." ms1))))))
......
......@@ -6568,7 +6568,7 @@ normally equivalent short `-D' option is just passed on to
(setq error-lines (nreverse error-lines))
;; Now read the numeric positions of file names.
(goto-char linebeg)
(forward-word 1)
(forward-word-strictly 1)
(forward-char 3)
(while (< (point) end)
(let ((start (insert-directory-adj-pos
......
......@@ -296,14 +296,14 @@ KEYWORD is the keyword expected."
(unless (char-equal char (json-peek))
(signal 'json-unknown-keyword
(list (save-excursion
(backward-word 1)
(backward-word-strictly 1)
(thing-at-point 'word)))))
(json-advance))
keyword)
(unless (looking-at "\\(\\s-\\|[],}]\\|$\\)")
(signal 'json-unknown-keyword
(list (save-excursion
(backward-word 1)
(backward-word-strictly 1)
(thing-at-point 'word)))))
(cond ((string-equal keyword "true") t)
((string-equal keyword "false") json-false)
......
......@@ -880,7 +880,7 @@ consing a string.)"
(and (not (eobp))
(eq ?w (char-syntax (char-after)))
(progn
(forward-word 1)
(forward-word-strictly 1)
(and (not (eobp))
(> (char-after) ?\177)
(not (eq (char-after) ? )))))))))
......@@ -1312,7 +1312,7 @@ consing a string.)"
)
(t
(setq atom-beg (point))
(forward-word 1)
(forward-word-strictly 1)
(setq atom-end (point))
(goto-char atom-beg)
(save-restriction
......
......@@ -574,7 +574,7 @@ of a mail alias. The value is set up, buffer-local, when first needed.")
(let ((end (point))
(beg (with-syntax-table mail-abbrev-syntax-table
(save-excursion
(backward-word 1)
(backward-word-strictly 1)
(point)))))
(completion-in-region beg end mail-abbrevs)))
......
......@@ -4089,7 +4089,7 @@ typically for purposes of moderating a list."
(set-syntax-table mail-abbrev-syntax-table)
(goto-char before)
(while (and (< (point) end)
(progn (forward-word 1)
(progn (forward-word-strictly 1)
(<= (point) end)))
(expand-abbrev))
(set-syntax-table old-syntax-table))
......
......@@ -1404,7 +1404,7 @@ just append to the file, in Babyl format if necessary."
(insert "\nFrom " (user-login-name) " " (current-time-string time) "\n")
;; Insert the time zone before the year.
(forward-char -1)
(forward-word -1)
(forward-word-strictly -1)
(require 'mail-utils)
(insert (mail-rfc822-time-zone time) " ")
(goto-char (point-max))
......
......@@ -347,7 +347,7 @@ It is assumed that the URL is either \"unguarded\" or is wrapped inside an
;; need to do a little more work to get to where we want to be.
(when (thing-at-point-looking-at thing-at-point-markedup-url-regexp)
(search-backward "<URL:"))
(backward-word 1)
(backward-word-strictly 1)
(let ((word (funcall quickurl-grab-lookup-function)))
(when word
(quickurl-make-url
......
......@@ -778,7 +778,7 @@ the 4 file locations can be clicked on and jumped to."
(beginning-of-line)
(looking-at ada-compile-goto-error-file-linenr-re))
(save-excursion
(if (looking-at "\\([0-9]+\\)") (backward-word 1))
(if (looking-at "\\([0-9]+\\)") (backward-word-strictly 1))
(looking-at "line \\([0-9]+\\)"))))
)
(let ((line (if (match-beginning 2) (match-string 2) (match-string 1)))
......@@ -1337,7 +1337,8 @@ the file name."
(save-excursion
(let ((aa-end (point)))
(ada-adjust-case-region
(progn (goto-char (symbol-value 'beg)) (forward-word -1) (point))
(progn (goto-char (symbol-value 'beg)) (forward-word-strictly -1)
(point))
(goto-char aa-end)))))
(defun ada-region-selected ()
......@@ -1395,7 +1396,8 @@ The standard casing rules will no longer apply to this word."
(save-excursion
(skip-syntax-backward "w")
(setq word (buffer-substring-no-properties
(point) (save-excursion (forward-word 1) (point)))))))
(point) (save-excursion (forward-word-strictly 1)
(point)))))))
;; Reread the exceptions file, in case it was modified by some other,
(ada-case-read-exceptions-from-file file-name)
......@@ -1444,7 +1446,8 @@ word itself has a special casing."
(skip-syntax-backward "w")
(setq word (buffer-substring-no-properties
(point)
(save-excursion (forward-word 1) (point))))))
(save-excursion (forward-word-strictly 1)
(point))))))
(modify-syntax-entry ?_ (make-string 1 underscore-syntax)
(syntax-table))))))
......@@ -1477,7 +1480,8 @@ word itself has a special casing."
;; do not add it again. This way, the user can easily decide which
;; priority should be applied to each casing exception
(let ((word (buffer-substring-no-properties
(point) (save-excursion (forward-word 1) (point)))))
(point) (save-excursion (forward-word-strictly 1)
(point)))))
;; Handling a substring ?
(if (char-equal (string-to-char word) ?*)
......@@ -1567,7 +1571,7 @@ and the exceptions defined in `ada-case-exception-file'."
(defun ada-after-keyword-p ()
"Return t if cursor is after a keyword that is not an attribute."
(save-excursion
(forward-word -1)
(forward-word-strictly -1)
(and (not (and (char-before)
(or (= (char-before) ?_)
(= (char-before) ?'))));; unless we have a _ or '
......@@ -1868,7 +1872,7 @@ Return the equivalent internal parameter list."
(goto-char apos)
(ada-goto-next-non-ws)
(while (looking-at "\\<\\(in\\|out\\|access\\)\\>")
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-next-non-ws))
;; read type of parameter
......@@ -2472,7 +2476,7 @@ and the offset."
(forward-comment -1000)
(if (= (char-before) ?\))
(forward-sexp -1)
(forward-word -1))
(forward-word-strictly -1))
;; If there is a parameter list, and we have a function declaration
;; or a access to subprogram declaration
......@@ -2480,26 +2484,26 @@ and the offset."
(if (and (= (following-char) ?\()
(save-excursion
(or (progn
(backward-word 1)
(backward-word-strictly 1)
(looking-at "\\(function\\|procedure\\)\\>"))
(progn
(backward-word 1)
(backward-word-strictly 1)
(setq num-back 2)
(looking-at "\\(function\\|procedure\\)\\>")))))
;; The indentation depends of the value of ada-indent-return
(if (<= (eval var) 0)
(list (point) (list '- var))
(list (progn (backward-word num-back) (point))
(list (progn (backward-word-strictly num-back) (point))
var))
;; Else there is no parameter list, but we have a function
;; Only do something special if the user want to indent
;; relative to the "function" keyword
(if (and (> (eval var) 0)
(save-excursion (forward-word -1)
(save-excursion (forward-word-strictly -1)
(looking-at "function\\>")))
(list (progn (forward-word -1) (point)) var)
(list (progn (forward-word-strictly -1) (point)) var)
;; Else...
(ada-indent-on-previous-lines nil orgpoint orgpoint)))))))
......@@ -2600,7 +2604,7 @@ and the offset."
;; avoid "with procedure"... in generic parts
(save-excursion
(forward-word -1)
(forward-word-strictly -1)
(setq found (not (looking-at "with"))))))
(cond
......@@ -2759,7 +2763,7 @@ ORGPOINT is the limit position used in the calculation."
;; yes, look what's following 'end'
(progn
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-next-non-ws)
(cond
;;
......@@ -2776,7 +2780,7 @@ ORGPOINT is the limit position used in the calculation."
(save-excursion
(ada-check-matching-start (match-string 0))
;; we are now looking at the matching "record" statement
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-stmt-start)
;; now on the matching type declaration, or use clause
(unless (looking-at "\\(for\\|type\\)\\>")
......@@ -2891,7 +2895,7 @@ ORGPOINT is the limit position used in the calculation."
(looking-at "\\<then\\>"))
(setq cur-indent (save-excursion (back-to-indentation) (point))))
;; skip 'then'
(forward-word 1)
(forward-word-strictly 1)
(list cur-indent 'ada-indent))
(list cur-indent 'ada-broken-indent))))
......@@ -2902,7 +2906,7 @@ ORGPOINT is the limit position used in the calculation."
(let ((pos nil))
(cond
((save-excursion
(forward-word 1)
(forward-word-strictly 1)
(setq pos (ada-goto-next-non-ws orgpoint)))
(goto-char pos)
(save-excursion
......@@ -3141,8 +3145,8 @@ ORGPOINT is the limit position used in the calculation."
(and
(goto-char (match-end 0))
(ada-goto-next-non-ws orgpoint)
(forward-word 1)
(if (= (char-after) ?') (forward-word 1) t)
(forward-word-strictly 1)
(if (= (char-after) ?') (forward-word-strictly 1) t)
(ada-goto-next-non-ws orgpoint)
(looking-at "\\<use\\>")
;;
......@@ -3224,7 +3228,7 @@ ORGPOINT is the limit position used in the calculation."
"end" nil orgpoint nil 'word-search-forward))
(ada-goto-next-non-ws)
(looking-at "\\<record\\>")
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-next-non-ws)
(= (char-after) ?\;)))
(goto-char (car match-dat))
......@@ -3334,7 +3338,7 @@ is the end of the match."
(save-excursion
(ada-goto-previous-word)
(looking-at "\\<\\(end\\|or\\|and\\)\\>[ \t]*[^;]")))
(forward-word -1))
(forward-word-strictly -1))
((looking-at "is")
(setq found
......@@ -3355,7 +3359,7 @@ is the end of the match."
((looking-at "private")
(save-excursion
(backward-word 1)
(backward-word-strictly 1)
(setq found (not (looking-at "is")))))
(t
......@@ -3459,18 +3463,18 @@ Moves point to the beginning of the declaration."
(if (looking-at "\\<declare\\>")
(progn
(forward-comment -1)
(backward-word 1))
(backward-word-strictly 1))
;;
;; no, => 'procedure'/'function'/'task'/'protected'
;;
(progn
(forward-word 2)
(backward-word 1)
(forward-word-strictly 2)
(backward-word-strictly 1)
;;
;; skip 'body' 'type'
;;
(if (looking-at "\\<\\(body\\|type\\)\\>")
(forward-word 1))
(forward-word-strictly 1))
(forward-sexp 1)
(backward-sexp 1)))
;;
......@@ -3566,7 +3570,7 @@ otherwise throw error."
;;
((looking-at "if")
(save-excursion
(forward-word -1)
(forward-word-strictly -1)
(unless (looking-at "\\<end[ \t\n]*if\\>")
(progn
(setq nest-count (1- nest-count))
......@@ -3636,7 +3640,7 @@ otherwise throw error."
;;
((looking-at "when")
(save-excursion
(forward-word -1)
(forward-word-strictly -1)
(unless (looking-at "\\<exit[ \t\n]*when\\>")
(progn
(if stop-at-when
......@@ -3687,7 +3691,7 @@ If GOTOTHEN is non-nil, point moves to the `then' following `if'."
(unless (and (looking-at "\\<record\\>")
(save-excursion
(forward-word -1)
(forward-word-strictly -1)
(looking-at "\\<null\\>")))
(progn
;; calculate nest-depth
......@@ -3739,7 +3743,7 @@ If GOTOTHEN is non-nil, point moves to the `then' following `if'."
(number-to-string (count-lines 1 (1+ current)))))))
(unless (looking-at "renames")
(progn
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-next-non-ws)
;; ignore it if it is only a declaration with 'new'
;; We could have package Foo is new ....
......@@ -3755,13 +3759,13 @@ If GOTOTHEN is non-nil, point moves to the `then' following `if'."
;; found task start => check if it has a body
((looking-at "task")
(save-excursion
(forward-word 1)
(forward-word-strictly 1)
(ada-goto-next-non-ws)
(cond
((looking-at "\\<body\\>"))
((looking-at "\\<type\\>")
;; In that case, do nothing if there is a "is"
(forward-word 2);; skip "type"
(forward-word-strictly 2);; skip "type"
(ada-goto-next-non-ws);; skip type name
;; Do nothing if we are simply looking at a simple
......@@ -3781,7 +3785,7 @@ If GOTOTHEN is non-nil, point moves to the `then' following `if'."
(t
;; Check if that task declaration had a block attached to
;; it (i.e do nothing if we have just "task name;")
(unless (progn (forward-word 1)
(unless (progn (forward-word-strictly 1)
(looking-at "[ \t]*;"))
(setq nest-count (1- nest-count))))))
(setq last-was-begin (cdr last-was-begin))
......@@ -3906,7 +3910,7 @@ If NOERROR is non-nil, it only returns nil if no matching start found."
;;
;; calculate nest-depth
;;
(backward-word 1)
(backward-word-strictly 1)
(cond
;; procedures and functions need to be processed recursively, in
;; case they are defined in a declare/begin block, as in:
......@@ -3925,7 +3929,7 @@ If NOERROR is non-nil, it only returns nil if no matching start found."
((and (looking-at "\\<procedure\\|function\\>"))
(if first
(forward-word 1)
(forward-word-strictly 1)
(setq pos (point))
(ada-search-ignore-string-comment "is\\|;")
......@@ -3946,7 +3950,7 @@ If NOERROR is non-nil, it only returns nil if no matching start found."
(skip-chars-forward "end")
(ada-goto-next-non-ws)
(looking-at "\\<\\(loop\\|select\\|record\\|case\\|if\\)\\>"))
(forward-word 1)))
(forward-word-strictly 1)))
;; found package start => check if it really starts a block, and is not
;; in fact a generic instantiation for instance
......@@ -3965,7 +3969,7 @@ If NOERROR is non-nil, it only returns nil if no matching start found."
(if (not first)
(setq nest-count (1+ nest-count)))
(setq found (<= nest-count 0))
(forward-word 1))) ; end of 'cond'
(forward-word-strictly 1))) ; end of 'cond'
(setq first nil))
......@@ -4077,7 +4081,7 @@ Assumes point to be at the end of a statement."
(save-excursion
(and (looking-at "\\<or\\>")