Capture is another wrapper to use org-protocol an a MacOs machine. There are plenty already existing and depending on the Emacs port org-protocol support ist often built in.
Capture does create only a small Emacs frame, so most of the current context is still visisble to the user whilst capturing. For this all existing Emacs frame should be minimised to the Dock.
As usual the application must be present in the Application Folder. Additionally the user is asked to allow Capture to call System Events by AppleScript. This is necessary because the Focus should be on calling application after capture.
To use Capture to capture a link to the current page
javascript:location.href='capture://capture?template=l
&url='+encodeURIComponent(window.location.href)+'
&title='+encodeURIComponent(document.title)+'
&body='+encodeURIComponent(window.getSelection())+';
To use e.g. Homebrew’s Emacs’ org-protocol
directly:
javascript:location.href='org-protocol://capture?template=l
&url='+encodeURIComponent(window.location.href)+'
&title='+encodeURIComponent(document.title)+'
&body='+encodeURIComponent(window.getSelection())';
;;;
;; Capture floating frame
;;
;; taken from: http://www.windley.com/archives/2010/12/capture_mode_and_emacs.shtml
;;;
(defadvice org-capture-finalize
(after delete-capture-frame activate)
"Advise capture-finalize to close the frame"
(if (equal "capture" (frame-parameter nil 'title))
(delete-frame)))
(defadvice org-capture-destroy
(after delete-capture-frame activate)
"Advise capture-destroy to close the frame"
(if (equal "capture" (frame-parameter nil 'title)
(delete-frame))))
;; make the frame contain a single window. by default org-capture
;; splits the window.
(add-hook 'org-capture-mode-hook
'delete-other-windows)
(defadvice org-switch-to-buffer-other-window
(after supress-window-splitting activate)
"Delete the extra window if we're in a capture frame"
(if (equal "capture" (frame-parameter nil 'title))
(delete-other-windows)))
The Unicorn is courtesy of Lohrelei