Skip to content

Instantly share code, notes, and snippets.

@yuutayamada
Created January 8, 2015 01:12
Show Gist options
  • Save yuutayamada/a8c5b4b313ffb7e1f844 to your computer and use it in GitHub Desktop.
Save yuutayamada/a8c5b4b313ffb7e1f844 to your computer and use it in GitHub Desktop.
(defun org-dwim ()
"My convinience function for `org-mode'."
(interactive)
(cond
((org-in-block-p '("src"))
;; (org-in-src-block-p)
(org-edit-special))
((org-src-edit-buffer-p)
(org-edit-src-exit))
((org-table-p)
(org-table-edit-field 4))
((org-on-heading-p)
(org-todo))
((org-at-item-checkbox-p)
(org-toggle-checkbox))
((and org-return-follows-link
(let ((tprop (get-text-property (point) 'face)))
(or (eq tprop 'org-link)
(and (listp tprop) (memq 'org-link tprop)))))
(org-open-at-point))
(t (org-insert-drawer))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment