Skip to content
/ capture Public

emacs org-mode protocol handler for macOS

License

Notifications You must be signed in to change notification settings

mgmart/capture

Repository files navigation

Capture

./Capture.png

Objective

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.

./screenshot.png

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.

Usage

Installation

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.

Browserscript

Using 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:

Using org-protocol

javascript:location.href='org-protocol://capture?template=l
&url='+encodeURIComponent(window.location.href)+'
&title='+encodeURIComponent(document.title)+'
&body='+encodeURIComponent(window.getSelection())';

Additional emacs config

Make capture window disappear when done

;;;
;; 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

The Unicorn is courtesy of Lohrelei

About

emacs org-mode protocol handler for macOS

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages