@@ -298,26 +298,24 @@ do the
298
298
(defun haskell-interactive-mode-prompt (&optional session )
299
299
" Show a prompt at the end of the REPL buffer.
300
300
If SESSION is non-nil, use the REPL buffer associated with
301
- SESSION, otherwise operate on the current buffer.
302
- "
301
+ SESSION, otherwise operate on the current buffer."
303
302
(with-current-buffer (if session
304
303
(haskell-session-interactive-buffer session)
305
304
(current-buffer ))
306
305
(goto-char (point-max ))
307
- (insert (propertize haskell-interactive-prompt
308
- 'font-lock-face 'haskell-interactive-face-prompt
309
- 'read-only t
310
- 'rear-nonsticky t
311
- 'prompt t ))
306
+ (let ((prompt (propertize haskell-interactive-prompt
307
+ 'font-lock-face 'haskell-interactive-face-prompt
308
+ 'prompt t
309
+ 'read-only t
310
+ 'rear-nonsticky t )))
311
+ ; ; At the time of writing, front-stickying the first char gives an error
312
+ ; ; Has unfortunate side-effect of being able to insert before the prompt
313
+ (insert (substring prompt 0 1 )
314
+ (propertize (substring prompt 1 )
315
+ 'front-sticky t )))
312
316
(let ((marker (set (make-local-variable 'haskell-interactive-mode-prompt-start )
313
317
(make-marker ))))
314
- (set-marker marker
315
- (point )
316
- (current-buffer ))
317
- (when nil
318
- (let ((o (make-overlay (point ) (point-max ) nil nil t )))
319
- (overlay-put o 'line-prefix (make-string (length haskell-interactive-prompt)
320
- ? )))))
318
+ (set-marker marker (point )))
321
319
(when haskell-interactive-mode-scroll-to-bottom
322
320
(haskell-interactive-mode-scroll-to-bottom))))
323
321
@@ -328,9 +326,10 @@ SESSION, otherwise operate on the current buffer.
328
326
(insert (ansi-color-apply
329
327
(propertize text
330
328
'font-lock-face 'haskell-interactive-face-result
331
- 'rear-nonsticky t
332
- 'read-only t
329
+ 'front-sticky t
333
330
'prompt t
331
+ 'read-only t
332
+ 'rear-nonsticky t
334
333
'result t )))
335
334
(haskell-interactive-mode-handle-h)
336
335
(let ((marker (set (make-local-variable 'haskell-interactive-mode-result-end )
@@ -365,22 +364,25 @@ SESSION, otherwise operate on the current buffer.
365
364
(save-excursion
366
365
(haskell-interactive-mode-goto-end-point)
367
366
(let ((lines (string-match " ^\\ (.*\\ )\n \\ ([[:unibyte:][:nonascii:]]+\\ )" message)))
368
- (when lines
369
- (insert (propertize (concat (match-string 1 message) " …\n " )
370
- 'font-lock-face type
371
- 'read-only t
372
- 'rear-nonsticky t
373
- 'expandable t ))
374
- (insert (propertize (concat (match-string 2 message) " \n " )
375
- 'font-lock-face type
376
- 'read-only t
377
- 'rear-nonsticky t
378
- 'collapsible t
379
- 'invisible haskell-interactive-mode-hide-multi-line-errors
380
- 'message-length (length (match-string 2 message)))))
381
- (unless lines
367
+ (if lines
368
+ (progn
369
+ (insert (propertize (concat (match-string 1 message) " …\n " )
370
+ 'expandable t
371
+ 'font-lock-face type
372
+ 'front-sticky t
373
+ 'read-only t
374
+ 'rear-nonsticky t ))
375
+ (insert (propertize (concat (match-string 2 message) " \n " )
376
+ 'collapsible t
377
+ 'font-lock-face type
378
+ 'front-sticky t
379
+ 'invisible haskell-interactive-mode-hide-multi-line-errors
380
+ 'message-length (length (match-string 2 message))
381
+ 'read-only t
382
+ 'rear-nonsticky t )))
382
383
(insert (propertize (concat message " \n " )
383
384
'font-lock-face type
385
+ 'front-sticky t
384
386
'read-only t
385
387
'rear-nonsticky t )))))))
386
388
@@ -390,6 +392,7 @@ SESSION, otherwise operate on the current buffer.
390
392
(save-excursion
391
393
(haskell-interactive-mode-goto-end-point)
392
394
(insert (propertize message
395
+ 'front-sticky t
393
396
'read-only t
394
397
'rear-nonsticky t )))))
395
398
@@ -736,8 +739,7 @@ wrapped in compiler directive at the top of FILE."
736
739
(error " don't know where to find %S " file)))))))
737
740
738
741
(defun haskell-interactive-session ()
739
- " Get the `haskell-session' , throw an error if it's not
740
- available."
742
+ " Get the `haskell-session' , throw an error if it's not available."
741
743
(or (haskell-session-maybe )
742
744
(haskell-session-assign
743
745
(or (haskell-session-from-buffer)
@@ -751,8 +753,8 @@ wrapped in compiler directive at the top of FILE."
751
753
buffer. Maybe run M-x haskell-process-restart? " )))
752
754
753
755
(defun haskell-interactive-mode-do-presentation (expr )
754
- " Present the given expression. Requires the `present` package
755
- to be installed. Will automatically import it qualified as Present."
756
+ " Present the given expression. Requires the `present' package
757
+ to be installed. Will automatically import it qualified as Present."
756
758
(let ((p (haskell-interactive-process)))
757
759
; ; If Present.code isn't available, we probably need to run the
758
760
; ; setup.
@@ -1083,6 +1085,7 @@ don't care when the thing completes as long as it's soonish."
1083
1085
(concat message " \n " )
1084
1086
mode)
1085
1087
(propertize (concat message " \n " )
1088
+ 'front-sticky t
1086
1089
'read-only t
1087
1090
'rear-nonsticky t ))))))
1088
1091
@@ -1118,6 +1121,7 @@ don't care when the thing completes as long as it's soonish."
1118
1121
(save-excursion
1119
1122
(haskell-interactive-mode-goto-end-point)
1120
1123
(insert (propertize message
1124
+ 'front-sticky t
1121
1125
'font-lock-face 'haskell-interactive-face-garbage
1122
1126
'read-only t
1123
1127
'rear-nonsticky t )))))
0 commit comments