Function: ruby-base-mode

ruby-base-mode is an autoloaded, interactive and byte-compiled function defined in ruby-mode.el.gz.

Signature

(ruby-base-mode)

Documentation

Generic major mode for editing Ruby.

This mode is intended to be inherited by concrete major modes. Currently there are ruby-mode and ruby-ts-mode.

In addition to any hooks its parent mode prog-mode might have run, this mode runs the hook ruby-base-mode-hook, as the final or penultimate step during initialization.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-mode.el.gz
;;;###autoload
(define-derived-mode ruby-base-mode prog-mode "Ruby"
  "Generic major mode for editing Ruby.

This mode is intended to be inherited by concrete major modes.
Currently there are `ruby-mode' and `ruby-ts-mode'."
  (setq indent-tabs-mode ruby-indent-tabs-mode)

  (setq-local comment-start "# ")
  (setq-local comment-end "")
  (setq-local comment-column ruby-comment-column)
  (setq-local comment-start-skip "#+ *")

  (setq-local parse-sexp-ignore-comments t)
  (setq-local parse-sexp-lookup-properties t)

  (setq-local paragraph-start (concat "$\\|" page-delimiter))
  (setq-local paragraph-separate paragraph-start)
  (setq-local paragraph-ignore-fill-prefix t)

  ;; `outline-regexp' contains the first part of `ruby-indent-beg-re'
  (setq-local outline-regexp (concat "^\\s *"
                                     (regexp-opt '("class" "module" "def"))
                                     "\\_>"))
  (setq-local outline-level (lambda () (1+ (/ (current-indentation)
                                         ruby-indent-level))))

  (add-hook 'after-save-hook #'ruby-mode-set-encoding nil 'local)
  (add-hook 'electric-indent-functions #'ruby--electric-indent-p nil 'local)
  (add-hook 'flymake-diagnostic-functions #'ruby-flymake-auto nil 'local)

  (setq-local prettify-symbols-alist ruby--prettify-symbols-alist))