* Highlighting Sparse Tree Leaves @ 2008-02-14 23:36 Wanrong Lin 2008-02-18 11:18 ` Carsten Dominik 0 siblings, 1 reply; 6+ messages in thread From: Wanrong Lin @ 2008-02-14 23:36 UTC (permalink / raw) To: emacs-orgmode Hi, Is it possible to highlighting only the sparse tree leaves, or even better, highlighting the whole sparse tree but with leaves in a special face? The motivation for such a feature is this: Suppose I have a task tree like this: * TODO Task A *** TODO Task A.1 ***** TODO Task A.1.1 * TODO Task B *** TODO Task B.1 ***** TODO Task B.1.1 ***** TODO Task B.1.2 If I do a "org-sparse-tree", all those lines are highlighted, giving an impression that I have a lot of open tasks, but in reality I only have three tasks: A.1.1, B.1.1 and B.1.2, as the higher level tasks are automatically done if those are done. So it would be nice to highlight those leaves in a special face. Also, suppose both B.1.1 and B.1.2 are done, then Task B.1 should be highlighted as a leaf. Hope the above makes some sense. Thank you very much for giving it a thought. Wanrong ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Highlighting Sparse Tree Leaves 2008-02-14 23:36 Highlighting Sparse Tree Leaves Wanrong Lin @ 2008-02-18 11:18 ` Carsten Dominik 2008-02-18 15:19 ` Wanrong Lin 0 siblings, 1 reply; 6+ messages in thread From: Carsten Dominik @ 2008-02-18 11:18 UTC (permalink / raw) To: Wanrong Lin; +Cc: emacs-orgmode Hi Wanrong, No, I think you need to find a different way around this. For example by using a different keyword for the headings that contain the true TODO items. I use PROJECT or something similar. When you then search for TODO, the true tasks will be highlighted. - Carsten On Feb 15, 2008, at 12:36 AM, Wanrong Lin wrote: > Hi, > > Is it possible to highlighting only the sparse tree leaves, or even > better, highlighting the whole sparse tree but with leaves in a > special face? > > The motivation for such a feature is this: > > Suppose I have a task tree like this: > > * TODO Task A > *** TODO Task A.1 > ***** TODO Task A.1.1 > * TODO Task B > *** TODO Task B.1 > ***** TODO Task B.1.1 > ***** TODO Task B.1.2 > > If I do a "org-sparse-tree", all those lines are highlighted, giving > an impression that I have a lot of open tasks, but in reality I only > have three tasks: A.1.1, B.1.1 and B.1.2, as the higher level tasks > are automatically done if those are done. So it would be nice to > highlight those leaves in a special face. Also, suppose both B.1.1 > and B.1.2 are done, then Task B.1 should be highlighted as a leaf. > > Hope the above makes some sense. Thank you very much for giving it a > thought. > > Wanrong > > > > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Highlighting Sparse Tree Leaves 2008-02-18 11:18 ` Carsten Dominik @ 2008-02-18 15:19 ` Wanrong Lin 2008-02-21 16:42 ` Carsten Dominik 0 siblings, 1 reply; 6+ messages in thread From: Wanrong Lin @ 2008-02-18 15:19 UTC (permalink / raw) To: emacs-orgmode Using "PROJECT" as a TODO keyword certainly can work, however, my work flow usually is first quickly mark anything that needs action with "TODO" and later I may add more sub-items to it. Following this approach I will need to remember to change "TODO" to "PROJECT" once a TODO item starts to have sub-items. Also, if all sub-actions of a "PROJECT" are marked as "DONE", I need to remember to turn the "PROJECT" back to "TODO", as I need the sparse tree to remind me to double check this TODO/PROJECT item to see whether it is really all done, or I need to add more sub-actions to it (and turn it back to "PROJECT" again). As you can see, that is a lot of manually actions and mistakes can be easily made. Maybe my workflow has some problem here, but I can not think of anything else that works better. The difficulty to me is, an item can be either PROJECT or TODO depending on how detailed your plan is, which keeps changing. I think if we can have the *option* of selecting a different face for highlighting sparse tree leaves, the above can be solved elegantly. You can still see the whole sparse tree, but the leaves will stand out. Just trying to push my case a little bit. :-) Thanks a lot. Wanrong Carsten Dominik wrote: > Hi Wanrong, > > No, I think you need to find a different way around this. > For example by using a different keyword for the headings that contain > the true TODO items. I use PROJECT or something similar. > When you then search for TODO, the true tasks will be highlighted. > > - Carsten > > On Feb 15, 2008, at 12:36 AM, Wanrong Lin wrote: > >> Hi, >> >> Is it possible to highlighting only the sparse tree leaves, or even >> better, highlighting the whole sparse tree but with leaves in a >> special face? >> >> The motivation for such a feature is this: >> >> Suppose I have a task tree like this: >> >> * TODO Task A >> *** TODO Task A.1 >> ***** TODO Task A.1.1 >> * TODO Task B >> *** TODO Task B.1 >> ***** TODO Task B.1.1 >> ***** TODO Task B.1.2 >> >> If I do a "org-sparse-tree", all those lines are highlighted, giving >> an impression that I have a lot of open tasks, but in reality I only >> have three tasks: A.1.1, B.1.1 and B.1.2, as the higher level tasks >> are automatically done if those are done. So it would be nice to >> highlight those leaves in a special face. Also, suppose both B.1.1 >> and B.1.2 are done, then Task B.1 should be highlighted as a leaf. >> >> Hope the above makes some sense. Thank you very much for giving it a >> thought. >> >> Wanrong >> >> >> >> >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Highlighting Sparse Tree Leaves 2008-02-18 15:19 ` Wanrong Lin @ 2008-02-21 16:42 ` Carsten Dominik 2008-02-21 22:53 ` Wanrong Lin 0 siblings, 1 reply; 6+ messages in thread From: Carsten Dominik @ 2008-02-21 16:42 UTC (permalink / raw) To: Wanrong Lin; +Cc: emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 3260 bytes --] On Feb 18, 2008, at 4:19 PM, Wanrong Lin wrote: > > Using "PROJECT" as a TODO keyword certainly can work, however, my > work flow usually is first quickly mark anything that needs action > with "TODO" and later I may add more sub-items to it. Following this > approach I will need to remember to change "TODO" to "PROJECT" once > a TODO item starts to have sub-items. Also, if all sub-actions of a > "PROJECT" are marked as "DONE", I need to remember to turn the > "PROJECT" back to "TODO", as I need the sparse tree to remind me to > double check this TODO/PROJECT item to see whether it is really all > done, or I need to add more sub-actions to it (and turn it back to > "PROJECT" again). > > As you can see, that is a lot of manually actions and mistakes can > be easily made. Maybe my workflow has some problem here, but I can > not think of anything else that works better. The difficulty to me > is, an item can be either PROJECT or TODO depending on how detailed > your plan is, which keeps changing. > > I think if we can have the *option* of selecting a different face > for highlighting sparse tree leaves, the above can be solved > elegantly. You can still see the whole sparse tree, but the leaves > will stand out. > > Just trying to push my case a little bit. :-) Thanks a lot. That is fine, but it does not work in this case... :-( - Carsten > > > Wanrong > > Carsten Dominik wrote: >> Hi Wanrong, >> >> No, I think you need to find a different way around this. >> For example by using a different keyword for the headings that >> contain the true TODO items. I use PROJECT or something similar. >> When you then search for TODO, the true tasks will be highlighted. >> >> - Carsten >> >> On Feb 15, 2008, at 12:36 AM, Wanrong Lin wrote: >> >>> Hi, >>> >>> Is it possible to highlighting only the sparse tree leaves, or >>> even better, highlighting the whole sparse tree but with leaves in >>> a special face? >>> >>> The motivation for such a feature is this: >>> >>> Suppose I have a task tree like this: >>> >>> * TODO Task A >>> *** TODO Task A.1 >>> ***** TODO Task A.1.1 >>> * TODO Task B >>> *** TODO Task B.1 >>> ***** TODO Task B.1.1 >>> ***** TODO Task B.1.2 >>> >>> If I do a "org-sparse-tree", all those lines are highlighted, >>> giving an impression that I have a lot of open tasks, but in >>> reality I only have three tasks: A.1.1, B.1.1 and B.1.2, as the >>> higher level tasks are automatically done if those are done. So it >>> would be nice to highlight those leaves in a special face. Also, >>> suppose both B.1.1 and B.1.2 are done, then Task B.1 should be >>> highlighted as a leaf. >>> >>> Hope the above makes some sense. Thank you very much for giving it >>> a thought. >>> >>> Wanrong >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode [-- Attachment #1.2: Type: text/html, Size: 6470 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Highlighting Sparse Tree Leaves 2008-02-21 16:42 ` Carsten Dominik @ 2008-02-21 22:53 ` Wanrong Lin 2008-02-22 7:07 ` Carsten Dominik 0 siblings, 1 reply; 6+ messages in thread From: Wanrong Lin @ 2008-02-21 22:53 UTC (permalink / raw) To: emacs-orgmode Hi, Carsten, I hacked a patch that does what I need. Just in case you change your mind in the future, or anyone else has the same need as I, here is the patch (against org.el in 5.22a. I did not get time to learn git yet). Thanks. Wanrong -------------------------------- 15082c15082,15085 < (org-highlight-new-match (match-beginning 0) (match-end 0))) --- > ;; <WL: changed to highlight sparse tree leaves> > (if (and org-highlight-sparse-tree-leaf (not (org-has-match-in-subtree-p regexp))) > (org-highlight-new-match (match-beginning 0) (match-end 0) 'org-sparse-tree-leaf) > (org-highlight-new-match (match-beginning 0) (match-end 0)))) 15141,15145c15144,15149 < (defun org-highlight-new-match (beg end) < "Highlight from BEG to END and mark the highlight is an occur headline." < (let ((ov (org-make-overlay beg end))) < (org-overlay-put ov 'face 'secondary-selection) < (push ov org-occur-highlights))) --- > ;;;; <WL> replaced with my own version to support highlighting sparse tree leaves > ;; (defun org-highlight-new-match (beg end) > ;; "Highlight from BEG to END and mark the highlight is an occur headline." > ;; (let ((ov (org-make-overlay beg end))) > ;; (org-overlay-put ov 'face 'secondary-selection) > ;; (push ov org-occur-highlights))) 28233a28238,28265 > ;;;;;; <WL> my own extension to org to show sparse tree leaves in different face ;;;;; > > ;; highlighting sparse tree leaves > > ;; <WL> > (defvar org-highlight-sparse-tree-leaf t > "Whether to highlight sparse tree leaves") > (defface org-sparse-tree-leaf '((t (:background "#cdb38b"))) > "Face for highlighting sparse tree leaves.") > > ;; <WL: changed for highlighting sparse tree leaves> > (defun org-highlight-new-match (beg end &optional highlight-face) > "Highlight from BEG to END and mark the highlight is an occur headline." > (let ((ov (org-make-overlay beg end))) > (if highlight-face > (org-overlay-put ov 'face highlight-face) > (org-overlay-put ov 'face 'secondary-selection)) > (push ov org-occur-highlights))) > > ;; <WL: for highlighting sparse tree leaves> > (defun org-has-match-in-subtree-p(regexp) > "Returns non-nil if there is a match for regexp in current subtree." > (save-match-data > (save-excursion > (let ((beg (point)) (end-of-tree (org-end-of-subtree t))) > (goto-char beg) > (re-search-forward regexp end-of-tree t))))) > 28240d28271 < ------------------------------------------- Carsten Dominik wrote: > > On Feb 18, 2008, at 4:19 PM, Wanrong Lin wrote: > >> >> Using "PROJECT" as a TODO keyword certainly can work, however, my >> work flow usually is first quickly mark anything that needs action >> with "TODO" and later I may add more sub-items to it. Following this >> approach I will need to remember to change "TODO" to "PROJECT" once a >> TODO item starts to have sub-items. Also, if all sub-actions of a >> "PROJECT" are marked as "DONE", I need to remember to turn the >> "PROJECT" back to "TODO", as I need the sparse tree to remind me to >> double check this TODO/PROJECT item to see whether it is really all >> done, or I need to add more sub-actions to it (and turn it back to >> "PROJECT" again). >> >> As you can see, that is a lot of manually actions and mistakes can be >> easily made. Maybe my workflow has some problem here, but I can not >> think of anything else that works better. The difficulty to me is, an >> item can be either PROJECT or TODO depending on how detailed your >> plan is, which keeps changing. >> >> I think if we can have the *option* of selecting a different face for >> highlighting sparse tree leaves, the above can be solved elegantly. >> You can still see the whole sparse tree, but the leaves will stand out. >> >> Just trying to push my case a little bit. :-) Thanks a lot. > > That is fine, but it does not work in this case... :-( > > - Carsten > >> >> >> Wanrong >> >> Carsten Dominik wrote: >>> Hi Wanrong, >>> >>> No, I think you need to find a different way around this. >>> For example by using a different keyword for the headings that >>> contain the true TODO items. I use PROJECT or something similar. >>> When you then search for TODO, the true tasks will be highlighted. >>> >>> - Carsten >>> >>> On Feb 15, 2008, at 12:36 AM, Wanrong Lin wrote: >>> >>>> Hi, >>>> >>>> Is it possible to highlighting only the sparse tree leaves, or even >>>> better, highlighting the whole sparse tree but with leaves in a >>>> special face? >>>> >>>> The motivation for such a feature is this: >>>> >>>> Suppose I have a task tree like this: >>>> >>>> * TODO Task A >>>> *** TODO Task A.1 >>>> ***** TODO Task A.1.1 >>>> * TODO Task B >>>> *** TODO Task B.1 >>>> ***** TODO Task B.1.1 >>>> ***** TODO Task B.1.2 >>>> >>>> If I do a "org-sparse-tree", all those lines are highlighted, >>>> giving an impression that I have a lot of open tasks, but in >>>> reality I only have three tasks: A.1.1, B.1.1 and B.1.2, as the >>>> higher level tasks are automatically done if those are done. So it >>>> would be nice to highlight those leaves in a special face. Also, >>>> suppose both B.1.1 and B.1.2 are done, then Task B.1 should be >>>> highlighted as a leaf. >>>> >>>> Hope the above makes some sense. Thank you very much for giving it >>>> a thought. >>>> >>>> Wanrong >>>> >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Emacs-orgmode mailing list >>>> Remember: use `Reply All' to send replies to the list. >>>> Emacs-orgmode@gnu.org <mailto:Emacs-orgmode@gnu.org> >>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> >> >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org <mailto:Emacs-orgmode@gnu.org> >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Highlighting Sparse Tree Leaves 2008-02-21 22:53 ` Wanrong Lin @ 2008-02-22 7:07 ` Carsten Dominik 0 siblings, 0 replies; 6+ messages in thread From: Carsten Dominik @ 2008-02-22 7:07 UTC (permalink / raw) To: Wanrong Lin; +Cc: emacs-orgmode Hi Wanrong, thanks for the code. It looks good, I will put it into my trickler to reconsider a some time in the future. - Carsten On Feb 21, 2008, at 11:53 PM, Wanrong Lin wrote: > > Hi, Carsten, > > I hacked a patch that does what I need. Just in case you change your > mind in the future, or anyone else has the same need as I, here is > the patch (against org.el in 5.22a. I did not get time to learn git > yet). Thanks. > > Wanrong > > -------------------------------- > > 15082c15082,15085 > < (org-highlight-new-match (match-beginning 0) (match-end 0))) > --- > > ;; <WL: changed to highlight sparse tree leaves> > > (if (and org-highlight-sparse-tree-leaf (not (org-has- > match-in-subtree-p regexp))) > > (org-highlight-new-match (match-beginning 0) (match- > end 0) 'org-sparse-tree-leaf) > > (org-highlight-new-match (match-beginning 0) (match-end > 0)))) > 15141,15145c15144,15149 > < (defun org-highlight-new-match (beg end) > < "Highlight from BEG to END and mark the highlight is an occur > headline." > < (let ((ov (org-make-overlay beg end))) > < (org-overlay-put ov 'face 'secondary-selection) > < (push ov org-occur-highlights))) > --- > > ;;;; <WL> replaced with my own version to support highlighting > sparse tree leaves > > ;; (defun org-highlight-new-match (beg end) > > ;; "Highlight from BEG to END and mark the highlight is an occur > headline." > > ;; (let ((ov (org-make-overlay beg end))) > > ;; (org-overlay-put ov 'face 'secondary-selection) > > ;; (push ov org-occur-highlights))) > 28233a28238,28265 > > ;;;;;; <WL> my own extension to org to show sparse tree leaves in > different face ;;;;; > > > > ;; highlighting sparse tree leaves > > > > ;; <WL> > > (defvar org-highlight-sparse-tree-leaf t > > "Whether to highlight sparse tree leaves") > > (defface org-sparse-tree-leaf '((t (:background "#cdb38b"))) > > "Face for highlighting sparse tree leaves.") > > > > ;; <WL: changed for highlighting sparse tree leaves> > > (defun org-highlight-new-match (beg end &optional highlight-face) > > "Highlight from BEG to END and mark the highlight is an occur > headline." > > (let ((ov (org-make-overlay beg end))) > > (if highlight-face > > (org-overlay-put ov 'face highlight-face) > > (org-overlay-put ov 'face 'secondary-selection)) > > (push ov org-occur-highlights))) > > > > ;; <WL: for highlighting sparse tree leaves> > > (defun org-has-match-in-subtree-p(regexp) > > "Returns non-nil if there is a match for regexp in current > subtree." > > (save-match-data > > (save-excursion > > (let ((beg (point)) (end-of-tree (org-end-of-subtree t))) > > (goto-char beg) > > (re-search-forward regexp end-of-tree t))))) > > > 28240d28271 > < > > ------------------------------------------- > > Carsten Dominik wrote: >> >> On Feb 18, 2008, at 4:19 PM, Wanrong Lin wrote: >> >>> >>> Using "PROJECT" as a TODO keyword certainly can work, however, my >>> work flow usually is first quickly mark anything that needs action >>> with "TODO" and later I may add more sub-items to it. Following >>> this approach I will need to remember to change "TODO" to >>> "PROJECT" once a TODO item starts to have sub-items. Also, if all >>> sub-actions of a "PROJECT" are marked as "DONE", I need to >>> remember to turn the "PROJECT" back to "TODO", as I need the >>> sparse tree to remind me to double check this TODO/PROJECT item to >>> see whether it is really all done, or I need to add more sub- >>> actions to it (and turn it back to "PROJECT" again). >>> >>> As you can see, that is a lot of manually actions and mistakes can >>> be easily made. Maybe my workflow has some problem here, but I can >>> not think of anything else that works better. The difficulty to me >>> is, an item can be either PROJECT or TODO depending on how >>> detailed your plan is, which keeps changing. >>> >>> I think if we can have the *option* of selecting a different face >>> for highlighting sparse tree leaves, the above can be solved >>> elegantly. You can still see the whole sparse tree, but the leaves >>> will stand out. >>> >>> Just trying to push my case a little bit. :-) Thanks a lot. >> >> That is fine, but it does not work in this case... :-( >> >> - Carsten >> >>> >>> >>> Wanrong >>> >>> Carsten Dominik wrote: >>>> Hi Wanrong, >>>> >>>> No, I think you need to find a different way around this. >>>> For example by using a different keyword for the headings that >>>> contain the true TODO items. I use PROJECT or something similar. >>>> When you then search for TODO, the true tasks will be highlighted. >>>> >>>> - Carsten >>>> >>>> On Feb 15, 2008, at 12:36 AM, Wanrong Lin wrote: >>>> >>>>> Hi, >>>>> >>>>> Is it possible to highlighting only the sparse tree leaves, or >>>>> even better, highlighting the whole sparse tree but with leaves >>>>> in a special face? >>>>> >>>>> The motivation for such a feature is this: >>>>> >>>>> Suppose I have a task tree like this: >>>>> >>>>> * TODO Task A >>>>> *** TODO Task A.1 >>>>> ***** TODO Task A.1.1 >>>>> * TODO Task B >>>>> *** TODO Task B.1 >>>>> ***** TODO Task B.1.1 >>>>> ***** TODO Task B.1.2 >>>>> >>>>> If I do a "org-sparse-tree", all those lines are highlighted, >>>>> giving an impression that I have a lot of open tasks, but in >>>>> reality I only have three tasks: A.1.1, B.1.1 and B.1.2, as the >>>>> higher level tasks are automatically done if those are done. So >>>>> it would be nice to highlight those leaves in a special face. >>>>> Also, suppose both B.1.1 and B.1.2 are done, then Task B.1 >>>>> should be highlighted as a leaf. >>>>> >>>>> Hope the above makes some sense. Thank you very much for giving >>>>> it a thought. >>>>> >>>>> Wanrong >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Emacs-orgmode mailing list >>>>> Remember: use `Reply All' to send replies to the list. >>>>> Emacs-orgmode@gnu.org <mailto:Emacs-orgmode@gnu.org> >>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>>> >>> >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org <mailto:Emacs-orgmode@gnu.org> >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-02-22 7:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-02-14 23:36 Highlighting Sparse Tree Leaves Wanrong Lin 2008-02-18 11:18 ` Carsten Dominik 2008-02-18 15:19 ` Wanrong Lin 2008-02-21 16:42 ` Carsten Dominik 2008-02-21 22:53 ` Wanrong Lin 2008-02-22 7:07 ` Carsten Dominik
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.