File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,21 @@ be nil.")
180
180
(switch-to-buffer-other-window haskell-interactive-previous-buffer)
181
181
(message " No previous buffer. " )))
182
182
183
+ (defun haskell-interactive-copy-to-prompt ()
184
+ " Copy the current line to the prompt, overwriting the current
185
+ prompt."
186
+ (interactive )
187
+ (let ((l (buffer-substring-no-properties (line-beginning-position )
188
+ (line-end-position ))))
189
+ ; ; If it looks like the prompt is at the start of the line, chop
190
+ ; ; it off.
191
+ (when (and (>= (length l) (length haskell-interactive-prompt))
192
+ (string= (substring l 0 (length haskell-interactive-prompt))
193
+ haskell-interactive-prompt))
194
+ (setq l (substring l (length haskell-interactive-prompt))))
195
+
196
+ (haskell-interactive-mode-set-prompt l)))
197
+
183
198
(defun haskell-interactive-mode-space (n )
184
199
" Handle the space key."
185
200
(interactive " p" )
Original file line number Diff line number Diff line change 125
125
" Handle the return key."
126
126
(interactive )
127
127
(cond
128
+ ; ; At a compile message, jump to the location of the error in the
129
+ ; ; source.
128
130
((haskell-interactive-at-compile-message)
129
131
(next-error-internal ))
132
+ ; ; At the input prompt, handle the expression in the usual way.
133
+ ((haskell-interactive-at-prompt)
134
+ (haskell-interactive-handle-expr))
135
+ ; ; At any other location in the buffer, copy the line to the
136
+ ; ; current prompt.
130
137
(t
131
- (haskell-interactive-handle-expr ))))
138
+ (haskell-interactive-copy-to-prompt ))))
132
139
133
140
;;;### autoload
134
141
(defun haskell-session-kill (&optional leave-interactive-buffer )
You can’t perform that action at this time.
0 commit comments