Skip to content

Conversation

fice-t
Copy link
Contributor

@fice-t fice-t commented Oct 26, 2016

Text that was explicitly documented as read-only is still
unconditionally read-only.

Fixes #1437.

Text that was explicitly documented as read-only is still
unconditionally read-only.
@gracjan
Copy link
Contributor

gracjan commented Oct 26, 2016

We cannot burden our users with decisions about such minutae details. We should make this decision ourselves: should this buffer be read-only or should it be read-write?

@fice-t
Copy link
Contributor Author

fice-t commented Oct 26, 2016

We cannot burden our users with decisions about such minutae details.

I don't think a couple variables are much of a burden.

The prompt being read-only should at least be a customization option. There's two precedents for it: ielm-prompt-read-only and comint-prompt-read-only.

should this buffer be read-only or should it be read-write?

Part of me likes it being read-only since it protects you from accidentally overwriting part of the output, forgetting about it, and then thinking that was the actual output.

Though that situation is rare enough, so either way is fine. I suppose it being read-write is more in-line with other Emacs REPLs.

@gracjan
Copy link
Contributor

gracjan commented Oct 26, 2016

How about we use comint-prompt-read-only directly?

@fice-t
Copy link
Contributor Author

fice-t commented Oct 26, 2016

Even IELM, which is comint-based, still has its own option for it. Since haskell-interactive-mode isn't comint-based, I think there should be an option.

@vshabanov
Copy link
Contributor

vshabanov commented Oct 26, 2016

I'm seeing such code in comint-prompt-read-only help

   (add-hook 'comint-mode-hook
      (lambda ()
        (define-key comint-mode-map [remap kill-region] 'comint-kill-region)
        (define-key comint-mode-map [remap kill-whole-line]
          'comint-kill-whole-line)))

It may be a good combination to make prompt read only (do not editable by backspace/delete) but still be able to remove it by C-k or C-w or delete/backspace on selected region. As I understand comint makes this possible. Although I personally prefer the simplest solution -- just make whole interaction buffer read-write.

@geraldus
Copy link
Contributor

just make whole interaction buffer read-write.

And what will happen if you accidentally erase 𝝺 prompt?

@gracjan gracjan merged commit cde6c60 into haskell:master Oct 27, 2016
@gracjan
Copy link
Contributor

gracjan commented Oct 27, 2016

I've merged as is. We will never know if anybody has found these two options and changed their value.

@vshabanov
Copy link
Contributor

Nothing will happen when 𝝺> erased. I sometimes press enter to make it visible again and sometimes I just enter new command. It's possible to remap common editing and navigation operations to make buffer editable but preserving 𝝺> prompts. But perhaps it's too much.

Current behaviour is more or less OK. We get read-only output by default but can change it via options.

@fice-t
Copy link
Contributor Author

fice-t commented Oct 27, 2016

Oh, I was going to slim it down to the one option, but if you do (setq haskell-interactive-mode-read-only nil) before loading haskell-customize, then it amounts to the same thing.

It's possible to remap common editing and navigation operations to make buffer editable but preserving 𝝺> prompts. But perhaps it's too much.

Well, I'm not sure if it's really worth it to do it in this package. If you'd like, you can leave the prompt read-only and just put this in your init file:

   (add-hook 'haskell-interactive-mode
      (lambda ()
        (require 'comint)
        (define-key haskell-interactive-mode-map [remap kill-region] 'comint-kill-region)
        (define-key haskell-interactive-mode-map [remap kill-whole-line]
          'comint-kill-whole-line)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants