Class: Relisp::Window

Inherits:
Proxy show all
Defined in:
lib/relisp/type_conversion/editing_types.rb

Overview

A proxy to an Emacs window

Instance Attribute Summary

Attributes inherited from Proxy

#elisp_variable, #slave

Instance Method Summary collapse

Methods inherited from Proxy

elisp_alias, from_elisp, #makunbound, #to_elisp

Constructor Details

#initialize(*args) ⇒ Window

args must be of the form (symbol, slave = Relisp.default_slave)

The symbol argument is considered to be the name of a pre-existing window in the slave process.



297
298
299
300
301
# File 'lib/relisp/type_conversion/editing_types.rb', line 297

def initialize(*args)
  super do 
    raise ArgumentError, "Cannot create Window proxy without existing elisp variable."
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Relisp::Proxy

Instance Method Details

#==(window2) ⇒ Object



445
446
447
# File 'lib/relisp/type_conversion/editing_types.rb', line 445

def ==(window2)
  @slave.elisp_eval "(equal #{to_elisp} #{window2.to_elisp})"
end

#edgesObject



416
417
418
# File 'lib/relisp/type_conversion/editing_types.rb', line 416

def edges
  (call_on_self :window_edges).to_list
end

#enlarge(vertical, horizontal = 0) ⇒ Object



432
433
434
435
# File 'lib/relisp/type_conversion/editing_types.rb', line 432

def enlarge(vertical, horizontal=0)
  eval_in_window "(enlarge-window #{vertical.to_elisp})" unless vertical == 0
  eval_in_window "(enlarge-window-horizontally #{horizontal.to_elisp})" unless horizontal == 0
end

#inside_edgesObject



420
421
422
# File 'lib/relisp/type_conversion/editing_types.rb', line 420

def inside_edges
  (call_on_self :window_inside_edges).to_list
end

#inside_pixel_edgesObject



428
429
430
# File 'lib/relisp/type_conversion/editing_types.rb', line 428

def inside_pixel_edges
  (call_on_self :window_inside_pixel_edges).to_list
end

#pixel_edgesObject



424
425
426
# File 'lib/relisp/type_conversion/editing_types.rb', line 424

def pixel_edges
  (call_on_self :window_pixel_edges).to_list
end

#recenter(count = nil) ⇒ Object



377
378
379
# File 'lib/relisp/type_conversion/editing_types.rb', line 377

def recenter(count=nil)
  eval_in_window "(recenter #{count.to_elisp})"
end

#scroll_down(count = nil) ⇒ Object



373
374
375
# File 'lib/relisp/type_conversion/editing_types.rb', line 373

def scroll_down(count=nil)
  eval_in_window "(scroll-down #{count.to_elisp})"
end

#scroll_left(count = nil) ⇒ Object



393
394
395
# File 'lib/relisp/type_conversion/editing_types.rb', line 393

def scroll_left(count=nil)
  eval_in_window "(scroll-left #{count.to_elisp})"
end

#scroll_right(count = nil) ⇒ Object



397
398
399
# File 'lib/relisp/type_conversion/editing_types.rb', line 397

def scroll_right(count=nil)
  eval_in_window "(scroll-right #{count.to_elisp})"
end

#scroll_up(count = nil) ⇒ Object



369
370
371
# File 'lib/relisp/type_conversion/editing_types.rb', line 369

def scroll_up(count=nil)
  eval_in_window "(scroll-up #{count.to_elisp})"
end

#shrink(vertical, horizontal = 0) ⇒ Object



437
438
439
440
# File 'lib/relisp/type_conversion/editing_types.rb', line 437

def shrink(vertical, horizontal=0)
  eval_in_window "(shrink-window #{vertical.to_elisp})" unless vertical == 0
  eval_in_window "(shrink-window-horizontally #{horizontal.to_elisp})" unless horizontal == 0
end

#split_horizontally(size = nil) ⇒ Object



317
318
319
# File 'lib/relisp/type_conversion/editing_types.rb', line 317

def split_horizontally(size=nil)
  split(size, true)
end

#split_vertically(size = nil) ⇒ Object



321
322
323
# File 'lib/relisp/type_conversion/editing_types.rb', line 321

def split_vertically(size=nil)
  split(size, false)
end

#visible?(position) ⇒ Boolean

Returns:

  • (Boolean)


365
366
367
# File 'lib/relisp/type_conversion/editing_types.rb', line 365

def visible?(position)
  @slave.elisp_eval( "(pos-visible-in-window-p #{position.to_elisp} #{@elisp_variable})" )
end