@@ -74,6 +74,7 @@ Should be able to be run without any arguments."
74
74
75
75
76
76
; ;; Private functions
77
+
77
78
(defun inf-elixir--up-directory (dir )
78
79
" Return the directory above DIR."
79
80
(file-name-directory (directory-file-name dir)))
@@ -90,6 +91,13 @@ Should be able to be run without any arguments."
90
91
(inf-elixir--find-umbrella-root default-directory)
91
92
(locate-dominating-file default-directory " mix.exs" )))
92
93
94
+ (defun inf-elixir--send (command )
95
+ " Send COMMAND to the REPL process."
96
+ (with-current-buffer inf-elixir-buffer
97
+ (comint-add-to-input-history command))
98
+ (comint-send-string inf-elixir-buffer command)
99
+ (comint-send-string inf-elixir-buffer " \n " ))
100
+
93
101
94
102
; ;; Public functions
95
103
@@ -135,20 +143,17 @@ Should be able to be run without any arguments."
135
143
(defun inf-elixir-send-line ()
136
144
" Send the region to the REPL buffer and run it."
137
145
(interactive )
138
- (comint-send-region inf-elixir-buffer (point-at-bol ) (point-at-eol ))
139
- (comint-send-string inf-elixir-buffer " \n " ))
146
+ (inf-elixir--send (buffer-substring (point-at-bol ) (point-at-eol ))))
140
147
141
148
(defun inf-elixir-send-region ()
142
149
" Send the region to the REPL buffer and run it."
143
150
(interactive )
144
- (comint-send-region inf-elixir-buffer (point ) (mark ))
145
- (comint-send-string inf-elixir-buffer " \n " ))
151
+ (inf-elixir--send (buffer-substring (point ) (mark ))))
146
152
147
153
(defun inf-elixir-send-buffer ()
148
154
" Send the buffer to the REPL buffer and run it."
149
155
(interactive )
150
- (comint-send-region inf-elixir-buffer 1 (point-max ))
151
- (comint-send-string inf-elixir-buffer " \n " ))
156
+ (inf-elixir--send (buffer-string )))
152
157
153
158
(provide 'inf-elixir )
154
159
0 commit comments