Subject: 28.0.50; [ruby-mode] ruby-{beginning,end}-of-block doesn't work as is exepected if arguments of method is divided into multi line

From: Yasuhiro KIMURA <[email-masked]>
Date: Thu, 13 Aug 2020 16:17:22 +0900 (JST)

ruby-{beginning,end}-of-block doesn't work as is exepected if
arguments of method is divided into multi line. Following is a sample
code to reproduce the issue.

----------------------------------------------------------------------
0001: class A
0002:   def foo
0003:     puts("aaa", "bbb")
0004:   end
0005: end
0006:
0007: class B
0008:   def foo
0009:     puts("aaa",
0010:          "bbb")
0011:   end
0012: end
----------------------------------------------------------------------

At first let me assume point is on line 1 column 1. If I type 'C-M-n'
in this situmation, then point moves to line 5 column 1. And if I type
'C-M-p' then point moves back to line 1 column 1. This is just
expected behavior.

Next let me assume point is on line 7 column 1 and I type 'C-M-n'. The
expected behavior is that point moves to line 12 column 1. But what
really happens is that point moves to line 10 column 1 and following
error message is displayed in minibuffer.

Wrong type argument: number-or-marker-p, nil

In GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32)
 of 2020-08-13 built on ROLLING
Repository revision: d089c4fbfc8be432dc3015a99b4044dab0a0de97
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
System Description: Microsoft Windows 10 Enterprise (v10.0.1909.18363.1016)

Recent messages:
Loading mime-setup...
Loading mail-mime-setup...done
gnus-mime-setup is not found.
emh-setup is not found.
Loading mime-setup...done
Loading uniquify...done
Turning on magit-auto-revert-mode...done
Loading c:/Emacs-master/share/emacs/site-lisp/magit/magit-version.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Package cl is deprecated

Configured using:
 'configure --prefix=/c/Emacs-master --without-dbus'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS PDUMPER

Important settings:
  value of $LANG: JPN
  locale-coding-system: cp932

Major mode: Fundamental

Minor modes in effect:
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Emacs-master/share/emacs/site-lisp/flim/md4 hides c:/Emacs-master/share/emacs/28.0.50/lisp/md4
c:/Emacs-master/share/emacs/site-lisp/flim/hex-util hides c:/Emacs-master/share/emacs/28.0.50/lisp/hex-util
c:/Emacs-master/share/emacs/site-lisp/flim/sasl hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/sasl
c:/Emacs-master/share/emacs/site-lisp/flim/sasl-ntlm hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/sasl-ntlm
c:/Emacs-master/share/emacs/site-lisp/flim/sasl-digest hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/sasl-digest
c:/Emacs-master/share/emacs/site-lisp/flim/sasl-cram hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/sasl-cram
c:/Emacs-master/share/emacs/site-lisp/flim/ntlm hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/ntlm
c:/Emacs-master/share/emacs/site-lisp/flim/hmac-md5 hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/hmac-md5
c:/Emacs-master/share/emacs/site-lisp/flim/hmac-def hides c:/Emacs-master/share/emacs/28.0.50/lisp/net/hmac-def

Features:
(shadow mew-varsx mew-win32 mew-w3m w3m doc-view jka-compr image-mode
exif timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-favicon
w3m-image tab-line w3m-proc w3m-util mew-auth mew-config mew-imap2
mew-imap mew-nntp2 mew-nntp mew-pop mew-smtp mew-ssl mew-ssh mew-net
mew-highlight mew-sort mew-fib mew-ext mew-refile mew-demo mew-attach
mew-draft mew-message mew-thread mew-virtual mew-summary4 mew-summary3
mew-summary2 mew-summary mew-search mew-pick mew-passwd mew-scan
mew-syntax mew-bq mew-smime mew-pgp mew-header mew-exec mew-mark
mew-mime mew-edit mew-decode mew-encode mew-cache mew-minibuf
mew-complete mew-addrbook mew-local mew-vars3 mew-vars2 mew-vars
mew-env mew-lang-jp mew-mule3 mew-mule mew-gemacs mew-key mew-func
mew-blvs mew-const mew emacsbug sendmail magit-version yaml-mode
mime-setup mail-mime-setup alist semi-setup path-util poe pym static
apel-ver product semi-def psvn advice edmacro kmacro wid-edit cl pp
elp ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init
ediff-util rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap sgml-mode dom nxml-util nxml-enc xmltok magit-submodule
magit-obsolete magit-blame magit-stash magit-bisect magit-push
magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-collab ghub-graphql treepy pcase gsexp
ghub url-http url-gw nsm url-auth url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
let-alist gnutls magit-files magit-refs magit-status magit package
browse-url url-handlers url-parse auth-source json map url-vars
magit-repos magit-apply magit-wip magit-log which-func imenu
magit-diff smerge-mode diff diff-mode magit-core magit-autorevert
autorevert filenotify magit-process magit-margin magit-mode git-commit
magit-git magit-section eieio eieio-core cl-macs eieio-loaddefs
magit-utils magit-popup format-spec crm log-edit easy-mmode message
rmc puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa
derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date subr-x mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor cl-extra help-mode seq byte-opt bytecomp byte-compile
cconv cl-seq shell pcomplete comint ansi-color ring server dash gv
cl-loaddefs cl-lib gitignore-mode gitconfig-mode conf-mode rx
gitattributes-mode thingatpt easymenu japan-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads w32notify w32 multi-tty make-network-process emacs)

Memory information:
((conses 16 235298 9345)
 (symbols 48 24665 45)
 (strings 32 77463 2455)
 (string-bytes 1 2319270)
 (vectors 16 36327)
 (vector-slots 8 544019 21728)
 (floats 8 131 29)
 (intervals 56 864 403)
 (buffers 992 12))