From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH 2/5] Immediately return if scope is region but no region is active Date: Mon, 29 Aug 2011 11:31:44 +0200 Message-ID: <18067986-33E5-4CCE-A9EC-266CB292D34F@gmail.com> References: <87obzpl3ec.fsf@gnu.org> <1314246334-5053-3-git-send-email-dmaus@ictsoc.de> <87wrdxab5k.wl%dmaus@ictsoc.de> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxyC4-0005oi-Cm for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 05:31:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxyC3-0004jr-I0 for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 05:31:48 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:48263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxyC3-0004jn-Cf for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 05:31:47 -0400 Received: by ewy9 with SMTP id 9so2595897ewy.0 for ; Mon, 29 Aug 2011 02:31:46 -0700 (PDT) In-Reply-To: <87wrdxab5k.wl%dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: emacs-orgmode@gnu.org On Aug 28, 2011, at 4:00 PM, David Maus wrote: > Hi Carsten, >=20 > At Thu, 25 Aug 2011 07:43:48 +0200, > Carsten Dominik wrote: >>=20 >>=20 >> On 25.8.2011, at 06:25, David Maus wrote: >>=20 >>> * 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(-) >>>=20 >>> 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))) >>=20 >> Would it be good to throw an error here? >>=20 >> (if (and (eq scope 'region) (not (org-region-active-p))) >> (error "No active region") >=20 > 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. >=20 > 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. >=20 > 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. Yes, I agree, I think you are right. Thanks! - Carsten=