Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions haskell-customize.el
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,21 @@ printing compilation messages."
:type 'boolean
:group 'haskell-interactive)

(defcustom haskell-interactive-mode-read-only
t
"Non-nil means most GHCi/haskell-interactive-mode output is read-only.
This does not include the prompt. Configure
`haskell-interactive-prompt-read-only' to change the prompt's
read-only property."
:type 'boolean
:group 'haskell-interactive)

(defcustom haskell-interactive-prompt-read-only
haskell-interactive-mode-read-only
"Non-nil means the prompt (and prompt2) is read-only."
:type 'boolean
:group 'haskell-interactive)

(defcustom haskell-import-mapping
'()
"Support a mapping from module to import lines.
Expand Down
19 changes: 9 additions & 10 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ SESSION, otherwise operate on the current buffer."
(let ((prompt (propertize haskell-interactive-prompt
'font-lock-face 'haskell-interactive-face-prompt
'prompt t
'read-only t
'read-only haskell-interactive-prompt-read-only
'rear-nonsticky t)))
;; At the time of writing, front-stickying the first char gives an error
;; Has unfortunate side-effect of being able to insert before the prompt
Expand All @@ -318,17 +318,16 @@ SESSION, otherwise operate on the current buffer."
'font-lock-face 'haskell-interactive-face-result
'front-sticky t
'prompt t
'read-only t
'read-only haskell-interactive-mode-read-only
'rear-nonsticky t
'result t)))
(save-excursion
(goto-char (point-max))
(when (string= text haskell-interactive-prompt2)
(put-text-property 0
(length haskell-interactive-prompt2)
'font-lock-face
'haskell-interactive-face-prompt2
prop-text))
(setq prop-text
(propertize prop-text
'font-lock-face 'haskell-interactive-face-prompt2
'read-only haskell-interactive-prompt-read-only)))
(insert (ansi-color-apply prop-text))
(haskell-interactive-mode-handle-h)
(let ((marker (setq-local haskell-interactive-mode-result-end (make-marker))))
Expand Down Expand Up @@ -366,20 +365,20 @@ SESSION, otherwise operate on the current buffer."
'expandable t
'font-lock-face type
'front-sticky t
'read-only t
'read-only haskell-interactive-mode-read-only
'rear-nonsticky t))
(insert (propertize (concat (match-string 2 message) "\n")
'collapsible t
'font-lock-face type
'front-sticky t
'invisible haskell-interactive-mode-hide-multi-line-errors
'message-length (length (match-string 2 message))
'read-only t
'read-only haskell-interactive-mode-read-only
'rear-nonsticky t)))
(insert (propertize (concat message "\n")
'font-lock-face type
'front-sticky t
'read-only t
'read-only haskell-interactive-mode-read-only
'rear-nonsticky t)))))))

(defun haskell-interactive-mode-insert (session message)
Expand Down