Skip to content

[Fix #1452] Fix broken ANSI coloring in the repl #1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 24, 2015

Conversation

rfkm
Copy link
Contributor

@rfkm rfkm commented Dec 8, 2015

(Temporary?) fix for #1452

(ansi-color-apply-on-region pos (point-max)))))
(ansi-color-apply-on-region pos (point-max))

;; Workaround for https://github.com/clojure-emacs/cider/issues/1452
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add more of the explanation of why this is needed here.

@bbatsov
Copy link
Member

bbatsov commented Dec 12, 2015

Apart from my small remarks the code looks OK to me. @Malabarba you're our resident overlays expert - any feedback from you?

@Malabarba
Copy link
Member

What does (overlays at -1) yield? If it throws an error then line 490 could be dangerous.

@Malabarba you're our resident overlays expert - any feedback from you?

The overlay code looks solid. But I must say I didn't understand why the modification-hook used by ansi-color isn't enough. Shouldn't it also be triggered whenever insert-behind-hook is triggered?

@rfkm
Copy link
Contributor Author

rfkm commented Dec 14, 2015

@bbatsov Thank you for the review! I'll fix them later.

@Malabarba

What does (overlays at -1) yield? If it throws an error then line 490 could be dangerous.

Just returns nil.

But I must say I didn't understand why the modification-hook used by ansi-color isn't enough. Shouldn't it also be triggered whenever insert-behind-hook is triggered?

I tested the behavior with the following snippet:

(with-temp-buffer
  (insert "foo")
  (let ((ov (make-overlay 1 4)))
    (overlay-put ov 'modification-hooks
                 (list (lambda (ov &rest args)
                         (message "hook %s" args))))
    (message "ov %s" ov)
    (goto-char 4)
    (insert-before-markers "a")
    (message "ov %s" ov)))

In this case, the hook is never called even though the overlay has been extended (tested with 24.4/24.5).

The manual says modification-hooks is called "if any character within the overlay is changed or if text is inserted strictly within the overlay".
I'm not sure what strictly exactly means, but it might mean text is inserted within the range of the overlay which is not extended yet.

Curiously, the comments in ansi-color-make-extent says, "we use the insert-behind-hook'" even though modification-hooks is actually used.
On the other hand, ansi-color-freeze-overlay's docstring says, "This function can be used for the modification-hooks".

@rfkm
Copy link
Contributor Author

rfkm commented Dec 19, 2015

I'm sorry I'm late.
I have just pushed some changes.

The test has been failed, but this seems not to be due to my modification.

@bbatsov
Copy link
Member

bbatsov commented Dec 20, 2015

Seems you'll have to rebase this branch on top of the current master.

@rfkm
Copy link
Contributor Author

rfkm commented Dec 20, 2015

Done

@bbatsov
Copy link
Member

bbatsov commented Dec 24, 2015

@Malabarba are you happy with the current state of the patch?

@Malabarba
Copy link
Member

Yes. Sorry for the delay.

@bbatsov
Copy link
Member

bbatsov commented Dec 24, 2015

@rfkm Rebase this and I'll have it merged.

@rfkm
Copy link
Contributor Author

rfkm commented Dec 24, 2015

Rebased. Thanks :-)

bbatsov added a commit that referenced this pull request Dec 24, 2015
[Fix #1452] Fix broken ANSI coloring in the repl
@bbatsov bbatsov merged commit 5fa0e05 into clojure-emacs:master Dec 24, 2015
@bbatsov
Copy link
Member

bbatsov commented Dec 24, 2015

👍

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.

3 participants