@@ -2104,42 +2104,43 @@ When the region is active, toggle a ~ at the start of the region."
2104
2104
(defun lispy-newline-and-indent-plain ()
2105
2105
"When in minibuffer, exit it. Otherwise forward to `newline-and-indent'."
2106
2106
(interactive)
2107
- (if (minibufferp)
2108
- (exit-minibuffer)
2109
- (cl-case major-mode
2110
- (cider-repl-mode
2111
- (cider-repl-return))
2112
- (slime-repl-mode
2113
- (slime-repl-return))
2114
- (sly-mrepl-mode
2115
- (sly-mrepl-return))
2116
- (comint-mode
2117
- (comint-send-input))
2118
- (python-mode
2119
- (newline-and-indent))
2120
- (inferior-emacs-lisp-mode
2121
- (setq this-command 'ielm-return)
2122
- (ielm-return))
2123
- (racket-repl-mode
2124
- (racket-repl-submit))
2125
- (geiser-repl-mode
2126
- (geiser-repl-maybe-send))
2127
- (t
2128
- (if (and (not (lispy--in-string-or-comment-p))
2129
- (if (memq major-mode lispy-clojure-modes)
2130
- (lispy-looking-back "[^#`'@~][#`'@~]+")
2131
- (lispy-looking-back "[^#`',@|][#`',@]+")))
2132
- (save-excursion
2133
- (goto-char (match-beginning 0))
2134
- (newline-and-indent))
2135
- (newline-and-indent))
2136
- (let ((lispy-ignore-whitespace t))
2137
- (save-excursion
2138
- (lispy--out-backward 1)
2139
- (unless (< 50000
2140
- (- (save-excursion (forward-list 1))
2141
- (point)))
2142
- (indent-sexp))))))))
2107
+ (cond ((minibufferp)
2108
+ (exit-minibuffer))
2109
+ ((derived-mode-p 'comint-mode)
2110
+ (comint-send-input))
2111
+ (t
2112
+ (cl-case major-mode
2113
+ (cider-repl-mode
2114
+ (cider-repl-return))
2115
+ (slime-repl-mode
2116
+ (slime-repl-return))
2117
+ (sly-mrepl-mode
2118
+ (sly-mrepl-return))
2119
+ (python-mode
2120
+ (newline-and-indent))
2121
+ (inferior-emacs-lisp-mode
2122
+ (setq this-command 'ielm-return)
2123
+ (ielm-return))
2124
+ (racket-repl-mode
2125
+ (racket-repl-submit))
2126
+ (geiser-repl-mode
2127
+ (geiser-repl-maybe-send))
2128
+ (t
2129
+ (if (and (not (lispy--in-string-or-comment-p))
2130
+ (if (memq major-mode lispy-clojure-modes)
2131
+ (lispy-looking-back "[^#`'@~][#`'@~]+")
2132
+ (lispy-looking-back "[^#`',@|][#`',@]+")))
2133
+ (save-excursion
2134
+ (goto-char (match-beginning 0))
2135
+ (newline-and-indent))
2136
+ (newline-and-indent))
2137
+ (let ((lispy-ignore-whitespace t))
2138
+ (save-excursion
2139
+ (lispy--out-backward 1)
2140
+ (unless (< 50000
2141
+ (- (save-excursion (forward-list 1))
2142
+ (point)))
2143
+ (indent-sexp)))))))))
2143
2144
2144
2145
(defun lispy-open-line (arg)
2145
2146
"Add ARG lines after the current expression.
0 commit comments