class EmacsRuby::Emacs
Attributes
emacs[RW]
Public Class Methods
new()
click to toggle source
# File lib/emacs-ruby/emacs.rb, line 5 def initialize @emacs = 'emacs' end
Public Instance Methods
batch(target: nil, load: nil, func: nil)
click to toggle source
# File lib/emacs-ruby/emacs.rb, line 21 def batch(target: nil, load: nil, func: nil) return unless func cmd = [@emacs] cmd << target if target cmd << '--batch' cmd += ['-l', load] if load cmd += ['-f', func] if func cmd << '--kill' `#{cmd.join ' '}` end
org_to_html(org_file, load: nil)
click to toggle source
# File lib/emacs-ruby/emacs.rb, line 9 def org_to_html(org_file, load: nil) html = nil batch target: org_file, load: load, func: 'org-html-export-to-html' html_file = org_file.sub(/.org$/, '.html') return html unless File.exist? html_file File.open(html_file) do |file| html = file.read end FileUtils.rm_rf html_file html end