]> git.eshelyaron.com Git - emacs.git/commit
Fix ruby-add-log-current-method after nested class definition
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 15 Dec 2022 01:21:14 +0000 (03:21 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 15 Dec 2022 01:21:44 +0000 (03:21 +0200)
commitfd403a5c5a87adb8cf42f82c9c0cea4e029767d6
treecfcb75c5f9a49b84a2f561252673b7ed1ab4a8e5
parent2ca06aed7b39afdc00041ab7cd9c7a8cb50332f6
Fix ruby-add-log-current-method after nested class definition

* lisp/progmodes/ruby-mode.el (ruby--add-log-current-indent):
New function.
(ruby-add-log-current-method): Use it.
Check for "class" and "module" indentation to filter out the
definitions which don't include the given position.  Also try to
match "def" only once (for performance), because if the closest
one doesn't include the given position, none will.

* test/lisp/progmodes/ruby-mode-tests.el
(ruby-add-log-current-method-after-inner-class-outside-methods)
(ruby-add-log-current-method-after-inner-class-outside-methods-with-text):
New tests.
lisp/progmodes/ruby-mode.el
test/lisp/progmodes/ruby-mode-tests.el