From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: New feature: loop over siblings for some commands Date: Wed, 20 Jul 2011 21:46:59 +0200 Message-ID: <87pql4g2fg.wl%dmaus@ictsoc.de> References: <87aacchtv8.fsf@gnu.org> <87zkkayvld.wl%dmaus@ictsoc.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Jul_20_21:46:59_2011-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjcjf-00056b-Bw for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 15:47:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qjcjb-0004ls-3x for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 15:47:10 -0400 Received: from app1b.xlhost.de ([213.202.242.162]:53429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjcja-0004lj-Ml for emacs-orgmode@gnu.org; Wed, 20 Jul 2011 15:47:06 -0400 In-Reply-To: <87zkkayvld.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: Bastien , emacs-orgmode@gnu.org --pgp-sign-Multipart_Wed_Jul_20_21:46:59_2011-1 Content-Type: text/plain; charset=US-ASCII After a first look at the macro and its usage I have the feeling that the macro would be wrong and/or a bad design choice. It conditionally implements a mapping of body to a headline's siblings. Thus it is a specialized case of applying a function to zero or more headlines based on a selection criteria: In other words it is a special case of org-map-entries. So first there is duplicate code. Second the usage of the macro in for instance `org-schedule'. The macro is wrapped around the entire function body (except the interactive expression) and its only use is avoidance of creating a separate function with the scheduling implementation. I highly recommend to not use this macro but to build the intended functionality with separate building blocks: Factor out the flesh of the respective functions (e.g. org-schedule) and use org-map-entries to map. As far as I can see, the latter provides all we need: (org-map-entries FUNC &optional MATCH SCOPE &rest SKIP) We have FUNC (schedule) and MATCH (siblings). Region is the SCOPE (we have to extend map-entries here). We might even extend the syntax of MATCH to accept symbols indicating concepts like "sibling" and the like. Ideally: #+begin_src emacs-lisp (if (or (not (org-region-active-p)) (not org-loop-over-siblings-within-active-region-p)) ;; -p? its not a predicate function! (org-really-do-the-schedule) (org-map-entries 'org-really-do-the-schedule 'siblings 'region)) #+end_src Another abstraction: Instead 'org-loop-over-siblings-with-active-region' something like: 'org-loop-over-headlines-with-active-region' that can be set to a symbol or a list of symbols indicating which headings to loop over (e.g. 'siblings, 'children, ...). Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Wed_Jul_20_21:46:59_2011-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAk4nMLMACgkQma24O1pEeOaRMgEA4iS0uazFC7xL0YUHlgJjWvMq iP7HgwBYm9+xZE5g/4sBAK9ynUyNOuXA8Eup5DLE/Sr90eab0QDwfhKzSaS0fUgA =rvPa -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Jul_20_21:46:59_2011-1--