alphapapa / org-sidebar

A helpful sidebar for Org mode
GNU General Public License v3.0
527 stars 16 forks source link

Render org-entities? #11

Open tsdye opened 4 years ago

tsdye commented 4 years ago

It would be nice if org-entities were rendered in the sidebar.

I took a look at org-ql-view--format-element (element) to see if I might think about customizing this, but it looks like a lot of work for someone with way more elisp than I have!

Screenshot from 2019-10-02 06-57-09

alphapapa commented 4 years ago

Because of the way Org entities work, I'm not sure it would be good to add support for this to org-ql-view--format-element. There is no function to prettify entities in strings, and most users probably don't use them in headings.

However, this function wraps org-ql-view--format-element and prettifies entities in it. You can set org-sidebar-format-fn to it. Please let me know how it works for you.

(defun td/org-ql-view--format-element (element)
  "Format element with pretty entities."
  (with-temp-buffer
    (insert (org-ql-view--format-element element))
    (goto-char (point-min))
    (let ((org-pretty-entities t))
      (while (org-fontify-entities (point-max))
        t))
    (buffer-string)))
tsdye commented 4 years ago

Thank you! Works fine here. I'll use it and let you know if an issue arises.

Screenshot from 2019-10-02 09-06-47