From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH 1/5] Extend scope 'region to include body of last headline in active region Date: Thu, 25 Aug 2011 07:40:52 +0200 Message-ID: References: <87obzpl3ec.fsf@gnu.org> <1314246334-5053-2-git-send-email-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]:37333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwTtE-0006dk-Q0 for emacs-orgmode@gnu.org; Thu, 25 Aug 2011 02:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwTtD-0006EQ-MQ for emacs-orgmode@gnu.org; Thu, 25 Aug 2011 02:58:12 -0400 Received: from mail-ey0-f171.google.com ([209.85.215.171]:57558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwTtD-0006EK-FK for emacs-orgmode@gnu.org; Thu, 25 Aug 2011 02:58:11 -0400 Received: by eyg24 with SMTP id 24so1871127eyg.30 for ; Wed, 24 Aug 2011 23:58:10 -0700 (PDT) In-Reply-To: <1314246334-5053-2-git-send-email-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 25.8.2011, at 06:25, David Maus wrote: > * org.el (org-map-entries): Extend scope 'region to include entire > body of last headline in active region. > --- > lisp/org.el | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/lisp/org.el b/lisp/org.el > index de8c72b..b69b77c 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -13633,8 +13633,12 @@ a *different* entry, you cannot use these = techniques." > (org-narrow-to-subtree) > (setq scope nil)) > ((and (eq scope 'region) (org-region-active-p)) > - (narrow-to-region (region-beginning) (region-end)) > - (setq scope nil))) > + (let ((end (save-excursion > + (goto-char (region-end)) > + (outline-next-heading) > + (point)))) > + (narrow-to-region (region-beginning) end) > + (setq scope nil)))) Hi David, I think the better algorithm here would be this: If region-end is at the beginning of a line and that line is a headline, use region-end as it is. If not, jump to the next headline. Cheers - Carsten >=20 > (if (not scope) > (progn > --=20 > 1.7.2.5 >=20 >=20