Subject: Re: bug#33487: [PATCH] bug of ruby-forward-sexp and ruby-backward-sexp

From: Dmitry Gutov <[email-masked]>
Date: Tue, 11 Dec 2018 03:18:37 +0200

Version: 27.0

Hi Nobuyoshi,

On 24.11.2018 18:20, Nobuyoshi Nakada wrote:
> With lisp/progmodes/ruby-mode.el in Emacs 26.1, `ruby-forward-sexp' and 
> `ruby-backward-sexp' cannot work with block arguments which end without 
> argument name.
> 
> i.e.,
> 
>      proc do |a,|
> 
>      end
> 
> 
> or
> 
> 
>      proc do |a,*|
> 
>      end
> 
> 
> The reason is that `smie-default-forward-token' and 
> `smie-default-backward-token' just scan punctuation and the closing bar 
> together, and return ",|" or ",*|" in the above examples, then the 
> "opening-|" cannot find "matching closing-|".
> 
> The following patch trims the token and adjust the cursor position in 
> those cases.

Thank you for the patch. I've simplified it a little: regexps smaller, 
tests shorter, and removed a few of the latter (seemed redundant), and 
pushed.

Please let me know if there is anything amiss in the resulting patch: 
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3729a3f88fd7ce1d8a1a7f2ea61e8c4d05e954ab