Skip to content

Commit

Permalink
Added focus on project and back again (shift+return/shift+backspace)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedthehumanoid committed May 14, 2011
1 parent de350be commit 31fb737
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions taskpaper.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(when (not taskpaper-mode-map)
(setq taskpaper-mode-map (make-sparse-keymap))
(define-key taskpaper-mode-map (kbd "<S-return>") 'taskpaper-focus-project)
(define-key taskpaper-mode-map (kbd "<S-backspace>") 'taskpaper-unfocus-project)
)

(setq tpKeywords
Expand All @@ -13,6 +14,31 @@

)
)

(defun taskpaper-focus-project()
"Hide everything not related to current project."
(interactive)
(let ((startpoint (point)) start end)
(end-of-line)
(re-search-backward ":$")
(beginning-of-line)
(setq start (point))
(re-search-forward ":$")
(re-search-forward ":$")
(beginning-of-line)
(setq end (point))
(add-text-properties 1 start '(invisible t))
(add-text-properties end (point-max) '(invisible t))
(goto-char startpoint)
)
)

(defun taskpaper-unfocus-project()
"Show all projects if focused on one."
(interactive)
(add-text-properties 1 (point-max) '(invisible nil))
)

(defun taskpaper-mode ()
"Major mode for editing taskpaper styled files."
(interactive)
Expand Down

0 comments on commit 31fb737

Please sign in to comment.