class Notiffany::Notifier::Emacs
(www.emacswiki.org/emacs/EmacsClient).
Send a notification to Emacs with emacsclient
def _check_available(options)
def _check_available(options) return if Client.new(options.merge(elisp_erb: "'1'")).available? raise UnavailableError, 'Emacs client failed' end
def _emacs_color(type, options = {})
-
(String)
- the name of the emacs color
Options Hash:
(**options)
-
default
(String
) -- the default color to use (default is -
pending
(String
) -- the color to use for pending -
failed
(String
) -- the color to use for failure -
success
(String
) -- the color to use for success
Parameters:
-
options
(Hash
) -- aditional notification options -
type
(String
) -- the notification type
def _emacs_color(type, options = {}) default = options.fetch(:default, DEFAULTS[:default]) options.fetch(type.to_sym, default) end
def _erb_for(filename)
def _erb_for(filename) return DEFAULT_ELISP_ERB unless filename IO.read(::File.expand_path(filename)) end
def _gem_name
def _gem_name nil end
def _perform_notify(message, opts = {})
(**opts)
-
priority
(String, Integer
) -- specify an int or named key -
client
(String
) -- the client to use for notification -
default
(String
) -- the default color to use (default is -
pending
(String
) -- the color to use for pending -
failed
(String
) -- the color to use for failure -
success
(String
) -- the color to use for success
Parameters:
-
opts
(Hash
) -- additional notification library options -
image
(String
) -- the path to the notification image -
message
(String
) -- the notification message body -
title
(String
) -- the notification title -
type
(String
) -- the notification type. Either 'success',
def _perform_notify(message, opts = {}) color = _emacs_color(opts[:type], opts) fontcolor = _emacs_color(:fontcolor, opts) opts = opts.merge(elisp_erb: _erb_for(opts[:elisp_file])) Client.new(opts).notify(fontcolor, color, message) end