From 29da1cb3e7d54f93c0b4f6de00e9fda294a0cdff Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 19 Jan 2016 07:58:46 +0300 Subject: [PATCH] Propertize backtick in 'def `(abc)' as symbol constituent * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Propertize backtick in 'def `(abc)' as symbol constituent. (ruby-syntax-propertize-function): Rename to ruby-syntax-propertize. --- lisp/progmodes/ruby-mode.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 8f08b7c9e60..969f2ed4bc4 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1830,7 +1830,7 @@ It will be properly highlighted even when the call omits parens.") "\\)\\s *") "Regexp to match text that can be followed by a regular expression.")) -(defun ruby-syntax-propertize-function (start end) +(defun ruby-syntax-propertize (start end) "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." (let (case-fold-search) (goto-char start) @@ -1856,6 +1856,8 @@ It will be properly highlighted even when the call omits parens.") (zerop (skip-syntax-backward "w_"))) (memq (preceding-char) '(?@ ?$)))) (string-to-syntax "_")))) + ;; Backtick method redefinition. + ("^[ \t]*def +\\(`\\)" (1 "_")) ;; Regular expressions. Start with matching unescaped slash. ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) @@ -1891,6 +1893,9 @@ It will be properly highlighted even when the call omits parens.") (1 (prog1 "|" (ruby-syntax-propertize-percent-literal end))))) (point) end))) +(define-obsolete-function-alias + 'ruby-syntax-propertize-function 'ruby-syntax-properize "25.1") + (defun ruby-syntax-propertize-heredoc (limit) (let ((ppss (syntax-ppss)) (res '())) @@ -2252,7 +2257,7 @@ See `font-lock-syntax-table'.") (setq-local font-lock-keywords ruby-font-lock-keywords) (setq-local font-lock-syntax-table ruby-font-lock-syntax-table) - (setq-local syntax-propertize-function #'ruby-syntax-propertize-function)) + (setq-local syntax-propertize-function #'ruby-syntax-propertize)) ;;; Invoke ruby-mode when appropriate -- 2.39.5