smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Extra trailing brace after haskell comment

Open rosekunkel opened this issue 5 years ago • 8 comments

Expected behavior

Typing {- in haskell-mode results in {-|-} in the buffer, where | is the point

Actual behavior

Typing {- in haskell-mode results in {-|-}} in the buffer.

Steps to reproduce the problem

  1. Open a haskell-mode buffer
  2. Enable smartparens
  3. Type { and then -

Environment & version information

  • smartparens version: 9738360eb2afb58b4c21815f9d5c793b8125f540 (latest master)
  • Active major-mode: haskell-mode
  • Smartparens strict mode: nil
  • Emacs version (M-x emacs-version): GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-29
  • Starterkit/Distribution: Doom
  • OS: gnu/linux

rosekunkel avatar Dec 11 '19 03:12 rosekunkel

I have E 26.1 and can't reproduce this problem. My haskell-mode version is 1bee161d3cea973d4ee3ff7acf980bf2cdeb83e2 from Thu Sep 26 17:51:08 2019 +1200

Fuco1 avatar Mar 24 '20 21:03 Fuco1

I am seeing this too.

Emacs: 27.2 smartparens: 63695c64233d215a92bf08e762f643cdb595bdd9 haskell-mode: 1baa12abfa2c81128e5b13d1351f2978a4a54b4f

peterhoeg avatar Apr 23 '21 01:04 peterhoeg

I'm also having this problem

celsobonutti avatar Sep 03 '21 22:09 celsobonutti

I still can't repro on latest haskell-mode 333205066754348b3dd47c5ce834757dd1bbdf48

Imgur

Fuco1 avatar Sep 04 '21 13:09 Fuco1

Hey @Fuco1! Thanks for your fast reply. I don't know about the other two comments, but looks like my problem is caused by doom-emacs' default config, so I fixed it on my side.

celsobonutti avatar Sep 04 '21 15:09 celsobonutti

so I fixed it on my side.

Any chance you could be talked into sharing how?

peterhoeg avatar Sep 06 '21 05:09 peterhoeg

@peterhoeg sure! You can either disable doom-emacs smartparens configuration, or add something like this to your config.el:

(after! (smartparens haskell-mode)
  (sp-with-modes '(haskell-mode haskell-interactive-mode)
    (sp-local-pair "{-" "-}" :actions :rem)
    (sp-local-pair "{-#" "#-}" :actions :rem)
    (sp-local-pair "{-@" "@-}" :actions :rem)
    (sp-local-pair "{-" "-")
    (sp-local-pair "{-#" "#-")
    (sp-local-pair "{-@" "@-")))

I've also created a PR for this in the doom-emacs repo, btw: https://github.com/hlissner/doom-emacs/pull/5450

celsobonutti avatar Sep 06 '21 13:09 celsobonutti

I have an alternative fix, disabling dooms global "{" "}" pair

(after! (smartparens haskell-mode)
  (sp-with-modes '(haskell-mode haskell-interactive-mode)
    (sp-local-pair "{" "}" :actions :rem)
    ))

This is unfortunate, because { } should be pairs in haskell. e.g. \case {True -> False; False -> True}.

Perhaps you could demonstrate how to configure smartparens with pairs that overlap this way?

duog avatar Sep 17 '21 11:09 duog

I tried now on Emacs 28.2 and haskell mode 333205066754348b3dd47c5ce834757dd1bbdf48 and all the pairs work correctly with the default smartparens haskell config, including the { pair.

If there are some more issues please open new issues with the template filled in, particularly the part about emacs config / distribution.

Fuco1 avatar Mar 25 '24 20:03 Fuco1