Skip to content

Instantly share code, notes, and snippets.

@5t111111
Created March 27, 2015 05:48
Show Gist options
  • Select an option

  • Save 5t111111/4b94e2b218aa4ea6605e to your computer and use it in GitHub Desktop.

Select an option

Save 5t111111/4b94e2b218aa4ea6605e to your computer and use it in GitHub Desktop.
(Emacs) Create a note from selected region via Geeknote
(defun geeknote-create-from-region (beg end)
"Create a note from selected region via Geeknote"
(interactive (if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil)))
(setq title
(format-time-string "%Y-%m-%d %H:%M:%S" (current-time)))
(setq content
(format "%s" (if (and beg end)
(buffer-substring-no-properties beg end)
"")))
(shell-command
(format "geeknote create --title '%s' --content '%s'" title content))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment