Subject: bug#15155: 24.3; wrap-prefix in adaptive-wrap-prefix-mode with variable-pitch has wrong face

From: Stefan Monnier <[email-masked]>
Date: Fri, 23 Aug 2013 11:39:44 -0400

> don't know. If my guess is correct, is it possible to run the
> appropriate hooks (I think adaptive-wrap uses
> `jit-lock-register`) *after* font-lock changed the face? Or is there
> another, better way to detect the correct face?

Oops, sorry, here's the patch,

        Stefan

diff --git a/packages/adaptive-wrap/adaptive-wrap.el b/packages/adaptive-wrap/adaptive-wrap.el
index 3787a99..9455789 100644
--- a/packages/adaptive-wrap/adaptive-wrap.el
+++ b/packages/adaptive-wrap/adaptive-wrap.el
@@ -96,7 +96,13 @@ extra indent = 2
   :lighter ""
   :group 'visual-line
   (if adaptive-wrap-prefix-mode
-      (jit-lock-register #'adaptive-wrap-prefix-function)
+      (progn
+        ;; HACK ATTACK!  We need to run after font-lock, but jit-lock-register
+        ;; doesn't accept an `append' argument, so we add ourselves beforehand,
+        ;; to make sure we're at the end of the hook (bug#15155).
+        (add-hook 'jit-lock-functions
+                  #'adaptive-wrap-prefix-function 'append t)
+        (jit-lock-register #'adaptive-wrap-prefix-function))
     (jit-lock-unregister #'adaptive-wrap-prefix-function)
     (with-silent-modifications
       (save-restriction
Date: Fri, 23 Aug 2013 11:39:05 -0400