/ enh-ruby-mode-expansions.el
enh-ruby-mode-expansions.el
 1  ;;; enh-ruby-mode-expansions.el --- Expansions for enh-ruby-mode  -*- lexical-binding: t; -*-
 2  
 3  ;; Copyright (C) 2011-2023  Free Software Foundation, Inc
 4  
 5  ;; Author: Magnar Sveen <magnars@gmail.com>
 6  ;; Keywords: marking region
 7  
 8  ;; This program is free software; you can redistribute it and/or modify
 9  ;; it under the terms of the GNU General Public License as published by
10  ;; the Free Software Foundation, either version 3 of the License, or
11  ;; (at your option) any later version.
12  
13  ;; This program is distributed in the hope that it will be useful,
14  ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15  ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  ;; GNU General Public License for more details.
17  
18  ;; You should have received a copy of the GNU General Public License
19  ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  
21  ;;; Commentary:
22  
23  ;; enh-ruby-mode doesn't use ruby-mode's mark-defun - it has its own.
24  ;;
25  ;; Feel free to contribute any other expansions for enh-ruby-mode at
26  ;;
27  ;;     https://github.com/magnars/expand-region.el
28  
29  ;;; Code:
30  
31  (require 'expand-region-core)
32  
33  (defun er/add-enh-ruby-mode-expansions ()
34    "Adds Ruby-specific expansions for buffers in enh-ruby-mode"
35    (require 'ruby-mode-expansions)
36  
37    (set (make-local-variable 'er/try-expand-list) (append
38                                                    (remove 'er/mark-defun er/try-expand-list)
39                                                    '(er/mark-ruby-instance-variable
40                                                      er/mark-ruby-block-up))))
41  
42  (er/enable-mode-expansions 'enh-ruby-mode #'er/add-enh-ruby-mode-expansions)
43  
44  (provide 'enh-ruby-mode-expansions)