chenyanming / shrface

Extend eww/nov with org-mode features, archive web pages to org files with shr.
GNU General Public License v3.0
213 stars 14 forks source link

error "‘org-element-at-point’ cannot be used in non-org buffer #22

Open gfgkmn opened 1 year ago

gfgkmn commented 1 year ago

I use Doom Emacs, and after upgrading to Emacs 29 and updating Doom, I encountered an issue when enabling shrface in eww. I kept receiving a minibuffer error message:

"Error running timer 'org-indent-initialize-agent': (error "'org-element-at-point' cannot be used in a non-org buffer #<buffer eww> (eww-mode)")"

I tried debugging it, but couldn't find a solution. It seems that org-element-at-point does not support non-org buffers.

Is there anybody who could help? I would be very thankful.

2mc commented 1 year ago

Getting the very same ERROR.

ziova commented 9 months ago

still having this issue, seems like disabling org indent mode seems to fix it but I do prefer keeping it on. any fixes?

chenyanming commented 7 months ago

Can not easily fix right now, you can use shr-indentation instead.

ziova commented 5 months ago

hi is there any way to make sure that the indentation on each org-headline is the same, for example instead of: image have all the headines starting at the same time (instead of the normal org indentation where headlines get indented more if they are under another headline.

ziova commented 5 months ago

or is there anyway to suppress the bullets whilst still maintaining navigational properties like imenu and headline folding?

chenyanming commented 5 months ago

or is there anyway to suppress the bullets whilst still maintaining navigational properties like imenu and headline folding?

I have the following setting for nov:

  (setq nov-render-html-function #'my-nov-render-html)
  (defun my-nov-render-html ()
    (require 'eww)
    (let ((shrface-org nil)
          (shr-bullet (concat (char-to-string shrface-item-bullet) " "))
          (shr-table-vertical-line "|")
          (shr-width 65)              ; if serif, 80 is better, but serif has problem on width.
          (shr-indentation 3)
          (tab-width 8)
          (shr-external-rendering-functions
           (append '((img . nov-render-img)
                     (title . nov-render-title)
                     (pre . shrface-shr-tag-pre-highlight)
                     (code . shrface-tag-code)
                     (form . eww-tag-form)
                     (input . eww-tag-input)
                     (button . eww-form-submit)
                     (textarea . eww-tag-textarea)
                     (select . eww-tag-select)
                     (link . eww-tag-link)
                     (meta . eww-tag-meta))
                   shrface-supported-faces-alist))
          (shrface-toggle-bullets nil)
          (shrface-href-versatile t)
          (shr-use-fonts nil)           ; nil to use default font
          (shr-map nov-mode-map))

Bind shr-indentation to 3, it has similar reading experience.

All texts except headings will be indented with 3 white spaces like so, image

chenyanming commented 5 months ago

suppress the bullets

Bind shrface-toggle-bullets to t, shrface-headline-consult should still work.

chenyanming commented 5 months ago

I just found that the version org 9.6.1 which I am using right now, it could be able to use org-indent-mode for non-org buffer. Simply add

  (add-hook 'nov-mode-hook #'org-indent-mode)

It could enable org-indent-mode for nov.