emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH 2/5] Immediately return if scope is region but no region


From: David Maus
Subject: Re: [O] [PATCH 2/5] Immediately return if scope is region but no region is active
Date: Sun, 28 Aug 2011 16:00:39 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hi Carsten,

At Thu, 25 Aug 2011 07:43:48 +0200,
Carsten Dominik wrote:
>
>
> On 25.8.2011, at 06:25, David Maus wrote:
>
> > * org.el (org-map-entries): Immediately return if scope is region but
> > no region is active.
> > ---
> > lisp/org.el |  116 
> > ++++++++++++++++++++++++++++++-----------------------------
> > 1 files changed, 59 insertions(+), 57 deletions(-)
> >
> > diff --git a/lisp/org.el b/lisp/org.el
> > index b69b77c..27bad52 100644
> > --- a/lisp/org.el
> > +++ b/lisp/org.el
> > @@ -13608,65 +13608,67 @@ with `org-get-tags-at'.  If your function gets 
> > properties with
> > to t around the call to `org-entry-properties' to get the same speedup.
> > Note that if your function moves around to retrieve tags and properties at
> > a *different* entry, you cannot use these techniques."
> > -  (let* ((org-agenda-archives-mode nil) ; just to make sure
> > -    (org-agenda-skip-archived-trees (memq 'archive skip))
> > -    (org-agenda-skip-comment-trees (memq 'comment skip))
> > -    (org-agenda-skip-function
> > -     (car (org-delete-all '(comment archive) skip)))
> > -    (org-tags-match-list-sublevels t)
> > -    matcher file res
> > -    org-todo-keywords-for-agenda
> > -    org-done-keywords-for-agenda
> > -    org-todo-keyword-alist-for-agenda
> > -    org-drawers-for-agenda
> > -    org-tag-alist-for-agenda)
> > +  (unless (and (eq scope 'region)
> > +          (not (org-region-active-p)))
>
> Would it be good to throw an error here?
>
> (if (and (eq scope 'region) (not (org-region-active-p)))
>     (error "No active region")

Not necessarily. I look at map-entries as a function that applies FUNC
to a subset of all headlines. SCOPE, MATCH, and SKIP are selectors
that narrow down the set of headlines.  First SCOPE is applied to the
set containing all headlines, than MATCH is applied to the set of
headlines selected by SCOPE, finally FUNC is applied to all headlines
in the final subset if not SKIP.

If you look at `org-map-entries' this way then calling it with SCOPE
'region but no active region is not an error. How many headlines are
in the active region if there is no active region? Exactly zero. Its
the same with a SCOPE 'file but no headline in current file.

Applying SCOPE to the set of all headings produces the empty set
and `org-map-entries' can simply leave because MATCH and SKIP wouldn't
match anything.

Best,
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpl4FcgEv41h.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]