Class: Mode
Overview
Class Method Summary collapse
-
.define(name, extension, &block) ⇒ Object
Easy way to define a mode.
- .menu ⇒ Object
Class Method Details
.define(name, extension, &block) ⇒ Object
Easy way to define a mode
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/xiki/mode.rb', line 17 def self.define name, extension, &block return if ! $el # Mode function $el.defun("#{name}_mode".to_sym, :interactive => "", :docstring => "Apply #{name} styles, etc") do $el.el4r_lisp_eval "(setq font-lock-defaults '(nil t))" block.call map_name = "#{name}_mode_map".to_sym $el.use_local_map $el.elvar.send(map_name) if $el.boundp(map_name) end # Associate with file extension $el.el4r_lisp_eval %Q<(add-to-list 'auto-mode-alist '("\\\\#{extension}\\\\'" . #{name}-mode))> end |
.menu ⇒ Object
10 11 12 13 14 |
# File 'lib/xiki/mode.rb', line 10 def self. " - Put something here. " end |