aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/ruby-mode.el
diff options
context:
space:
mode:
authorEli Zaretskii2016-02-05 23:54:21 +0200
committerEli Zaretskii2016-02-05 23:54:21 +0200
commitc1d32a65372c72d7de4808d620eefd3214a8e92a (patch)
treec1dabeb7fc6b5a979ab51787c765ded60630c533 /lisp/progmodes/ruby-mode.el
parentd3337167c2a4d09444908cfc875ac4077a02279d (diff)
downloademacs-c1d32a65372c72d7de4808d620eefd3214a8e92a.tar.gz
emacs-c1d32a65372c72d7de4808d620eefd3214a8e92a.zip
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/progmodes/ruby-mode.el')
-rw-r--r--lisp/progmodes/ruby-mode.el23
1 files changed, 12 insertions, 11 deletions
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'."
450 450
451(defun ruby-smie--redundant-do-p (&optional skip) 451(defun ruby-smie--redundant-do-p (&optional skip)
452 (save-excursion 452 (save-excursion
453 (if skip (backward-word 1)) 453 (if skip (backward-word-strictly 1))
454 (member (nth 2 (smie-backward-sexp ";")) '("while" "until" "for")))) 454 (member (nth 2 (smie-backward-sexp ";")) '("while" "until" "for"))))
455 455
456(defun ruby-smie--opening-pipe-p () 456(defun ruby-smie--opening-pipe-p ()
@@ -517,7 +517,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
517 (setq tok (concat "." tok))) 517 (setq tok (concat "." tok)))
518 (cond 518 (cond
519 ((member tok '("unless" "if" "while" "until")) 519 ((member tok '("unless" "if" "while" "until"))
520 (if (save-excursion (forward-word -1) (ruby-smie--bosp)) 520 (if (save-excursion (forward-word-strictly -1) (ruby-smie--bosp))
521 tok "iuwu-mod")) 521 tok "iuwu-mod"))
522 ((string-match-p "\\`|[*&]?\\'" tok) 522 ((string-match-p "\\`|[*&]?\\'" tok)
523 (forward-char (- 1 (length tok))) 523 (forward-char (- 1 (length tok)))
@@ -577,7 +577,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
577 ((equal tok "do") 577 ((equal tok "do")
578 (cond 578 (cond
579 ((not (ruby-smie--redundant-do-p)) tok) 579 ((not (ruby-smie--redundant-do-p)) tok)
580 ((> (save-excursion (forward-word 1) 580 ((> (save-excursion (forward-word-strictly 1)
581 (forward-comment (point-max)) (point)) 581 (forward-comment (point-max)) (point))
582 (line-end-position)) 582 (line-end-position))
583 (ruby-smie--backward-token)) ;Fully redundant. 583 (ruby-smie--backward-token)) ;Fully redundant.
@@ -891,7 +891,7 @@ and `\\' when preceded by `?'."
891(defun ruby-singleton-class-p (&optional pos) 891(defun ruby-singleton-class-p (&optional pos)
892 (save-excursion 892 (save-excursion
893 (when pos (goto-char pos)) 893 (when pos (goto-char pos))
894 (forward-word -1) 894 (forward-word-strictly -1)
895 (and (or (bolp) (not (eq (char-before (point)) ?_))) 895 (and (or (bolp) (not (eq (char-before (point)) ?_)))
896 (looking-at ruby-singleton-class-re)))) 896 (looking-at ruby-singleton-class-re))))
897 897
@@ -1234,7 +1234,7 @@ delimiter."
1234 ((let ((s (ruby-parse-region (point) ruby-indent-point))) 1234 ((let ((s (ruby-parse-region (point) ruby-indent-point)))
1235 (and (nth 2 s) (> (nth 2 s) 0) 1235 (and (nth 2 s) (> (nth 2 s) 0)
1236 (or (goto-char (cdr (nth 1 s))) t))) 1236 (or (goto-char (cdr (nth 1 s))) t)))
1237 (forward-word -1) 1237 (forward-word-strictly -1)
1238 (setq indent (ruby-indent-size (current-column) 1238 (setq indent (ruby-indent-size (current-column)
1239 (nth 2 state)))) 1239 (nth 2 state))))
1240 (t 1240 (t
@@ -1253,7 +1253,7 @@ delimiter."
1253 (if (null (cdr (nth 1 state))) 1253 (if (null (cdr (nth 1 state)))
1254 (error "Invalid nesting")) 1254 (error "Invalid nesting"))
1255 (goto-char (cdr (nth 1 state))) 1255 (goto-char (cdr (nth 1 state)))
1256 (forward-word -1) ; skip back a keyword 1256 (forward-word-strictly -1) ; skip back a keyword
1257 (setq begin (point)) 1257 (setq begin (point))
1258 (cond 1258 (cond
1259 ((looking-at "do\\>[^_]") ; iter block is a special case 1259 ((looking-at "do\\>[^_]") ; iter block is a special case
@@ -1346,7 +1346,7 @@ delimiter."
1346 (forward-char -1) 1346 (forward-char -1)
1347 (not (looking-at "{"))) 1347 (not (looking-at "{")))
1348 (progn 1348 (progn
1349 (forward-word -1) 1349 (forward-word-strictly -1)
1350 (not (looking-at "do\\>[^_]"))))) 1350 (not (looking-at "do\\>[^_]")))))
1351 (t t)))) 1351 (t t))))
1352 (not (eq ?, c)) 1352 (not (eq ?, c))
@@ -1499,10 +1499,11 @@ With ARG, do it many times. Negative ARG means move backward."
1499 (not (eq (char-before (point)) ?.)) 1499 (not (eq (char-before (point)) ?.))
1500 (not (eq (char-before (point)) ?:))) 1500 (not (eq (char-before (point)) ?:)))
1501 (ruby-end-of-block) 1501 (ruby-end-of-block)
1502 (forward-word 1)) 1502 (forward-word-strictly 1))
1503 ((looking-at "\\(\\$\\|@@?\\)?\\sw") 1503 ((looking-at "\\(\\$\\|@@?\\)?\\sw")
1504 (while (progn 1504 (while (progn
1505 (while (progn (forward-word 1) (looking-at "_"))) 1505 (while (progn (forward-word-strictly 1)
1506 (looking-at "_")))
1506 (cond ((looking-at "::") (forward-char 2) t) 1507 (cond ((looking-at "::") (forward-char 2) t)
1507 ((> (skip-chars-forward ".") 0)) 1508 ((> (skip-chars-forward ".") 0))
1508 ((looking-at "\\?\\|!\\(=[~=>]\\|[^~=]\\)") 1509 ((looking-at "\\?\\|!\\(=[~=>]\\|[^~=]\\)")
@@ -1518,7 +1519,7 @@ With ARG, do it many times. Negative ARG means move backward."
1518 (skip-chars-forward "<")) 1519 (skip-chars-forward "<"))
1519 (not expr)))) 1520 (not expr))))
1520 (setq i (1- i))) 1521 (setq i (1- i)))
1521 ((error) (forward-word 1))) 1522 ((error) (forward-word-strictly 1)))
1522 i)))) 1523 i))))
1523 1524
1524(defun ruby-backward-sexp (&optional arg) 1525(defun ruby-backward-sexp (&optional arg)
@@ -1554,7 +1555,7 @@ With ARG, do it many times. Negative ARG means move forward."
1554 ((looking-at "\\s(") nil) 1555 ((looking-at "\\s(") nil)
1555 (t 1556 (t
1556 (forward-char 1) 1557 (forward-char 1)
1557 (while (progn (forward-word -1) 1558 (while (progn (forward-word-strictly -1)
1558 (pcase (char-before) 1559 (pcase (char-before)
1559 (`?_ t) 1560 (`?_ t)
1560 (`?. (forward-char -1) t) 1561 (`?. (forward-char -1) t)