[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 812d202 341/496: Fix REPL prompt corruption
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 812d202 341/496: Fix REPL prompt corruption |
Date: |
Sun, 29 Aug 2021 11:34:03 -0400 (EDT) |
branch: elpa/swift-mode
commit 812d202bdf41dbc0f0e145610ee1c103071918bc
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix REPL prompt corruption
For some reason, `pop-to-buffer` with Emacs 25.1 after `make-comint`
results in corrupted prompt with strange ANSI control sequence.
For example, when feeding `class Foo {}` and enter key, the input is echoed
with the following character sequence
~~~
class Foo {}^[[1G^[[2m 1> ^[[22m^[[18G
~~~
which would be interpreted by a terminal like this
~~~
1> Foo {}
~~~
This is not desirable.
FYI, each sequence means as follows:
|sequence |meaning |
|---------|-----------------|
|`^[[1G` |Goto 1st column |
|`^[[2m` |Use faint color |
|`^[[22m` |Use normal color |
|`^[[18G` |Goto 18th column |
Curiously, while invoking `swift` command from `shell` mode works fine,
it will be corrupted with the following steps:
1. Start `shell` mode.
2. Type `M-x`.
3. Cancel the minibuffer with `C-g`.
4. Invoke `swift` command from the shell.
I could not find the cause nor why this workaround works.
---
swift-mode-repl.el | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/swift-mode-repl.el b/swift-mode-repl.el
index 3fc26e4..0493639 100644
--- a/swift-mode-repl.el
+++ b/swift-mode-repl.el
@@ -61,17 +61,20 @@ Runs the hook `swift-repl-mode-hook' \(after the
`comint-mode-hook' is run).
(list (if current-prefix-arg
(read-string "Run swift REPL: " swift-mode:repl-executable)
swift-mode:repl-executable)))
- (unless (comint-check-proc (concat "*" cmd "*"))
- (save-excursion
- (let ((cmdlist (split-string cmd)))
- (set-buffer
- (apply 'make-comint cmd (car cmdlist) nil (cdr cmdlist)))
- (swift-repl-mode))))
- (setq-local swift-mode:repl-executable cmd)
- (setq-local swift-mode:repl-buffer (concat "*" cmd "*"))
- (setq-default swift-mode:repl-buffer swift-mode:repl-buffer)
- (unless dont-switch
- (pop-to-buffer swift-mode:repl-buffer)))
+ (let ((original-buffer (current-buffer))
+ (buffer (get-buffer-create (concat "*" cmd "*"))))
+ (unless dont-switch
+ (pop-to-buffer buffer))
+ (unless (comint-check-proc (concat "*" cmd "*"))
+ (save-excursion
+ (let ((cmdlist (split-string cmd)))
+ (apply 'make-comint-in-buffer
+ cmd buffer (car cmdlist) nil (cdr cmdlist))
+ (swift-repl-mode))))
+ (with-current-buffer original-buffer
+ (setq-local swift-mode:repl-executable cmd)
+ (setq-local swift-mode:repl-buffer (concat "*" cmd "*"))
+ (setq-default swift-mode:repl-buffer swift-mode:repl-buffer))))
;;;###autoload
(defalias 'run-swift 'swift-mode:run-repl)
- [nongnu] elpa/swift-mode a5e1acf 297/496: Merge pull request #122 from N4tr0n/make-install-fix-issue120, (continued)
- [nongnu] elpa/swift-mode a5e1acf 297/496: Merge pull request #122 from N4tr0n/make-install-fix-issue120, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cfaeaff 294/496: Update MELPA URL, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9471669 304/496: Merge taku0/swift3-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 848d088 310/496: Fix indentation after attributes with arguments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cad72a1 306/496: Fix a link in README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0a75736 317/496: Fix indentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c1f7ec2 321/496: Fix indentation of switch-case body, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 7423f68 324/496: Simplify code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 58f31cc 340/496: Speed-up indentation for colon, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0b1f29d 334/496: Fix indentation of setter, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 812d202 341/496: Fix REPL prompt corruption,
ELPA Syncer <=
- [nongnu] elpa/swift-mode f755479 333/496: Fix anchor highlighting, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 56ee9b2 359/496: Add comment style option, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode dba539e 394/496: Tweak and clean-up font-lock, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode dca378a 400/496: Rename constants, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c532c1e 402/496: Update documents, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d35275b 417/496: Remove unused variables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8a7be9c 424/496: Use remap for keymap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 56e21f8 427/496: Simplify autoloads, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 922dc52 445/496: Fix code format, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b260308 451/496: Declare local variables, ELPA Syncer, 2021/08/29