From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: [PATCH 1/5] Extend scope 'region to include body of last headline in active region Date: Tue, 30 Aug 2011 06:33:09 +0200 Message-ID: <87k49vr01m.wl%dmaus@ictsoc.de> References: <87obzpl3ec.fsf@gnu.org> <1314246334-5053-2-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_Tue_Aug_30_06:33:09_2011-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyG3l-0003iS-6Y for emacs-orgmode@gnu.org; Tue, 30 Aug 2011 00:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QyG3j-0002TF-L1 for emacs-orgmode@gnu.org; Tue, 30 Aug 2011 00:36:25 -0400 Received: from app1b.xlhost.de ([213.202.242.162]:47545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyG3j-0002RY-8M for emacs-orgmode@gnu.org; Tue, 30 Aug 2011 00:36:23 -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_Tue_Aug_30_06:33:09_2011-1 Content-Type: multipart/mixed; boundary="Multipart_Tue_Aug_30_06:33:09_2011-1" --Multipart_Tue_Aug_30_06:33:09_2011-1 Content-Type: text/plain; charset=US-ASCII Hi Carsten, At Thu, 25 Aug 2011 07:40:52 +0200, Carsten Dominik wrote: > > > 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(-) > > > > 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. Thanks, yes. This makes sense. Attached patch supersedes the previous. Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --Multipart_Tue_Aug_30_06:33:09_2011-1 Content-Type: text/plain; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="0001-Extend-scope-region-to-include-entire-body-of-last-h.patch" Content-Transfer-Encoding: base64 RnJvbSA5NTdkY2JlNmFlNDBmYTMzMmU0ODQ1NWEyNjA3ODJiYTNlNjFlNjhkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEYXZpZCBNYXVzIDxkbWF1c0BpY3Rzb2MuZGU+CkRhdGU6IFR1 ZSwgMzAgQXVnIDIwMTEgMDY6MjI6MTIgKzAyMDAKU3ViamVjdDogW1BBVENIIDEvNF0gRXh0ZW5k IHNjb3BlICdyZWdpb24gdG8gaW5jbHVkZSBlbnRpcmUgYm9keSBvZiBsYXN0IGhlYWRsaW5lIGlu IGFjdGl2ZSByZWdpb24KCiogb3JnLmVsIChvcmctbWFwLWVudHJpZXMpOiBFeHRlbmQgc2NvcGUg J3JlZ2lvbiB0byBpbmNsdWRlCmVudGlyZSBib2R5IG9mIGxhc3QgaGVhZGxpbmUgaW4gYWN0aXZl IHJlZ2lvbi4KLS0tCiBsaXNwL29yZy5lbCB8ICAgIDcgKysrKysrLQogMSBmaWxlcyBjaGFuZ2Vk LCA2IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC9vcmcu ZWwgYi9saXNwL29yZy5lbAppbmRleCBkNjNiODU0Li5iNzcwZmE2IDEwMDY0NAotLS0gYS9saXNw L29yZy5lbAorKysgYi9saXNwL29yZy5lbApAQCAtMTM2MjksNyArMTM2MjksMTIgQEAgYSAqZGlm ZmVyZW50KiBlbnRyeSwgeW91IGNhbm5vdCB1c2UgdGhlc2UgdGVjaG5pcXVlcy4iCiAJICAgICAg IChvcmctbmFycm93LXRvLXN1YnRyZWUpCiAJICAgICAgIChzZXRxIHNjb3BlIG5pbCkpCiAJICAg ICAgKChhbmQgKGVxIHNjb3BlICdyZWdpb24pIChvcmctcmVnaW9uLWFjdGl2ZS1wKSkKLQkgICAg ICAgKG5hcnJvdy10by1yZWdpb24gKHJlZ2lvbi1iZWdpbm5pbmcpIChyZWdpb24tZW5kKSkKKwkg ICAgICAgKG5hcnJvdy10by1yZWdpb24gKHJlZ2lvbi1iZWdpbm5pbmcpCisJCQkJIChzYXZlLWV4 Y3Vyc2lvbgorCQkJCSAgIChnb3RvLWNoYXIgKHJlZ2lvbi1lbmQpKQorCQkJCSAgICh1bmxlc3Mg KGFuZCAoYm9scCkgKG9yZy1hdC1oZWFkaW5nLXApKQorCQkJCSAgICAgKG91dGxpbmUtbmV4dC1o ZWFkaW5nKSkKKwkJCQkgICAocG9pbnQpKSkKIAkgICAgICAgKHNldHEgc2NvcGUgbmlsKSkpCiAK IAkoaWYgKG5vdCBzY29wZSkKLS0gCjEuNy4yLjUKCg== --Multipart_Tue_Aug_30_06:33:09_2011-1-- --pgp-sign-Multipart_Tue_Aug_30_06:33:09_2011-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAk5caAUACgkQma24O1pEeObYhgD9GqK06ElMKDwDD6NKC0Kd+g90 JUcDbkCXjPBXvUMaKYUA/1KwcpISOAzDNVQ6Gu3kO0CJHUPz/jdDuuTzqfVOPLOC =+P2K -----END PGP SIGNATURE----- --pgp-sign-Multipart_Tue_Aug_30_06:33:09_2011-1--