emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* agenda restriction locks and searching all nodes quickly
@ 2010-11-05 23:47 Samuel Wales
  2010-11-06 21:36 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Wales @ 2010-11-05 23:47 UTC (permalink / raw)
  To: emacs-orgmode

Having trouble with setting a restriction lock and also with searching quickly.

Can somebody kindly respond to the questions in the comments below?


(defun alpha-org-agenda-parent-subtree ()
  "Show agenda for all tasks in subtree above point.  This means
all /siblings/ of point and everything beneath them.

If the region is active, operate only on the region.

You can get a fast sorted view with this command.  In this
example, the agenda will show tasks under my subtree.

  * top level 1 -- not shown
    * my subtree -- shown
      * TODO a
      * some other headline | (<- point is here)
        * TODO [#A] b
  * top level 2 -- not shown

If you sort by priority, b will sort above a.

This allows you to organize nodes hierarchically instead of
keeping things at the same level merely to allow sorting.
"
  (interactive)
  (save-excursion
    ;;unwind-protect
    (if (not (org-up-heading-safe))
        (message "top level is nyi")
      ;;is this the right way to do it?  i tried
      ;;(let (org-agenda-overriding-restriction ...
      ;;
      ;;how do i make this work for the active region?
      (org-agenda-set-restriction-lock 'subtree)
      ;;is there a less kludgey way to specify all tasks in the restriction?
      ;;more importantly, what is the absolutely /fastest/ way?
      ;;
      ;;this seems to take forever even for a single node
      (org-search-view nil "{.}"))))

Thanks.

Samuel

-- 
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly serious
disease for 25 years]
==========
HIV-like virus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MLV paper.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: agenda restriction locks and searching all nodes quickly
  2010-11-05 23:47 agenda restriction locks and searching all nodes quickly Samuel Wales
@ 2010-11-06 21:36 ` Carsten Dominik
  2010-11-10  0:05   ` Samuel Wales
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2010-11-06 21:36 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Hi SAmuel,

On Nov 6, 2010, at 12:47 AM, Samuel Wales wrote:

> Having trouble with setting a restriction lock and also with  
> searching quickly.
>
> Can somebody kindly respond to the questions in the comments below?
>
>
> (defun alpha-org-agenda-parent-subtree ()
>  "Show agenda for all tasks in subtree above point.  This means
> all /siblings/ of point and everything beneath them.
>
> If the region is active, operate only on the region.
>
> You can get a fast sorted view with this command.  In this
> example, the agenda will show tasks under my subtree.
>
>  * top level 1 -- not shown
>    * my subtree -- shown
>      * TODO a
>      * some other headline | (<- point is here)
>        * TODO [#A] b
>  * top level 2 -- not shown
>
> If you sort by priority, b will sort above a.
>
> This allows you to organize nodes hierarchically instead of
> keeping things at the same level merely to allow sorting.
> "
>  (interactive)
>  (save-excursion
>    ;;unwind-protect
>    (if (not (org-up-heading-safe))
>        (message "top level is nyi")
>      ;;is this the right way to do it?  i tried
>      ;;(let (org-agenda-overriding-restriction ...
>      ;;
>      ;;how do i make this work for the active region?
>      (org-agenda-set-restriction-lock 'subtree)
>      ;;is there a less kludgey way to specify all tasks in the  
> restriction?
>      ;;more importantly, what is the absolutely /fastest/ way?

I guess you could remember start and end of the region
and the implement a skipping function the checks if the
match is in the range.  If you are in a large file, this
would still be somewhat wasteful.

The fastest way for a region would be (untested)

(setq org-agenda-restrict t)
(setq org-agenda-overriding-restriction 'region)
(put 'org-agenda-files 'org-restrict
      (list (buffer-file-name (buffer-base-buffer))))
(move-marker org-agenda-restrict-begin (region-beginning))
(move-marker org-agenda-restrict-end (region-end))



>      ;;
>      ;;this seems to take forever even for a single node
>      (org-search-view nil "{.}"))))

Try a tags/property match with "LEVEL>0", that
should be more efficient.



>
> Thanks.
>
> Samuel
>
> -- 
> Q: How many CDC "scientists" does it take to change a lightbulb?
> A: "You only think it's dark." [CDC has denied a deadly serious
> disease for 25 years]
> ==========
> HIV-like virus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE  
> DONATE
> ===
> I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard  
> MLV paper.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 3+ messages in thread

* Re: agenda restriction locks and searching all nodes quickly
  2010-11-06 21:36 ` Carsten Dominik
@ 2010-11-10  0:05   ` Samuel Wales
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Wales @ 2010-11-10  0:05 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Thanks, Carsten.  Your LEVEL>0 suggestion worked.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-10  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05 23:47 agenda restriction locks and searching all nodes quickly Samuel Wales
2010-11-06 21:36 ` Carsten Dominik
2010-11-10  0:05   ` Samuel Wales

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).