jschaf / powershell.el

An Emacs mode for editing and running Microsoft PowerShell code.
94 stars 30 forks source link

defadvice breaks ansi-color #7

Closed andyleejordan closed 3 years ago

andyleejordan commented 9 years ago

Hi!

So after dealing with this bug for weeks, I figured out what was causing it.

The Bug

Invoke M-x man man (or any other man page).

Expect to open colorized man page, instead...

Receive messages:

Please wait: formatting the man man page... error in process sentinel: ad-Advice-ansi-color-apply-on-region: Wrong type argument: markerp, 1 error in process sentinel: Wrong type argument: markerp, 1

Enable debug on error, capture traceback.

Similar problems with Magit's display of logs: ANSI color codes that should be parsed are not (but no messages).

The Cause

This defadvice at the beginning of powershell.el.

(defadvice ansi-color-apply-on-region (around
                                       powershell-throttle-ansi-colorizing
                                       (begin end)
                                       activate compile)
  (progn
    (let ((start-pos (marker-position begin)))
    (cond
     (start-pos
      (progn
        ad-do-it))))))

I know this is the cause since commenting it out makes the bug completely disappear.

Anyway, I roughly read the reasoning for the defadvice, and it sounds like we need a better solution, but I'm not sure what.

jschaf commented 9 years ago

Oh, that's a pretty bad bug. I'll deactivate for now until I came come up with a better fix.

andyleejordan commented 9 years ago

Cool beans. :smile: