relisp 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/CHANGELOG +5 -0
- data/{README → README.rdoc} +0 -0
- data/examples/ruby_master/speed.rb +14 -0
- data/lib/relisp.rb +1 -1
- data/lib/relisp/elisp_functions.rb +12 -1
- data/lib/relisp/slaves.rb +3 -0
- data/manual_test/tests.el +4 -3
- data/src/relisp.el +7 -7
- data/test/test_editing_types.rb +114 -105
- metadata +55 -81
data/CHANGELOG
CHANGED
data/{README → README.rdoc}
RENAMED
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), "../../lib")
|
4
|
+
|
5
|
+
require 'relisp'
|
6
|
+
require 'profile'
|
7
|
+
|
8
|
+
emacs = Relisp::ElispSlave.new
|
9
|
+
|
10
|
+
1000.times do
|
11
|
+
# emacs.elisp_eval("(+ 1 2)").to_s
|
12
|
+
emacs.elisp_eval("(ruby-eval \"elisp_eval '(+ 1 2)'\")").to_s
|
13
|
+
end
|
14
|
+
|
data/lib/relisp.rb
CHANGED
@@ -20,8 +20,12 @@
|
|
20
20
|
#
|
21
21
|
#
|
22
22
|
|
23
|
+
# Using this introduced a very hard to trace bug.
|
24
|
+
# require 'facets/memoizable'
|
25
|
+
|
23
26
|
module Relisp
|
24
27
|
class Slave
|
28
|
+
# include Memoizable
|
25
29
|
|
26
30
|
# Save point, mark, and current buffer; execute a block of code;
|
27
31
|
# restore those things.
|
@@ -81,6 +85,13 @@ module Relisp
|
|
81
85
|
# TODO: save_selected_window
|
82
86
|
# TODO: with_selected_window
|
83
87
|
|
88
|
+
def elisp_function?(name)
|
89
|
+
@elisp_function_eh[name] ||=
|
90
|
+
elisp_eval "(functionp '#{name})"
|
91
|
+
end
|
92
|
+
|
93
|
+
# memoize :elisp_function?
|
94
|
+
|
84
95
|
private
|
85
96
|
|
86
97
|
# Forward any missing method to elisp.
|
@@ -107,7 +118,7 @@ module Relisp
|
|
107
118
|
def method_missing(function, *args) # :doc:
|
108
119
|
lisp_name = function.to_s.gsub('_', '-')
|
109
120
|
|
110
|
-
if
|
121
|
+
if elisp_function? lisp_name
|
111
122
|
elisp_eval "(#{lisp_name} #{args.map{|a| a.to_elisp}.join(' ')})"
|
112
123
|
elsif elisp_eval("(boundp '#{lisp_name})") && args.empty? # if there are args, it was meant to be a function
|
113
124
|
elisp_eval "#{lisp_name}"
|
data/lib/relisp/slaves.rb
CHANGED
data/manual_test/tests.el
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
(relisp-start-slave "tests.rb")
|
2
|
-
|
3
|
-
;; bury current buffer
|
4
|
-
(ruby-eval "buffer_bury")
|
2
|
+
;; Watch the *Relisp* buffer for all of this stuff, if you're interested
|
5
3
|
|
6
4
|
;; split this window vertically and set bottow window to
|
7
5
|
;; 'other-buffer'
|
@@ -16,3 +14,6 @@
|
|
16
14
|
;; should move text down and return t
|
17
15
|
(ruby-eval "window_scroll_down")
|
18
16
|
|
17
|
+
;; bury current buffer
|
18
|
+
(ruby-eval "buffer_bury")
|
19
|
+
|
data/src/relisp.el
CHANGED
@@ -107,14 +107,14 @@ whitespace on that side of the string."
|
|
107
107
|
"Insert TEXT at the end of the log buffer, when emacs is mater."
|
108
108
|
(or text (setq text ""))
|
109
109
|
(when (and relisp-emacs-master-p
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
(if (and (boundp 'relisp-endofmessage-regexp)
|
111
|
+
relisp-endofmessage-regexp)
|
112
|
+
(and (not (string-match relisp-endofmessage-regexp (relisp-strip text)))
|
113
|
+
(not (string-match relisp-begin-slave-code (relisp-strip text))))
|
114
|
+
t)
|
115
115
|
(with-current-buffer (get-buffer-create relisp-buffer-name)
|
116
|
-
|
117
|
-
|
116
|
+
(goto-char (point-max))
|
117
|
+
(insert text "\n")))))
|
118
118
|
|
119
119
|
;; relisp-form-command and -question convert the argument to a string,
|
120
120
|
;; if necessary, to catch end cases like `nil', but -form-answer and
|
data/test/test_editing_types.rb
CHANGED
@@ -348,57 +348,66 @@ module TestRelisp
|
|
348
348
|
assert_kind_of Relisp::Window, @emacs.selected_window
|
349
349
|
end
|
350
350
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
window.
|
373
|
-
|
374
|
-
|
375
|
-
assert
|
376
|
-
end
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
end
|
392
|
-
|
393
|
-
def
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
351
|
+
#### Tests commented out below without further explanation are because
|
352
|
+
#### emacs 24 is segfaulting when a delete or delete-others command is
|
353
|
+
#### run while emacs is running in batch mode (which is how it's being
|
354
|
+
#### run for these tests). Everything was fine for emacs 23.
|
355
|
+
|
356
|
+
#### TODO: I could rewrite some of these to not use `delete_others'.
|
357
|
+
#### Or restart emacs when necessary to ensure a clean slate. But not
|
358
|
+
#### right now.
|
359
|
+
|
360
|
+
# def test_split
|
361
|
+
# window = @emacs.selected_window
|
362
|
+
# window.delete_others
|
363
|
+
# window.split
|
364
|
+
# assert_equal 2, @emacs.window_list.to_list.size
|
365
|
+
# end
|
366
|
+
|
367
|
+
# def test_horizontally
|
368
|
+
# window = @emacs.selected_window
|
369
|
+
# window.delete_others
|
370
|
+
# old_width = window.width
|
371
|
+
# begin
|
372
|
+
# window.split_horizontally
|
373
|
+
# assert old_width > window.width
|
374
|
+
# rescue Relisp::ElispError => dag_yo
|
375
|
+
# assert dag_yo.to_s =~ /width/
|
376
|
+
# end
|
377
|
+
# end
|
378
|
+
|
379
|
+
# def test_vertically
|
380
|
+
# window = @emacs.selected_window
|
381
|
+
# window.delete_others
|
382
|
+
# old_height = window.height
|
383
|
+
# window.split_vertically
|
384
|
+
# assert old_height > window.height
|
385
|
+
# end
|
386
|
+
|
387
|
+
# def test_alive_eh
|
388
|
+
# window = @emacs.selected_window.split
|
389
|
+
# window.delete
|
390
|
+
# assert ! window.alive?
|
391
|
+
# end
|
392
|
+
|
393
|
+
# def test_delete_others
|
394
|
+
# window = @emacs.selected_window
|
395
|
+
# window.delete_others
|
396
|
+
# window.split
|
397
|
+
# assert @emacs.window_list.to_list.size > 1
|
398
|
+
# window.delete_others
|
399
|
+
# assert_equal 1, @emacs.window_list.to_list.size
|
400
|
+
# end
|
401
|
+
|
402
|
+
# def test_select
|
403
|
+
# w1 = @emacs.selected_window
|
404
|
+
# w1.delete_others
|
405
|
+
# w2 = w1.split
|
406
|
+
# w1.select
|
407
|
+
# assert_equal @emacs.selected_window, w1
|
408
|
+
# w2.select
|
409
|
+
# assert_equal @emacs.selected_window, w2
|
410
|
+
# end
|
402
411
|
|
403
412
|
def test_buffer
|
404
413
|
window = @emacs.selected_window
|
@@ -418,60 +427,60 @@ module TestRelisp
|
|
418
427
|
window.dedicated = nil
|
419
428
|
end
|
420
429
|
|
421
|
-
def test_point
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
end
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
# assert window.start > 1
|
455
|
-
|
456
|
-
# @emacs.elisp_eval "(set-window-start (selected-window) 1)"
|
457
|
-
|
458
|
-
|
459
|
-
# @emacs.elisp_eval("(redisplay)")
|
460
|
-
# puts window.start
|
461
|
-
# puts window.end
|
462
|
-
# puts window.buffer.point_max
|
463
|
-
# assert window.visible?(181)
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
430
|
+
# def test_point
|
431
|
+
# w1 = @emacs.selected_window
|
432
|
+
# w1.delete_others
|
433
|
+
# b = Relisp::Buffer.new(@emacs)
|
434
|
+
# w1.buffer=b
|
435
|
+
# assert_equal 1, w1.point
|
436
|
+
# b.insert "12345"
|
437
|
+
# w2 = w1.split
|
438
|
+
# w2.select
|
439
|
+
# w1.point = 1 # w1 point moves because of insert
|
440
|
+
# @emacs.goto_char(@emacs.point_max)
|
441
|
+
# assert_equal 6, @emacs.point
|
442
|
+
# assert_equal 1, w1.point
|
443
|
+
# w1.point = 3
|
444
|
+
# assert_equal 3, w1.point
|
445
|
+
# assert_equal 6, w2.point
|
446
|
+
# end
|
447
|
+
|
448
|
+
# def test_start
|
449
|
+
# # TODO: something is weird here. maybe the visible? function
|
450
|
+
# # doesn't work in batch mode
|
451
|
+
|
452
|
+
# window = @emacs.selected_window
|
453
|
+
# window.delete_others
|
454
|
+
# window.buffer = Relisp::Buffer.new(@emacs)
|
455
|
+
# assert_equal 1, window.start
|
456
|
+
# window.buffer.insert "a\n" * window.height * 3
|
457
|
+
# window.point = @emacs.point_max
|
458
|
+
# @emacs.elisp_eval("(redisplay)") # Need to refresh the display in
|
459
|
+
# # order to update 'buffer-start'
|
460
|
+
# # and 'buffer-end'--I don't know
|
461
|
+
# # why 'redisplay' doesn't work
|
462
|
+
# # here
|
463
|
+
# # assert window.start > 1
|
464
|
+
# assert ! window.visible?(1)
|
465
|
+
# # @emacs.elisp_eval "(set-window-start (selected-window) 1)"
|
466
|
+
# window.start = 1
|
467
|
+
|
468
|
+
# # @emacs.elisp_eval("(redisplay)")
|
469
|
+
# # puts window.start
|
470
|
+
# # puts window.end
|
471
|
+
# # puts window.buffer.point_max
|
472
|
+
# # assert window.visible?(181)
|
473
|
+
# end
|
474
|
+
|
475
|
+
# def test_scroll_up
|
476
|
+
# window = @emacs.selected_window
|
477
|
+
# window.delete_others
|
478
|
+
# window.buffer.insert "a\n" * window.height * 3
|
479
|
+
# window.scroll_up
|
480
|
+
# assert window.start > 1
|
481
|
+
# window.scroll_down
|
482
|
+
# assert window.start == 1
|
483
|
+
# end
|
475
484
|
|
476
485
|
def test_edges
|
477
486
|
window = @emacs.selected_window
|
metadata
CHANGED
@@ -1,52 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: relisp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 1.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.2
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Don
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: bones
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 5
|
33
|
-
- 4
|
34
|
-
version: 3.5.4
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.8.0
|
35
22
|
type: :development
|
36
|
-
|
37
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.8.0
|
30
|
+
description: Call ruby from emacs and call elisp from ruby. If you never did you should.
|
31
|
+
These things are fun and fun is good.
|
38
32
|
email: don@ohspite.net
|
39
33
|
executables: []
|
40
|
-
|
41
34
|
extensions: []
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
extra_rdoc_files:
|
36
|
+
- README.rdoc
|
37
|
+
files:
|
38
|
+
- .gitignore
|
46
39
|
- CHANGELOG
|
47
40
|
- COPYING
|
48
41
|
- Manifest
|
49
|
-
- README
|
42
|
+
- README.rdoc
|
50
43
|
- Rakefile
|
51
44
|
- examples/elisp_master/elisp_master.el
|
52
45
|
- examples/elisp_master/ruby_slave.rb
|
@@ -56,6 +49,7 @@ files:
|
|
56
49
|
- examples/ruby_master/elisp_data_types.rb
|
57
50
|
- examples/ruby_master/method_missing.rb
|
58
51
|
- examples/ruby_master/recursive_calling.rb
|
52
|
+
- examples/ruby_master/speed.rb
|
59
53
|
- lib/relisp.rb
|
60
54
|
- lib/relisp/elisp_functions.rb
|
61
55
|
- lib/relisp/slaves.rb
|
@@ -69,63 +63,43 @@ files:
|
|
69
63
|
- test/test_elisp_functions.rb
|
70
64
|
- test/test_programming_types.rb
|
71
65
|
- test/test_slaves.rb
|
72
|
-
has_rdoc: true
|
73
66
|
homepage: https://rubygems.org/gems/relisp
|
74
67
|
licenses: []
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
lines
|
86
|
-
|
87
|
-
(autoload 'relisp-start-slave "relisp" nil t)
|
88
|
-
(autoload 'ruby-eval "relisp" nil t)
|
89
|
-
|
90
|
-
to your emacs initialization file ('~/.emacs' or ~/.emacs.d/init.el).
|
91
|
-
|
92
|
-
If you don't know where to find the files for this gem, run the
|
93
|
-
command "gem env gemdir". Or you can download the tarball for this
|
94
|
-
gem and get the files there.
|
95
|
-
---------------------------
|
96
|
-
|
97
|
-
rdoc_options:
|
68
|
+
post_install_message: ! "---------------------------\nWait! You're not finished!\n\nThe
|
69
|
+
gem is installed, and you can now call elisp from ruby. But if\nyou want to call
|
70
|
+
ruby from emacs (and you do, right?) you need to go\ninto the 'src' directory of
|
71
|
+
this gem and copy 'relisp.el' and/or\n'relisp.elc' to your elisp folder (probably
|
72
|
+
something like\n'~/.emacs.d/site-lisp' or '~/.elisp'). Then you might want to add
|
73
|
+
the\nlines\n\n (autoload 'relisp-start-slave \"relisp\" nil t)\n (autoload 'ruby-eval
|
74
|
+
\"relisp\" nil t)\n\nto your emacs initialization file ('~/.emacs' or ~/.emacs.d/init.el).\n\nIf
|
75
|
+
you don't know where to find the files for this gem, run the\ncommand \"gem env
|
76
|
+
gemdir\". Or you can download the tarball for this\ngem and get the files there.\n---------------------------\n"
|
77
|
+
rdoc_options:
|
98
78
|
- --main
|
99
79
|
- README
|
100
|
-
require_paths:
|
80
|
+
require_paths:
|
101
81
|
- lib
|
102
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
83
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
|
109
|
-
- 0
|
110
|
-
version: "0"
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
89
|
none: false
|
113
|
-
requirements:
|
114
|
-
- -
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
|
117
|
-
segments:
|
118
|
-
- 0
|
119
|
-
version: "0"
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
120
94
|
requirements: []
|
121
|
-
|
122
95
|
rubyforge_project: relisp
|
123
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 1.8.24
|
124
97
|
signing_key:
|
125
98
|
specification_version: 3
|
126
|
-
summary: Call ruby from emacs and call elisp from ruby. If you never did you should.
|
127
|
-
|
99
|
+
summary: Call ruby from emacs and call elisp from ruby. If you never did you should.
|
100
|
+
These things are fun and fun is good.
|
101
|
+
test_files:
|
128
102
|
- test/test_editing_types.rb
|
129
|
-
- test/test_slaves.rb
|
130
|
-
- test/test_programming_types.rb
|
131
103
|
- test/test_elisp_functions.rb
|
104
|
+
- test/test_programming_types.rb
|
105
|
+
- test/test_slaves.rb
|