summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-01-04 21:13:33 +0200
committerDmitry Gutov <dgutov@yandex.ru>2021-01-04 21:13:53 +0200
commit1e776d7d6a5672de15b2ee9c75f5637ca1756280 (patch)
tree451ad256b3b156a8252215bbe0cc531ed9ca4dcf /lisp/progmodes
parent97226aacfde717ec48fa8931c870497e089da17b (diff)
downloademacs-1e776d7d6a5672de15b2ee9c75f5637ca1756280.tar.gz
ruby-add-log-current-method: Support methods with symbolic names
* lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Support methods with symbolic names.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/ruby-mode.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 3effb6ed662..cd9d087856c 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1598,13 +1598,16 @@ See `add-log-current-defun-function'."
(let* ((indent 0) mname mlist
(start (point))
(make-definition-re
- (lambda (re)
+ (lambda (re &optional method-name?)
(concat "^[ \t]*" re "[ \t]+"
"\\("
;; \\. and :: for class methods
- "\\([A-Za-z_]" ruby-symbol-re "*[?!]?\\|\\.\\|::" "\\)"
+ "\\([A-Za-z_]" ruby-symbol-re "*[?!]?"
+ (when method-name? "\\|")
+ (when method-name? ruby-operator-re)
+ "\\|\\.\\|::" "\\)"
"+\\)")))
- (definition-re (funcall make-definition-re ruby-defun-beg-re))
+ (definition-re (funcall make-definition-re ruby-defun-beg-re t))
(module-re (funcall make-definition-re "\\(class\\|module\\)")))
;; Get the current method definition (or class/module).
(when (re-search-backward definition-re nil t)