From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: [PATCH 2/5] Immediately return if scope is region but no region is active Date: Sun, 28 Aug 2011 16:00:39 +0200 Message-ID: <87wrdxab5k.wl%dmaus@ictsoc.de> References: <87obzpl3ec.fsf@gnu.org> <1314246334-5053-3-git-send-email-dmaus@ictsoc.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Sun_Aug_28_16:00:39_2011-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxg1G-00079O-Rw for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 10:07:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qxg1E-0001CQ-Q5 for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 10:07:26 -0400 Received: from app1b.xlhost.de ([213.202.242.162]:46281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxg1E-0001CH-B3 for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 10:07:24 -0400 In-Reply-To: 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: Carsten Dominik Cc: David Maus , emacs-orgmode@gnu.org --pgp-sign-Multipart_Sun_Aug_28_16:00:39_2011-1 Content-Type: text/plain; charset=US-ASCII 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.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Sun_Aug_28_16:00:39_2011-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAk5aSgcACgkQma24O1pEeOahDwEArLNgYVryk+gSIn9mcsF23RuN Jx2qPa6dBPlpwGWqsoEA/3dcKqnx4mlbWRLuhSo0jg0ZlJ5IS+pFDc26r+/xnI+9 =7b7w -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sun_Aug_28_16:00:39_2011-1--