polymode / poly-org

Polymode for org-mode
57 stars 12 forks source link

consult-preview with poly-org don't work #47

Open Cletip opened 1 year ago

Cletip commented 1 year ago

Hi everyone!

I was doing some testing, and it's impossible to get poly-org with the preview feature. I think the problem comes from the fact that consult needs, in the "consult-preview-allowed-hooks" variable, a function like "global-org-modern-mode-check-buffers", which means that poly-org must also be in "global" mode. I've already done this, but without success (and I don't understand why... perhaps I've misunderstood something).

(require 'poly-org)

(define-globalized-minor-mode global-poly-org-mode
  poly-org-mode poly-org--on
  :group 'poly-org
  )

(defun poly-org--on ()
  "Enable `org-modern' in every Org buffer."
  (when (derived-mode-p #'org-mode)
    (poly-org-mode)))

    ;; not activate poly-org with this temporaly
;;(setq auto-mode-alist (remove '("\\.org\\'" . poly-org-mode) auto-mode-alist))

(add-to-list 'consult-preview-allowed-hooks 'global-poly-org-mode-check-buffers)

Hope that can help ^^