Orca - new package to improve org-capture from browser28 Oct 2017
- either I refile each time I capture, which is slow
- or my captures pile up in one place, which is messy
- Define rules for where links from certain websites should be captured.
- Allow to capture directly into the current org-mode buffer, since it's likely related to what I'm working with on.
Part 1: Rules example
Here is my example list of configurations:
- Capture URL matching https://www.reddit.com/emacs/ to
- Capture URL matching https://emacs.stackexchange.com/ to
- If nothing else matches, capture to
(setq orca-handler-list '((orca-handler-match-url "https://www.reddit.com/" "~/Dropbox/org/wiki/emacs.org" "Reddit") (orca-handler-match-url "https://emacs.stackexchange.com/" "~/Dropbox/org/wiki/emacs.org" "\\* Questions") (orca-handler-file "~/Dropbox/org/ent.org" "\\* Articles")))
Part 2: Current buffer example
For example, I'm researching how to implement something with
docker. This means that I have
docker.org open, along with dozens of tabs in the browser.
I can configure to capture into the current org-mode buffer with a
Tasks heading like this:
(push '(orca-handler-current-buffer "\\* Tasks") orca-handler-list)
* Tasks, I just click the capture button in
Firefox and follow up with an immediate C-c C-c in Emacs.
The link is already in the right position, no need for an extra refile
customize with orca
You can set up the capture rules using M-x
Here's a screenshot:
As you see, the customization is a list of an arbitrary length, with
each element falling into one of three categories, each backed by an
Elisp function (
orca-handler-match-url). Each function takes a different number
of arguments (one, two, and three, respectively) - they are all
annotated by the interface.
Here's the code that describes the expected
(defcustom orca-handler-list ;; ... :type '(repeat (choice (list :tag "Current buffer" (const orca-handler-current-buffer) (string :tag "Heading")) (list :tag "URL matching regex" (const orca-handler-match-url) (string :tag "URL") (string :tag "File") (string :tag "Heading")) (list :tag "Default" (const orca-handler-file) (string :tag "File") (string :tag "Heading")))))
You can read more about the customization types in this manual section.
I hope you enjoy
orca. I've submitted it to MELPA. Hopefully, it
will be available for an easy install very soon.
Org-mode is a beautiful thing, but my previous attempts to configure
it were huge config files of loosely related (i.e. the only thing in
common was Org-mode) stuff spanning hundreds of lines. Orca is an
improvement in this respect, since it focuses on a very narrow
domain. It still tries to be flexible (just like
org-capture) - you
can plug in your own functions into
initially, the flexibility can be constrained into the
customize-group interface, to allow for a self-documenting solution
that's easy to get started with. Happy hacking!