From 31fb737263808700615d8fbc3bfd0b8d66c76ea6 Mon Sep 17 00:00:00 2001 From: Mattias Jadelius Date: Sat, 14 May 2011 17:05:09 +0200 Subject: [PATCH] Added focus on project and back again (shift+return/shift+backspace) --- taskpaper.el | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/taskpaper.el b/taskpaper.el index 2d2c2f0..591e07e 100644 --- a/taskpaper.el +++ b/taskpaper.el @@ -2,6 +2,7 @@ (when (not taskpaper-mode-map) (setq taskpaper-mode-map (make-sparse-keymap)) (define-key taskpaper-mode-map (kbd "") 'taskpaper-focus-project) + (define-key taskpaper-mode-map (kbd "") 'taskpaper-unfocus-project) ) (setq tpKeywords @@ -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)