Skip to content

Instantly share code, notes, and snippets.

@myuhe
Last active December 20, 2015 03:49
Show Gist options
  • Save myuhe/6066554 to your computer and use it in GitHub Desktop.
Save myuhe/6066554 to your computer and use it in GitHub Desktop.
(require 'pophint-config)
(pophint:defsource
:name "org"
:description "Part of `font-lock-comment-face' in line"
:source '((shown . "org")
(limit . 100)
(method . ((lambda ()
(when (not (eq (pophint:get-current-direction) 'backward))
(loop while (re-search-forward (concat "^\\*+ " org-todo-regexp) nil t)
for startpt = (progn (skip-syntax-backward org-todo-regexp) (point))
for endpt = (progn (skip-syntax-forward org-todo-regexp) (point))
for value = (when endpt (buffer-substring-no-properties startpt endpt))
if (and (stringp value)
(not (string= value "")))
return (make-pophint:hint :startpt startpt :endpt endpt :value value))))
(lambda ()
(when (not (eq (pophint:get-current-direction) 'forward))
(loop while (re-search-backward (concat "^\\*+ " org-todo-regexp) nil t)
for endpt = (re-search-forward (concat "^\\*+ " org-todo-regexp) nil t)
for startpt = (re-search-backward org-todo-regexp nil t)
for value = (when startpt (buffer-substring-no-properties startpt endpt))
if (and (stringp value)
(not (string= value "")))
return (make-pophint:hint :startpt startpt :endpt endpt :value value))))))))
(pophint:defaction :key "x"
:name "org-done"
:description "org-todo done"
:action (lambda ()
(org-todo 'done)))
(defun pophint-config:org-setup ()
(add-to-list 'pophint:sources 'pophint:source-org))
(add-hook 'org-mode-hook 'pophint-config:org-setup t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment