diff options
author | Eli Zaretskii <eliz@gnu.org> | 2016-02-05 23:54:21 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-02-05 23:54:21 +0200 |
commit | c1d32a65372c72d7de4808d620eefd3214a8e92a (patch) | |
tree | c1dabeb7fc6b5a979ab51787c765ded60630c533 /lisp | |
parent | d3337167c2a4d09444908cfc875ac4077a02279d (diff) | |
download | emacs-c1d32a65372c72d7de4808d620eefd3214a8e92a.tar.gz |
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'.
Diffstat (limited to 'lisp')
40 files changed, 254 insertions, 206 deletions
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index 7824942d96f..6f41ba3064f 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el @@ -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) diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 8b4f6f4e14b..cbb7705f9d1 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -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) diff --git a/lisp/completion.el b/lisp/completion.el index 06594217107..093740d2cc3 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -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))) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index ecf6f8203a2..fd8f108a54e 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -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)))))) diff --git a/lisp/files.el b/lisp/files.el index 72c2752634e..1c4dd25dbfd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6520,7 +6520,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 diff --git a/lisp/json.el b/lisp/json.el index bd1ee531656..1eabe0fa33c 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -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) diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index 63849679e70..44a082c330d 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el @@ -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 diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el index ed6a74349f5..a047f5f000a 100644 --- a/lisp/mail/mailabbrev.el +++ b/lisp/mail/mailabbrev.el @@ -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))) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 390ca3fad52..2e441ec16d3 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4081,7 +4081,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)) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 5ab5bd9a2cd..58f708a0c1e 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -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)) diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el index 7a46485531a..bb9ce31307b 100644 --- a/lisp/net/quickurl.el +++ b/lisp/net/quickurl.el @@ -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 diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 12ab5b01ab3..0c25d4d42ea 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -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\\>") (progn - (forward-word 1) + (forward-word-strictly 1) (ada-goto-stmt-start) (looking-at "\\<or\\>"))))) @@ -4100,7 +4104,7 @@ Return nil if the private is part of the package name, as in (progn (forward-comment -1000) (and (not (bobp)) (or (= (char-before) ?\;) - (and (forward-word -3) + (and (forward-word-strictly -3) (looking-at "\\<package\\>")))))))) @@ -4120,11 +4124,11 @@ Return nil if the private is part of the package name, as in (skip-chars-backward " \t\n") (if (= (char-before) ?\") (backward-char 3) - (backward-word 1)) + (backward-word-strictly 1)) t) ;; and now over the second one - (backward-word 1) + (backward-word-strictly 1) ;; We should ignore the case when the reserved keyword is in a ;; comment (for instance, when we have: @@ -4150,7 +4154,7 @@ Return nil if the private is part of the package name, as in If BACKWARDP is non-nil, search backward; search forward otherwise." (let (result) (while (and (setq result (ada-search-ignore-string-comment regexp backwardp)) - (save-excursion (forward-word -1) + (save-excursion (forward-word-strictly -1) (looking-at "and then\\|or else")))) result)) @@ -4343,9 +4347,9 @@ of the region. Otherwise, operate only on the current line." (ada-in-string-or-comment-p) (and (progn (or (looking-at "[ \t]*\\<end\\>") - (backward-word 1)) + (backward-word-strictly 1)) (or (looking-at "[ \t]*\\<end\\>") - (backward-word 1)) + (backward-word-strictly 1)) (or (looking-at "[ \t]*\\<end\\>") (error "Not on end ...;"))) (ada-goto-matching-start 1) @@ -4399,7 +4403,7 @@ Moves to `begin' if in a declarative part." ((save-excursion (and (ada-goto-stmt-start) (looking-at "\\<task\\>" ) - (forward-word 1) + (forward-word-strictly 1) (ada-goto-next-non-ws) (looking-at "\\<body\\>"))) (ada-search-ignore-string-comment "begin" nil nil nil @@ -5020,7 +5024,7 @@ Since the search can be long, the results are cached." (skip-chars-forward " \t\n") (if (looking-at "return") (progn - (forward-word 1) + (forward-word-strictly 1) (skip-chars-forward " \t\n") (skip-chars-forward "a-zA-Z0-9_'"))) @@ -5271,8 +5275,8 @@ for `ada-procedure-start-regexp'." ((or (looking-at "^[ \t]*procedure") (setq func-found (looking-at "^[ \t]*function"))) ;; treat it as a proc/func - (forward-word 2) - (forward-word -1) + (forward-word-strictly 2) + (forward-word-strictly -1) (setq procname (buffer-substring (point) (cdr match))) ; store proc name ;; goto end of procname @@ -5285,7 +5289,7 @@ for `ada-procedure-start-regexp'." ;; if function, skip over 'return' and result type. (if func-found (progn - (forward-word 1) + (forward-word-strictly 1) (skip-chars-forward " \t\n") (setq functype (buffer-substring (point) (progn @@ -5327,7 +5331,7 @@ for `ada-procedure-start-regexp'." (if (looking-at "^[ \t]*task") (progn (message "Task conversion is not yet implemented") - (forward-word 2) + (forward-word-strictly 2) (if (looking-at "[ \t]*;") (forward-line) (ada-move-to-end)) diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index d59503be61a..a2077be24fc 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -449,7 +449,7 @@ class Foo class Foo Works with: inher-cont." (save-excursion (goto-char (c-langelem-pos langelem)) - (forward-word 1) + (forward-word-strictly 1) (if (looking-at "[ \t]*$") c-basic-offset (c-forward-syntactic-ws) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index d30447fe554..a4a1604e6f4 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6041,7 +6041,7 @@ comment at the start of cc-engine.el for more info." (when (or (looking-at "extends") (looking-at "super")) - (forward-word) + (forward-word-strictly) (c-forward-syntactic-ws) (let ((c-promote-possible-types t) (c-record-found-types t)) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index de546f7c1d4..83eded136eb 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -2304,7 +2304,7 @@ to nil." (memq this-command '(self-insert-command newline)))) head1 notlast name p really-delete over) (and (save-excursion - (forward-word -1) + (forward-word-strictly -1) (and (eq (preceding-char) ?=) (progn @@ -2327,7 +2327,7 @@ to nil." (progn (insert "\n\n=cut") (cperl-ensure-newlines 2) - (forward-word -2) + (forward-word-strictly -2) (if (and head1 (not (save-excursion @@ -2335,7 +2335,7 @@ to nil." (re-search-backward "\\(\\`\n?\\|\n\n\\)=head1\\>" nil t)))) ; Only one (progn - (forward-word 1) + (forward-word-strictly 1) (setq name (file-name-base) p (point)) (insert " NAME\n\n" name @@ -2343,10 +2343,10 @@ to nil." "=head1 DESCRIPTION") (cperl-ensure-newlines 4) (goto-char p) - (forward-word 2) + (forward-word-strictly 2) (end-of-line) (setq really-delete t)) - (forward-word 1)))) + (forward-word-strictly 1)))) (if over (progn (setq p (point)) @@ -2354,7 +2354,7 @@ to nil." "=back") (cperl-ensure-newlines 2) (goto-char p) - (forward-word 1) + (forward-word-strictly 1) (end-of-line) (setq really-delete t))) (if (and delete really-delete) @@ -2480,7 +2480,7 @@ If in POD, insert appropriate lines." (if (and over (progn (forward-paragraph -1) - (forward-word 1) + (forward-word-strictly 1) (setq pos (point)) (setq cut (buffer-substring (point) (point-at-eol))) (delete-char (- (point-at-eol) (point))) @@ -2531,7 +2531,7 @@ If in POD, insert appropriate lines." ;; and do no indentation for them. (and (eq last-command-event ?:) (save-excursion - (forward-word 1) + (forward-word-strictly 1) (skip-chars-forward " \t") (and (< (point) end) (progn (goto-char (- end 1)) @@ -4309,7 +4309,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', ;; Now: tail: if the second part is non-matching without ///e (if (eq (char-syntax (following-char)) ?w) (progn - (forward-word 1) ; skip modifiers s///s + (forward-word-strictly 1) ; skip modifiers s///s (if tail (cperl-commentify tail (point) t)) (cperl-postpone-fontification e1 (point) 'face my-cperl-REx-modifiers-face))) @@ -5110,7 +5110,7 @@ Returns some position at the last line." (if (looking-at "[ \t]*}?[ \t]*\\<\\(\\els\\(e\\|if\\)\\|continue\\|unless\\|if\\|while\\|for\\(each\\)?\\|until\\)\\>\\(\t*\\|[ \t][ \t]+\\)[^ \t\n#]") (progn - (forward-word 1) + (forward-word-strictly 1) (delete-horizontal-space) (insert (make-string cperl-indent-region-fix-constructs ?\s)) (beginning-of-line))) @@ -5119,7 +5119,7 @@ Returns some position at the last line." (if (looking-at "[ \t]*\\<for\\(each\\)?[ \t]+\\(my\\|local\\|our\\)\\(\t*\\|[ \t][ \t]+\\)[^ \t\n]") (progn - (forward-word 2) + (forward-word-strictly 2) (delete-horizontal-space) (insert (make-string cperl-indent-region-fix-constructs ?\s)) (beginning-of-line))) @@ -8502,7 +8502,7 @@ the appropriate statement modifier." (insert B " ") (and B-comment (insert B-comment " ")) (just-one-space) - (forward-word 1) + (forward-word-strictly 1) (setq pre-A (point)) (insert " " A ";") (delete-horizontal-space) diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 588f4d99d78..58397530e4f 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -2355,7 +2355,8 @@ CHANGE-WORD should be one of `upcase-word', `downcase-word', `capitalize-word'." (setq ref-point (point) ;; FIXME this does not work for constructs with ;; embedded space, eg "sync all". - back-point (save-excursion (backward-word 1) (point)) + back-point (save-excursion (backward-word-strictly 1) + (point)) saveword (buffer-substring back-point ref-point)) (funcall change-word -1) (or (string= saveword (buffer-substring back-point ref-point)) diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 8a87eb9770a..6b5f51a3fbd 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -1828,7 +1828,7 @@ This allows #ifdef VAR to be hidden." (let* ((default (save-excursion (beginning-of-line) (cond ((looking-at hif-ifx-else-endif-regexp) - (forward-word 2) + (forward-word-strictly 2) (current-word 'strict)) (t nil)))) diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el index 7fde29dcf7a..c91f98e3206 100644 --- a/lisp/progmodes/icon.el +++ b/lisp/progmodes/icon.el @@ -404,8 +404,8 @@ Returns nil if line starts inside a string, t if in a comment." (ch-syntax (char-syntax ch))) (if (eq ch-syntax ?w) (assoc (buffer-substring - (progn (forward-word -1) (point)) - (progn (forward-word 1) (point))) + (progn (forward-word-strictly -1) (point)) + (progn (forward-word-strictly 1) (point))) icon-resword-alist) (not (memq ch '(0 ?\; ?\} ?\{ ?\) ?\] ?\" ?\' ?\# ?\, ?\. ?\n)))))) @@ -431,7 +431,8 @@ Returns nil if line starts inside a string, t if in a comment." ((and (eq (char-syntax (following-char)) ?w) (cdr (assoc (buffer-substring (point) - (save-excursion (forward-word 1) (point))) + (save-excursion (forward-word-strictly 1) + (point))) icon-resword-alist))) 0) (t (end-of-line 0) (icon-backward-to-start-of-continued-exp lim)))) @@ -475,7 +476,7 @@ Returns nil if line starts inside a string, t if in a comment." (interactive) (if (not (bobp)) (forward-char -1)) (re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" (point-max) 'move) - (forward-word -1) + (forward-word-strictly -1) (forward-line 1)) (defun indent-icon-exp () diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index ab87a584bfd..9cb2ca74063 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -2118,7 +2118,7 @@ An END token must be preceded by whitespace." (if (not (idlwave-quoted)) (if (save-excursion - (backward-word 1) + (backward-word-strictly 1) (backward-char 1) (looking-at "[ \t\n\f]")) (idlwave-show-begin)))) @@ -2435,13 +2435,13 @@ If prefix ARG < 0 then move forward to enclosing block end." "Go to the beginning of the current block." (interactive) (idlwave-block-jump-out -1 'nomark) - (forward-word 1)) + (forward-word-strictly 1)) (defun idlwave-end-of-block () "Go to the beginning of the current block." (interactive) (idlwave-block-jump-out 1 'nomark) - (backward-word 1)) + (backward-word-strictly 1)) (defun idlwave-forward-block (&optional arg) "Move across next nested block." @@ -3150,12 +3150,12 @@ possibility of unbalanced blocks." (if (>= dir 0) (end-of-line)) ;Make sure we are in current block (if (setq found (idlwave-find-key block-reg dir t unit-limit)) (while (and found (looking-at block-limit)) - (if (>= dir 0) (forward-word 1)) + (if (>= dir 0) (forward-word-strictly 1)) (idlwave-block-jump-out dir t) (setq found (idlwave-find-key block-reg dir t unit-limit)))) (if (not nomark) (push-mark here)) (if (not found) (goto-char unit-limit) - (if (>= dir 0) (forward-word 1))))) + (if (>= dir 0) (forward-word-strictly 1))))) (defun idlwave-min-current-statement-indent (&optional end-reg) "The minimum indent in the current statement." @@ -6325,7 +6325,7 @@ Must accept two arguments: `apos' and `info'.") (is-self (and arrow (save-excursion (goto-char apos) - (forward-word -1) + (forward-word-strictly -1) (let ((case-fold-search t)) (looking-at "self\\>"))))) (force-query idlwave-force-class-query) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 07849484b78..d59e7679b47 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -838,7 +838,7 @@ return the name of the function, or t if the name could not be determined. Otherwise, return nil." (cl-assert (looking-at "\\_<function\\_>")) (let ((name t)) - (forward-word) + (forward-word-strictly) (forward-comment most-positive-fixnum) (when (eq (char-after) ?*) (forward-char) diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el index 913849df324..ea9d400dd9e 100644 --- a/lisp/progmodes/mantemp.el +++ b/lisp/progmodes/mantemp.el @@ -157,8 +157,8 @@ the lines." "^template class [A-z :&*<>~=,0-9+!]*(" nil t nil) (progn (beginning-of-line) - (forward-word 1) - (delete-region (point) (progn (forward-word 1) (point))))))) + (forward-word-strictly 1) + (delete-region (point) (progn (forward-word-strictly 1) (point))))))) (defun mantemp-make-mantemps () "Gathering interface to the functions modifying the buffer." diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 28619a55853..f309565acff 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -1088,7 +1088,7 @@ The value is (START END NAME-START NAME-END) of the function." (save-excursion (goto-char (point-min)) (when (equal (funcall smie-forward-token-function) "function") - (forward-word -1) + (forward-word-strictly -1) (let* ((start (point)) (end (progn (forward-sexp 1) (point))) (name (when (progn diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el index b0929ebd040..76441ea03e6 100644 --- a/lisp/progmodes/pascal.el +++ b/lisp/progmodes/pascal.el @@ -1023,7 +1023,7 @@ indent of the current line in parameterlist." (let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg start) ":" "=")) (stpos (if start start - (forward-word 2) (backward-word 1) (point))) + (forward-word-strictly 2) (backward-word 1) (point))) (edpos (set-marker (make-marker) (if end end (max (progn (pascal-declaration-end) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 241521bef4d..7ed87e8f033 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -301,7 +301,7 @@ ;; sub tr {...} (3 (ignore (if (save-excursion (goto-char (match-beginning 0)) - (forward-word -1) + (forward-word-strictly -1) (looking-at-p "sub[ \t\n]")) ;; This is defining a function. nil @@ -404,7 +404,8 @@ (skip-syntax-backward " ") (skip-syntax-backward "w") (member (buffer-substring - (point) (progn (forward-word 1) (point))) + (point) (progn (forward-word-strictly 1) + (point))) '("tr" "s" "y")))) (close (cdr (assq char perl-quote-like-pairs))) (st (perl-quote-syntax-table char))) @@ -993,7 +994,7 @@ Returns (parse-state) if line starts inside a string." ((memq c '(?\) ?\] ?\} ?\")) (forward-sexp -1) (forward-comment (- (point))) t) ((eq ?w (char-syntax c)) - (forward-word -1) (forward-comment (- (point))) t) + (forward-word-strictly -1) (forward-comment (- (point))) t) (t (forward-char -1) (forward-comment (- (point))) t))))) ;; note: this may be slower than the c-mode version, but I can understand it. diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el index 79c32c62a5c..2fc0d29ec9b 100644 --- a/lisp/progmodes/ps-mode.el +++ b/lisp/progmodes/ps-mode.el @@ -1082,7 +1082,7 @@ Use line numbers if `ps-run-error-line-numbers' is not nil" (goto-char (max 1 (1- (point))))) (when (looking-at "[0-9]") (forward-char 1) - (forward-word -1) + (forward-word-strictly -1) (when (looking-at "[0-9]+") (let (i) (setq diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index e3fe315f3bd..9fbebebe594 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -450,7 +450,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." (defun ruby-smie--redundant-do-p (&optional skip) (save-excursion - (if skip (backward-word 1)) + (if skip (backward-word-strictly 1)) (member (nth 2 (smie-backward-sexp ";")) '("while" "until" "for")))) (defun ruby-smie--opening-pipe-p () @@ -517,7 +517,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." (setq tok (concat "." tok))) (cond ((member tok '("unless" "if" "while" "until")) - (if (save-excursion (forward-word -1) (ruby-smie--bosp)) + (if (save-excursion (forward-word-strictly -1) (ruby-smie--bosp)) tok "iuwu-mod")) ((string-match-p "\\`|[*&]?\\'" tok) (forward-char (- 1 (length tok))) @@ -577,7 +577,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." ((equal tok "do") (cond ((not (ruby-smie--redundant-do-p)) tok) - ((> (save-excursion (forward-word 1) + ((> (save-excursion (forward-word-strictly 1) (forward-comment (point-max)) (point)) (line-end-position)) (ruby-smie--backward-token)) ;Fully redundant. @@ -891,7 +891,7 @@ and `\\' when preceded by `?'." (defun ruby-singleton-class-p (&optional pos) (save-excursion (when pos (goto-char pos)) - (forward-word -1) + (forward-word-strictly -1) (and (or (bolp) (not (eq (char-before (point)) ?_))) (looking-at ruby-singleton-class-re)))) @@ -1234,7 +1234,7 @@ delimiter." ((let ((s (ruby-parse-region (point) ruby-indent-point))) (and (nth 2 s) (> (nth 2 s) 0) (or (goto-char (cdr (nth 1 s))) t))) - (forward-word -1) + (forward-word-strictly -1) (setq indent (ruby-indent-size (current-column) (nth 2 state)))) (t @@ -1253,7 +1253,7 @@ delimiter." (if (null (cdr (nth 1 state))) (error "Invalid nesting")) (goto-char (cdr (nth 1 state))) - (forward-word -1) ; skip back a keyword + (forward-word-strictly -1) ; skip back a keyword (setq begin (point)) (cond ((looking-at "do\\>[^_]") ; iter block is a special case @@ -1346,7 +1346,7 @@ delimiter." (forward-char -1) (not (looking-at "{"))) (progn - (forward-word -1) + (forward-word-strictly -1) (not (looking-at "do\\>[^_]"))))) (t t)))) (not (eq ?, c)) @@ -1499,10 +1499,11 @@ With ARG, do it many times. Negative ARG means move backward." (not (eq (char-before (point)) ?.)) (not (eq (char-before (point)) ?:))) (ruby-end-of-block) - (forward-word 1)) + (forward-word-strictly 1)) ((looking-at "\\(\\$\\|@@?\\)?\\sw") (while (progn - (while (progn (forward-word 1) (looking-at "_"))) + (while (progn (forward-word-strictly 1) + (looking-at "_"))) (cond ((looking-at "::") (forward-char 2) t) ((> (skip-chars-forward ".") 0)) ((looking-at "\\?\\|!\\(=[~=>]\\|[^~=]\\)") @@ -1518,7 +1519,7 @@ With ARG, do it many times. Negative ARG means move backward." (skip-chars-forward "<")) (not expr)))) (setq i (1- i))) - ((error) (forward-word 1))) + ((error) (forward-word-strictly 1))) i)))) (defun ruby-backward-sexp (&optional arg) @@ -1554,7 +1555,7 @@ With ARG, do it many times. Negative ARG means move forward." ((looking-at "\\s(") nil) (t (forward-char 1) - (while (progn (forward-word -1) + (while (progn (forward-word-strictly -1) (pcase (char-before) (`?_ t) (`?. (forward-char -1) t) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 7f89ab2762c..4fb58353b31 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2192,7 +2192,7 @@ Returns the construct's token and moves point before it, if so." Point should be before the newline." (save-excursion (let ((tok (funcall smie-backward-token-function))) - (if (or (when (equal tok "not") (forward-word 1) t) + (if (or (when (equal tok "not") (forward-word-strictly 1) t) (and (zerop (length tok)) (eq (char-before) ?\)))) (not (sh-smie--rc-after-special-arg-p)) (sh-smie--newline-semi-p tok))))) diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el index 0c420dfbec6..d627309d6a4 100644 --- a/lisp/progmodes/simula.el +++ b/lisp/progmodes/simula.el @@ -568,7 +568,7 @@ The relative indentation among the lines of the statement are preserved." (if (and (eq (char-syntax (preceding-char)) ?w) (eq (char-syntax (following-char)) ?w)) (save-excursion - (backward-word 1) + (backward-word-strictly 1) (if (looking-at "end\\>\\|else\\>\\|otherwise\\>\\|when\\>") (setq return-value nil))))) ((memq (preceding-char) '(?! ?t ?T)) @@ -654,12 +654,12 @@ If COUNT is negative, move forward up block level instead." (1+ count))))) (while (< count 0) (re-search-forward "\\<begin\\>\\|\\<end\\>") - (backward-word 1) + (backward-word-strictly 1) (if (not (simula-context)) (setq count (if (memq (following-char) '(?e ?E)) (1+ count) (1- count)))) - (backward-word -1))) + (backward-word-strictly -1))) ;; If block level not found, jump back to origin and signal an error (error (progn (goto-char origin) @@ -689,12 +689,12 @@ If COUNT is negative, move backward down block level instead." (if (< count start-count) (signal 'error nil))) (while (> count 0) (re-search-forward "\\<begin\\>\\|\\<end\\>") - (backward-word 1) + (backward-word-strictly 1) (if (not (simula-context)) (setq count (if (memq (following-char) '(?b ?B)) (1- count) (1+ count)))) - (backward-word -1) + (backward-word-strictly -1) ;; deeper level has to be found within starting block (if (> count start-count) (signal 'error nil)))) ;; If block level not found, jump back to origin and signal an error @@ -721,9 +721,9 @@ If COUNT is negative, move forward instead." (simula-skip-comment-backward) (if (memq (preceding-char) '(?n ?N)) (progn - (backward-word 1) + (backward-word-strictly 1) (if (not (looking-at "\\<begin\\>")) - (backward-word -1))) + (backward-word-strictly -1))) (if (eq (preceding-char) ?\;) (backward-char 1)) ) @@ -734,7 +734,7 @@ If COUNT is negative, move forward instead." (progn (if (eq (following-char) ?\;) (forward-char 1) - (backward-word -1)))) + (backward-word-strictly -1)))) (simula-skip-comment-forward)) (error (progn (goto-char origin) (error "Incomplete statement (too many ENDs)"))) @@ -753,13 +753,13 @@ If COUNT is negative, move backward instead." (condition-case () (progn (simula-skip-comment-forward) - (if (looking-at "\\<end\\>") (forward-word 1)) + (if (looking-at "\\<end\\>") (forward-word-strictly 1)) (while (and (natnump (setq count (1- count))) (setq status (simula-search-forward ";\\|\\<end\\>" (point-max) 'move)))) (if (and status (/= (preceding-char) ?\;)) (progn - (backward-word 1) + (backward-word-strictly 1) (simula-skip-comment-backward)))) (error (progn (goto-char origin) (error "Incomplete statement (too few ENDs)"))) @@ -802,7 +802,7 @@ If COUNT is negative, move backward instead." ((eq context 2) ;; an END-comment must belong to an END (re-search-backward "\\<end\\>") - (forward-word 1) + (forward-word-strictly 1) (throw 'simula-out nil)) ;; should be impossible to get here.. ))))) @@ -915,7 +915,7 @@ If COUNT is negative, move backward instead." ((memq (following-char) '(?E ?e)) (setq indent (cdr simula-if-indent))) (t - (forward-word 1) + (forward-word-strictly 1) (setq indent 0))) (simula-find-if)) ;; @@ -939,7 +939,7 @@ If COUNT is negative, move backward instead." (not (eq (preceding-char) ?\;)) (if (memq (preceding-char) '(?N ?n)) (save-excursion - (backward-word 1) + (backward-word-strictly 1) (not (looking-at "begin\\>"))) t)) (progn @@ -954,7 +954,7 @@ If COUNT is negative, move backward instead." ;; (not found-end) (if (eq (char-syntax (preceding-char)) ?w) (progn - (backward-word 1) + (backward-word-strictly 1) (not (looking-at "begin\\|then\\|else\\|when\\|otherwise\\|do" ))) @@ -975,14 +975,14 @@ If COUNT is negative, move backward instead." ((looking-at "begin\\>") (setq indent (+ indent simula-indent-level))) ((looking-at "end\\>") - (forward-word 1) + (forward-word-strictly 1) (simula-previous-statement 1)) ((looking-at "do\\>") (setq indent (+ indent simula-substatement-offset)) (simula-find-do-match)) ((looking-at "\\(if\\|then\\|else\\)\\>") (if (memq temp '(?I ?i)) - (forward-word 1) + (forward-word-strictly 1) (setq indent (+ indent simula-substatement-offset (if (memq temp '(?T ?t)) @@ -1030,7 +1030,7 @@ If COUNT is negative, move backward instead." (and (not (bobp)) (if (eq (char-syntax (preceding-char)) ?w) (save-excursion - (backward-word 1) + (backward-word-strictly 1) (not (looking-at "begin\\|then\\|else\\|when\\|otherwise\\|do"))) (not (memq (preceding-char) '(?: ?\;)))))) @@ -1067,7 +1067,7 @@ If COUNT is negative, move backward instead." (simula-skip-comment-backward) (if (and (eq (char-syntax (preceding-char)) ?w) (progn - (backward-word 1) + (backward-word-strictly 1) (looking-at "else\\>"))) () (throw 'simula-out t))) @@ -1189,7 +1189,7 @@ If COUNT is negative, move backward instead." (if where (if (and (eq where 2) (eq (char-syntax (preceding-char)) ?w)) (save-excursion - (backward-word 1) + (backward-word-strictly 1) (not (looking-at "end\\>")))))) (unexpand-abbrev) (cond @@ -1204,7 +1204,7 @@ If COUNT is negative, move backward instead." ;; check if the expanded word is on the beginning of the line. (if (and (eq (char-syntax (preceding-char)) ?w) (progn - (backward-word 1) + (backward-word-strictly 1) (if (looking-at "end\\>") (save-excursion (simula-backward-up-level 1) diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el index 987022e8cb3..00b287e69e6 100644 --- a/lisp/progmodes/vera-mode.el +++ b/lisp/progmodes/vera-mode.el @@ -1109,7 +1109,7 @@ try to increase performance by using this macro." ((and (save-excursion (vera-backward-syntactic-ws nil t) ;; previous line ends with a block opening? - (or (/= (skip-chars-backward "{") 0) (backward-word 1)) + (or (/= (skip-chars-backward "{") 0) (backward-word-strictly 1)) (when (looking-at vera-beg-block-re) ;; go to beginning of substatement (vera-beginning-of-substatement) @@ -1162,7 +1162,7 @@ try to increase performance by using this macro." ;; is this line preceded by a substatement opening statement? ((save-excursion (vera-backward-syntactic-ws nil t) (when (= (preceding-char) ?\)) (backward-sexp)) - (backward-word 1) + (backward-word-strictly 1) (setq placeholder (point)) (looking-at vera-beg-substatement-re)) (goto-char placeholder) @@ -1225,7 +1225,7 @@ Calls `indent-region' for whole buffer." "If previous word is a block closing or `else', indent line again." (when (= (char-syntax (preceding-char)) ?w) (save-excursion - (backward-word 1) + (backward-word-strictly 1) (when (and (not (vera-in-literal)) (looking-at (concat vera-end-block-re "\\|\\<else\\>"))) (indent-according-to-mode))))) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 7bd43a39325..8e0133006d6 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -3454,7 +3454,7 @@ Use filename, if current buffer being edited shorten to just buffer name." (found nil) (st (point))) (if (not (looking-at "\\<")) - (forward-word -1)) + (forward-word-strictly -1)) (cond ((verilog-skip-backward-comment-or-string)) ((looking-at "\\<else\\>") @@ -3506,7 +3506,7 @@ Use filename, if current buffer being edited shorten to just buffer name." (st (point)) (nest 'yes)) (if (not (looking-at "\\<")) - (forward-word -1)) + (forward-word-strictly -1)) (cond ((verilog-skip-forward-comment-or-string) (verilog-forward-syntactic-ws)) @@ -3529,11 +3529,11 @@ Use filename, if current buffer being edited shorten to just buffer name." (and (looking-at "fork") (progn (setq here (point)) ; sometimes a fork is just a fork - (forward-word -1) + (forward-word-strictly -1) (looking-at verilog-disable-fork-re)))) (progn ; it is a disable fork; ignore it (goto-char (match-end 0)) - (forward-word 1) + (forward-word-strictly 1) (setq reg nil)) (progn ; it is a nice simple fork (goto-char here) ; return from looking for "disable fork" @@ -3583,7 +3583,7 @@ Use filename, if current buffer being edited shorten to just buffer name." ;; Search forward for matching endclocking (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" ))) (if (and reg - (forward-word 1)) + (forward-word-strictly 1)) (catch 'skip (if (eq nest 'yes) (let ((depth 1) @@ -3602,7 +3602,7 @@ Use filename, if current buffer being edited shorten to just buffer name." (looking-at verilog-disable-fork-re) (and (looking-at "fork") (progn - (forward-word -1) + (forward-word-strictly -1) (looking-at verilog-disable-fork-re)))) (progn ; it is a disable fork; another false alarm (goto-char (match-end 0))) @@ -4276,7 +4276,7 @@ Uses `verilog-scan' cache." ;; stop if we see a named coverpoint (looking-at "\\w+\\W*:\\W*\\(coverpoint\\|cross\\|constraint\\)") ;; keep going if we are in the middle of a word - (not (or (looking-at "\\<") (forward-word -1))) + (not (or (looking-at "\\<") (forward-word-strictly -1))) ;; stop if we see an assertion (perhaps labeled) (and (looking-at "\\(\\w+\\W*:\\W*\\)?\\(\\<\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(\\<assert\\>\\)") @@ -4825,7 +4825,7 @@ primitive or interface named NAME." ((looking-at "\\<end\\>") ;; HERE - (forward-word 1) + (forward-word-strictly 1) (verilog-forward-syntactic-ws) (setq err nil) (setq str (verilog-get-expr)) @@ -5940,7 +5940,7 @@ Set point to where line starts." (verilog-backward-up-list 1) (verilog-backward-syntactic-ws) (let ((back (point))) - (forward-word -1) + (forward-word-strictly -1) (cond ;;XX ((looking-at "\\<\\(always\\(_latch\\|_ff\\|_comb\\)?\\|case\\(\\|[xz]\\)\\|for\\(\\|each\\|ever\\)\\|i\\(f\\|nitial\\)\\|repeat\\|while\\)\\>") @@ -5981,11 +5981,11 @@ Set point to where line starts." (;-- any of begin|initial|while are complete statements; 'begin : foo' is also complete t - (forward-word -1) + (forward-word-strictly -1) (while (or (= (preceding-char) ?\_) (= (preceding-char) ?\@) (= (preceding-char) ?\.)) - (forward-word -1)) + (forward-word-strictly -1)) (cond ((looking-at "\\<else\\>") t) @@ -6499,7 +6499,7 @@ Only look at a few lines to determine indent level." (= (following-char) ?\`)) (progn (forward-char 1) - (forward-word 1) + (forward-word-strictly 1) (skip-chars-forward " \t"))) ((= (following-char) ?\[) (progn diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index b176e64652e..5c78aaa1daa 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -6577,7 +6577,7 @@ returned point is at the first character of the \"libunit\" keyword." ;; keyword, allow for the keyword and an extra character, ;; as this will be used when looking forward for the ;; "begin" keyword. - (save-excursion (forward-word 1) (1+ (point)))) + (save-excursion (forward-word-strictly 1) (1+ (point)))) foundp literal placeholder) ;; Find the "libunit" keyword. (while (and (not foundp) @@ -6628,7 +6628,7 @@ stops due to beginning or end of buffer." ;; keyword, allow for the keyword and an extra character, ;; as this will be used when looking forward for the ;; "begin" keyword. - (save-excursion (forward-word 1) (1+ (point)))) + (save-excursion (forward-word-strictly 1) (1+ (point)))) begin-string literal) (while (and (not foundp) (re-search-backward vhdl-defun-re nil 'move)) @@ -6774,7 +6774,7 @@ statement if already at the beginning of one." ;; start point was not inside leader area ;; set stop point at word after leader (setq pos (point)))) - (forward-word 1) + (forward-word-strictly 1) (vhdl-forward-syntactic-ws here) (setq pos (point))) (goto-char pos) @@ -8452,7 +8452,7 @@ buffer." (setq end (vhdl-re-search-forward "\\<then\\>" proc-end t)) (when (vhdl-re-search-backward "\\('event\\|\\<\\(falling\\|rising\\)_edge\\)\\>" beg t) (goto-char end) - (backward-word 1) + (backward-word-strictly 1) (vhdl-forward-sexp) (push (cons end (point)) seq-region-list) (beginning-of-line))) @@ -8924,7 +8924,7 @@ is omitted or nil." (vhdl-insert-keyword ": BLOCK ") (goto-char start) (when (setq label (vhdl-template-field "label" nil t start (+ (point) 8))) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1) (insert "(") (if (vhdl-template-field "[guard expression]" nil t) @@ -8960,7 +8960,7 @@ is omitted or nil." (if (vhdl-template-field "[quantity name]" " USE " t) (progn (vhdl-template-field "quantity name" " => ") t) (delete-region (point) - (progn (forward-word -1) (point))) + (progn (forward-word-strictly -1) (point))) nil)) (vhdl-template-field "[quantity name]" " => " t)) (vhdl-template-field "expression") @@ -8993,7 +8993,7 @@ is omitted or nil." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (when (vhdl-template-field "expression" nil t start (point)) (vhdl-insert-keyword (concat " " (if (eq kind 'is) "IS" "USE") "\n\n")) @@ -9275,7 +9275,7 @@ a configuration declaration if not within a design unit." (interactive) (insert " ") (unexpand-abbrev) - (backward-word 1) + (backward-word-strictly 1) (vhdl-case-word 1) (forward-char 1)) @@ -9284,7 +9284,7 @@ a configuration declaration if not within a design unit." (interactive) (insert " ") (unexpand-abbrev) - (backward-word 1) + (backward-word-strictly 1) (vhdl-case-word 1) (forward-char 1) (indent-according-to-mode)) @@ -9445,7 +9445,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (when (setq index (vhdl-template-field "loop variable" nil t start (point))) @@ -9586,7 +9586,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (when vhdl-conditions-in-parenthesis (insert "(")) (when (vhdl-template-field "condition" nil t start (point)) @@ -9669,7 +9669,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (delete-char 1)) (insert "\n\n") (indent-to margin) @@ -9753,11 +9753,13 @@ otherwise." (cond ((equal definition "") (insert ";")) ((equal definition "ARRAY") - (delete-region (point) (progn (forward-word -1) (point))) + (delete-region (point) (progn (forward-word-strictly -1) + (point))) (vhdl-template-array 'nature t)) ((equal definition "RECORD") (setq mid-pos (point-marker)) - (delete-region (point) (progn (forward-word -1) (point))) + (delete-region (point) (progn (forward-word-strictly -1) + (point))) (vhdl-template-record 'nature name t)) (t (vhdl-insert-keyword " ACROSS ") @@ -9870,7 +9872,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (unless (vhdl-standard-p '87) (vhdl-insert-keyword "IS")) (insert "\n") @@ -9927,7 +9929,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (insert "(") (if (not seq) @@ -10123,7 +10125,7 @@ otherwise." (vhdl-insert-keyword "WITH ") (when (vhdl-template-field "selector expression" nil t start (+ (point) 7)) - (forward-word 1) + (forward-word-strictly 1) (delete-char 1) (insert "\n") (indent-to (+ margin vhdl-basic-offset)) @@ -10245,11 +10247,13 @@ otherwise." (delete-char -4) (insert ";")) ((equal definition "ARRAY") - (delete-region (point) (progn (forward-word -1) (point))) + (delete-region (point) (progn (forward-word-strictly -1) + (point))) (vhdl-template-array 'type t)) ((equal definition "RECORD") (setq mid-pos (point-marker)) - (delete-region (point) (progn (forward-word -1) (point))) + (delete-region (point) (progn (forward-word-strictly -1) + (point))) (vhdl-template-record 'type name t)) ((equal definition "ACCESS") (insert " ") @@ -10293,7 +10297,8 @@ otherwise." (if (or (save-excursion (progn (vhdl-beginning-of-block) (looking-at "\\s-*\\(\\w+\\s-*:\\s-*\\)?\\<\\(\\<function\\|procedure\\|process\\|procedural\\)\\>"))) - (save-excursion (backward-word 1) (looking-at "\\<shared\\>"))) + (save-excursion (backward-word-strictly 1) + (looking-at "\\<shared\\>"))) (vhdl-insert-keyword "VARIABLE ") (if (vhdl-standard-p '87) (error "ERROR: Not within sequential block") @@ -10351,7 +10356,7 @@ otherwise." (goto-char start) (setq label (vhdl-template-field "[label]" nil t)) (unless label (delete-char 2)) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (when vhdl-conditions-in-parenthesis (insert "(")) (when (vhdl-template-field "condition" nil t start (point)) @@ -11213,7 +11218,7 @@ else insert tab (used for word completion in VHDL minibuffer)." (save-match-data (save-excursion (goto-char (match-end 5)) - (forward-word 1) + (forward-word-strictly 1) (vhdl-forward-syntactic-ws) (when (looking-at "(") (forward-sexp)) @@ -11287,19 +11292,19 @@ else insert tab (used for word completion in VHDL minibuffer)." but not if inside a comment or quote." (if (or (vhdl-in-literal) (save-excursion - (forward-word -1) + (forward-word-strictly -1) (and (looking-at "\\<end\\>") (not (looking-at "\\<end;"))))) (progn (insert " ") (unexpand-abbrev) - (backward-word 1) + (backward-word-strictly 1) (vhdl-case-word 1) (delete-char 1)) (if (not vhdl-electric-mode) (progn (insert " ") (unexpand-abbrev) - (backward-word 1) + (backward-word-strictly 1) (vhdl-case-word 1) (delete-char 1)) (let ((invoke-char vhdl-last-input-event) @@ -11702,7 +11707,7 @@ reflected in a subsequent paste operation." (equal "END" (upcase (match-string 1)))) (throw 'parse "ERROR: Not within an entity or component declaration")) (setq decl-type (downcase (match-string-no-properties 1))) - (forward-word 1) + (forward-word-strictly 1) (vhdl-parse-string "\\s-+\\(\\w+\\)\\(\\s-+is\\>\\)?") (setq name (match-string-no-properties 1)) (message "Reading port of %s \"%s\"..." decl-type name) @@ -13206,7 +13211,7 @@ File statistics: \"%s\"\n\ ;; subprogram body (when (match-string 2) (re-search-forward "^\\s-*\\<begin\\>" nil t) - (backward-word 1) + (backward-word-strictly 1) (vhdl-forward-sexp))) ;; block (recursive) ((looking-at "^\\s-*\\w+\\s-*:\\s-*block\\>") @@ -13219,7 +13224,7 @@ File statistics: \"%s\"\n\ (re-search-forward "^\\s-*end\\s-+process\\>" nil t)) ;; configuration declaration ((looking-at "^\\s-*configuration\\>") - (forward-word 4) + (forward-word-strictly 4) (vhdl-forward-sexp)) (t (goto-char pos)))))) diff --git a/lisp/simple.el b/lisp/simple.el index 72e87a410fc..cfdea742084 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1170,7 +1170,7 @@ END, without printing any message." (save-restriction (narrow-to-region start end) (goto-char (point-min)) - (while (forward-word 1) + (while (forward-word-strictly 1) (setq words (1+ words))))) words)) ((use-region-p) diff --git a/lisp/skeleton.el b/lisp/skeleton.el index b9c1bb506d1..0e81e2d74c6 100644 --- a/lisp/skeleton.el +++ b/lisp/skeleton.el @@ -244,7 +244,8 @@ When done with skeleton, but before going back to `_'-point call (setq skeleton-regions (if (> skeleton-regions 0) (list (copy-marker (point) t) - (save-excursion (forward-word skeleton-regions) + (save-excursion (forward-word-strictly + skeleton-regions) (point-marker))) (setq skeleton-regions (- skeleton-regions)) ;; copy skeleton-regions - 1 elements from `mark-ring' diff --git a/lisp/subr.el b/lisp/subr.el index c685f95f56f..311348150da 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4124,6 +4124,39 @@ If SYNTAX is nil, return nil." ;; Utility motion commands +(defvar word-move-empty-char-table nil + "Used in `forward-word-strictly' and `backward-word-strictly' +to countermand the effect of `find-word-boundary-function-table'.") + +(defun forward-word-strictly (&optional arg) + "Move point forward ARG words (backward if ARG is negative). +If ARG is omitted or nil, move point forward one word. +Normally returns t. +If an edge of the buffer or a field boundary is reached, point is left there +and the function returns nil. Field boundaries are not noticed if +`inhibit-field-text-motion' is non-nil. + +This function is like `forward-word', but it is not affected +by `find-word-boundary-function-table'. It is also not interactive." + (let ((find-word-boundary-function-table + (if (char-table-p word-move-empty-char-table) + word-move-empty-char-table + (setq word-move-empty-char-table (make-char-table nil))))) + (forward-word (or arg 1)))) + +(defun backward-word-strictly (&optional arg) + "Move backward until encountering the beginning of a word. +With argument ARG, do this that many times. +If ARG is omitted or nil, move point backward one word. + +This function is like `forward-word', but it is not affected +by `find-word-boundary-function-table'. It is also not interactive." + (let ((find-word-boundary-function-table + (if (char-table-p word-move-empty-char-table) + word-move-empty-char-table + (setq word-move-empty-char-table (make-char-table nil))))) + (forward-word (- (or arg 1))))) + ;; Whitespace (defun forward-whitespace (arg) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 3b1a805f51b..730b55fbd8f 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -345,7 +345,7 @@ property of the major mode name.") (defun texinfo-mode-flyspell-verify () "Function used for `flyspell-generic-check-word-predicate' in Texinfo mode." (save-excursion - (forward-word -1) + (forward-word-strictly -1) (not (looking-at "@")))) ;;*--- tex mode --------------------------------------------------------*/ diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 19aefc29b96..3ac68bdf790 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -732,7 +732,8 @@ automatically inserts its partner." (let ((arg-end (match-end 0))) (if (null type) ;\end (progn (goto-char arg-end) - (latex-forward-sexp -1) (forward-word 1)) + (latex-forward-sexp -1) + (forward-word-strictly 1)) (goto-char cmd-start) (latex-forward-sexp 1) (let (forward-sexp-function) (backward-sexp))) diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index 19a21237d2b..55be7fe9df5 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el @@ -891,7 +891,7 @@ commands." ;; @ is followed by a command-word; find the end of the word. (setq texinfo-command-start (1- (point))) (if (= (char-syntax (following-char)) ?w) - (forward-word 1) + (forward-word-strictly 1) (forward-char 1)) (setq texinfo-command-end (point)) ;; Detect the case of two @-commands in a row; @@ -1190,7 +1190,7 @@ Leave point after argument." (forward-paragraph) (let ((end (point))) (if (save-excursion - (backward-word 1) + (backward-word-strictly 1) (search-forward "@refill" end t)) (setq anchor-string "@anchor-yes-refill") (setq anchor-string "@anchor-no-refill"))) @@ -2003,7 +2003,7 @@ commands that are defined in texinfo.tex for printed output. (error "In @multitable, @columnfractions misspelled")) ;; Case 1: @columnfractions .25 .3 .45 ((looking-at "@columnfractions") - (forward-word 1) + (forward-word-strictly 1) (while (not (eolp)) (push (truncate (1- @@ -2118,7 +2118,7 @@ This command is executed when texinfmt sees @item inside @multitable." ;; Delete the @tab command, including the @-sign (delete-region (point) - (progn (forward-word -1) (1- (point))))) + (progn (forward-word-strictly -1) (1- (point))))) (point))) ;; Set fill-column *wider* than needed to produce inter-column space (setq fill-column (+ 1 diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 8f435987514..c22f531440d 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -391,7 +391,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") (unless (get-char-property start 'text-clones) (if endp (texinfo-last-unended-begin) - (forward-word 1) + (forward-word-strictly 1) (texinfo-next-unmatched-end)) (skip-syntax-forward "^w") (when (looking-at @@ -736,7 +736,7 @@ With prefix argument or inside @code or @example, inserts a plain \"." "Insert the matching `@end' for the last Texinfo command that needs one." (ignore-errors (save-excursion - (backward-word 1) + (backward-word-strictly 1) (texinfo-last-unended-begin) (or (match-string 1) '-))) \n "@end " str \n \n) diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 8f401323445..b01c678ffec 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el @@ -519,7 +519,7 @@ line. If there is no node name, returns an empty string." (save-excursion (buffer-substring - (progn (forward-word 1) ; skip over node command + (progn (forward-word-strictly 1) ; skip over node command (skip-chars-forward " \t") ; and over spaces (point)) (if (search-forward "," (line-end-position) t) ; bound search @@ -542,7 +542,7 @@ must have been done by `texinfo-menu-locate-entry-p'." (goto-char (match-beginning 7)) ; match section name (buffer-substring - (progn (forward-word 1) ; skip over section type + (progn (forward-word-strictly 1) ; skip over section type (skip-chars-forward " \t") ; and over spaces (point)) (progn (end-of-line) (point)))) @@ -794,7 +794,7 @@ complements the node name rather than repeats it as a title does." (setq title (buffer-substring ;; skip over section type - (progn (forward-word 1) + (progn (forward-word-strictly 1) ;; and over spaces (skip-chars-forward " \t") (point)) @@ -1104,7 +1104,7 @@ point." t) (progn (beginning-of-line) - (forward-word 1) ; skip over section type + (forward-word-strictly 1) ; skip over section type (skip-chars-forward " \t") ; and over spaces (buffer-substring (point) @@ -1167,7 +1167,7 @@ error if the node is not the top node and a section is not found." (setq sec-name (buffer-substring-no-properties (progn (beginning-of-line) ; copy its name (1+ (point))) - (progn (forward-word 1) + (progn (forward-word-strictly 1) (point)))))) (cond ((or sec-pos top-pos) @@ -1374,7 +1374,7 @@ Point must be at beginning of node line. Does not move point." (save-excursion (let ((initial (texinfo-copy-next-section-title))) ;; This is not clean. Use `interactive' to read the arg. - (forward-word 1) ; skip over node command + (forward-word-strictly 1) ; skip over node command (skip-chars-forward " \t") ; and over spaces (if (not (looking-at "[^,\t\n ]+")) ; regexp based on what Info looks for ; alternatively, use "[a-zA-Z]+" @@ -1700,7 +1700,7 @@ node names in pre-existing `@node' lines that lack names." (if title-p (progn (beginning-of-line) - (forward-word 1) + (forward-word-strictly 1) (skip-chars-forward " \t") (setq title (buffer-substring (point) @@ -1713,7 +1713,7 @@ node names in pre-existing `@node' lines that lack names." (line-beginning-position -1)) t) ;; @node is present, and point at beginning of that line - (forward-word 1) ; Leave point just after @node. + (forward-word-strictly 1) ; Leave point just after @node. ;; Else @node missing; insert one. (beginning-of-line) ; Beginning of `@section' line. (insert "@node\n") @@ -1728,7 +1728,7 @@ node names in pre-existing `@node' lines that lack names." (if (not (looking-at "[^,\t\n ]+")) (progn (beginning-of-line) - (forward-word 1) + (forward-word-strictly 1) (insert " " title) (message "Inserted title %s ... " title))))) ;; Go forward beyond current section title. @@ -1813,7 +1813,7 @@ same place. If there is no title, returns an empty string." ;; copy title (let ((title (buffer-substring - (progn (forward-word 1) ; skip over section type + (progn (forward-word-strictly 1) ; skip over section type (skip-chars-forward " \t") ; and over spaces (point)) (progn (end-of-line) (point))))) diff --git a/lisp/wdired.el b/lisp/wdired.el index 9f258794f96..795e50d16d5 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -666,7 +666,7 @@ If OLD, return the old target. If MOVE, move point before it." (funcall command 1) (setq arg (1- arg))) (error - (if (forward-word) + (if (forward-word-strictly) ;; Skip any non-word characters to avoid triggering a read-only ;; error which would cause skipping the next word characters too. (skip-syntax-forward "^w") |