### Update: I finally published my Chrome Extension :)
I know that you have heard about org, and how great it is. But then you started trying it and you were overwhelmed at how many ways of customizing it to suit your needs are there. Also you might find that you could switch your lifestyle to plain text, but don't know where to start. That's why I think this could be a first introduction post on how to use org-capture to manage your bookmarks, remember you could store the org file into a file synchronizer of your choice and have it also in your phone.
It'll look something like this:
* Disclaimer * I'm no way an org-mode power user, and the advice here could
be improved a lot, and that's why you can also make
constructive comments :)
We take the desktop file from this blog post which explaining how we could use org-protocol with a button in the bookmark bar. But I think we may be able to do better :) -psst, I'll give you a hint: we'll use a chrome extension-
# ~/.local/share/applications/emacs-capture.desktop or wherever it can be found [Desktop Entry] Name=Emacs Client Exec=emacs-capture %u Icon=emacs-icon Type=Application Terminal=false MimeType=x-scheme-handler/org-protocol;
You might find that we used
emacs-capture instead of emacsclient, that's
because no matter how hard I tried I couldn't add the arguments I needed into the
.desktop file, this is how the
emacs-capture script looks like:
#!/bin/sh emacsclient -c -F "((name . \"emacs-capture\") (height . 10) (width . 80))" "$@"
You'll have to put it somewhere in your
~/bin? just double
-c means we want a new frame (we want a pop-up after all) and the
-F flag just tells emacs to create the new frame with the frame-properties
defined in the alist given to it, the name property is special for reasons
you'll see later but it's specially important for us Tiling Window Manager
users, because we have to define which type of windows we want as
i3, this would look like this:
for_window [instance="emacs-capture"] floating enable
Let's jump in the Emacs part though, we have to set up org-protocol somehow, this code will be enough:
(require 'org-capture) (require 'org-protocol) ;;; Org Capture ;;;; Thank you random guy from StackOverflow ;;;; http://stackoverflow.com/questions/23517372/hook-or-advice-when-aborting-org-capture-before-template-selection (defadvice org-capture (after make-full-window-frame activate) "Advise capture to be the only window when used as a popup" (if (equal "emacs-capture" (frame-parameter nil 'name)) (delete-other-windows))) (defadvice org-capture-finalize (after delete-capture-frame activate) "Advise capture-finalize to close the frame" (if (equal "emacs-capture" (frame-parameter nil 'name)) (delete-frame))) ;;; Capture Templates ;;;; Add idea, mind-onanism, contacts, movies to download das (setq org-capture-templates '(("l" "Temp Links from the interwebs" item (file+headline "links.org" "Temporary Links") "%?\nEntered on %U\n \%i\n %a")))
emacs-capture was part of the frame-properties? this is why, we
can advise the capture function to do certain stuff only in this popup frame
that we would not normally like when we use org-capture normally, like closing
the frame after it's done.
The Capture template could be improved, I'd suggest to anyone that wants to dive into this type of integration to check out how to make cool templates, you can even make it ask you for tags, and it will complete the tags you have there. :)
We have now achieved the emacs related part of this, congratz, m8!
Now we have to have something in our browser that allows us to bind
Control+Shift+L (or any key you may want, just modify the setting in
chrome://extensions). We'll use an extension that I made especially for this
case, as I didn't find another that worked, I'm planning on supporting
auto-detection of templates needed depending on the current web page, for
example if it's a YouTube video we are bookmarking it should maybe store more
stuff, even we could store the current time in the video or whatever :), the sky
is the limit when it comes to Emacs. However, I'm currently unable to pay the $5
needed to publish this app ( ;_;), so you'll just have to clone my repo (link at the
bottom) and upload it to the extensions manually in your browser.
I hope you find this useful, and if you have any suggestions, PRs are welcome at https://github.com/CestDiego/org-capture-chrome. Leave a comment suggesting how would you use org-capture as well ☺.
* UPDATE 1*
So thanks to user /u/shackra on /r/emacs I can share with you another use for
non-chrome users, you'll need to have the Emacs lisp above, and also the
emacs-capture script in your
In your WM or Desktop Environment check how to run commands with key bindings,
and bind any key you want (I'm using Super+Space here for i3) and then pass the
-e "(org-capture nil \"l\")" = where
l in this case is the
template I defined above, I have others (like
i for jotting ideas)
("i" "Jotting ideas fast" entry (file+headline "gtd.org" "Ideas") "* %?\n %i\n%t\n%A")
bindsym $mod+space exec emacs-capture --eval '(org-capture nil "l")' bindsym $mod+Shift+space exec emacs-capture --eval '(org-capture nil "i")'
And so you can have multiple key bindings to register many capture actions, go nuts.