greghendershott / racket-mode

Emacs major and minor modes for Racket: edit, REPL, check-syntax, debug, profile, packages, and more.
https://www.racket-mode.com/
GNU General Public License v3.0
682 stars 93 forks source link

`racket-hash-lang-mode` should turn off `electric-pair-open-newline-between-pairs` #685

Closed usaoc closed 11 months ago

usaoc commented 11 months ago

Okay, the implementation of electric-pair-mode is pretty ridiculous. The global hook electric-pair-open-newline-between-pairs-psif, even when electric-pair-mode is locally “turned off”, can cause weird behavior. For example,

#lang racket/base
(lambda () |(void))

Suppose point is at | (not an actual character in the buffer), breaking the line with RET will result in something like

#lang racket/base
(lambda ()
  |
(void))

To accommodate for this, racket-hash-lang-mode should setq-local electric-pair-open-newline-between-pairs to nil. Probably this should also be considered a upstream bug, but electric-pair-mode is already crazy enough (why the hell do they use global hooks?).