alphapapa / org-web-tools

View, capture, and archive Web pages in Org-mode
GNU General Public License v3.0
647 stars 33 forks source link

Update template example for newer Org, and add autoload for function #30

Open sotte opened 4 years ago

sotte commented 4 years ago

I used the snippet from the code to setup my org-capture template:

 ("w" "web site from clipboard" entry (file "~/org/articles.org")
  "%(org-web-tools--url-as-readable-org)")

but I get the error Template is not a valid Org entry or tree.

Not sure what's going on here.

alphapapa commented 4 years ago

Please provide a complete example of the code you're using and steps you're taking. Also, please review C-h v org-capture-templates RET.

sotte commented 4 years ago

@alphapapa thanks for getting back so quickly and thanks for the package!

org-web-tools is installed via the spacemacs equivalent of (require 'org-web-tools) which is dotspacemacs-additional-packages '(org-web-tools). Just calling (e.g.) org-web-tools-insert-web-page-as-entry work fine.

It seems that the following is an invalid template:

 ("w" "web site from clipboard" entry (file "~/org/articles.org")
  "%(org-web-tools--url-as-readable-org)")

but this is valid (note the *):

 ("w" "web site from clipboard" entry (file "~/org/articles.org")
  "* %(org-web-tools--url-as-readable-org)")

However, when using the now fixed capture template via org-capture with a URL of the website to capture in the clipboard I get this in my capture buffer:

* %![Error: (void-function org-web-tools--url-as-readable-org)]

org-version is 9.3.2.

alphapapa commented 4 years ago

Probably a change in Org requires the leading *.

You will need to load the library before calling that function in the template. Maybe I should make it autoloaded.

Thanks for reporting these issues.