From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonas =?utf-8?Q?H=C3=B6rsch?= Subject: Re: [PATCH] hide inline-tasks in 'children visibility state Date: Mon, 04 Nov 2013 09:52:53 +0100 Message-ID: <87txfsczve.fsf@kafka.loc> References: <87r4b23h1l.fsf@kafka.loc> <87li19agx5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdFuE-0001IE-OT for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 03:53:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdFu8-0005Gm-Um for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 03:53:06 -0500 Received: from mail-ee0-x233.google.com ([2a00:1450:4013:c00::233]:40046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdFu8-0005Gd-Ir for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 03:53:00 -0500 Received: by mail-ee0-f51.google.com with SMTP id t10so937233eei.10 for ; Mon, 04 Nov 2013 00:52:59 -0800 (PST) In-Reply-To: <87li19agx5.fsf@gmail.com> 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, On Thu, Oct 31 2013, Nicolas Goaziou wrote: > coroa@online.de (Jonas H=C3=B6rsch) writes: >> >> + (cond ((eq state 'contents) > > I suggest to use `case' here, but it's really a matter of style. fine with me. i wasn't sure about the usage convention for cl. i switched to the namespaced cl-case variant, for now. >> + (hide-sublevels (1- org-inlinetask-min-level)))) >> + (while (and (outline-next-heading) >> + (org-inlinetask-at-task-p)) > > I think it is more efficient to directly look for inlinetasks since you > can use `org-inlinetask-outline-regexp'. hmm ... i'm not so sure. as you can see in the attached patch, now i have to perform an extra search on each headline to find the boundary for the inline task search. it feels to me like this would be faster for a situation with more than one inline task per headline in the mean? (which i don't think is the likely situation). well, what do you think? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-inlinetask-Hide-inline-tasks-in-children-visibil.patch Content-Transfer-Encoding: quoted-printable From=20763f4d8c8daa0c09809a677c8cd8358476336f24 Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Wed, 30 Oct 2013 15:39:33 +0100 Subject: [PATCH] org-inlinetask: Hide inline tasks in 'children visibility state * lisp/org.el (org-cycle-hide-inline-tasks): Re-hide inline tasks when switching to 'children visibility state. TINYCHANGE =2D-- lisp/org.el | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 4f3bf4b..c94e2ee 100644 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -7074,11 +7074,23 @@ open and agenda-wise Org files." (org-flag-drawer t)))))) =20 (defun org-cycle-hide-inline-tasks (state) =2D "Re-hide inline task when switching to 'contents visibility state." =2D (when (and (eq state 'contents) =2D (boundp 'org-inlinetask-min-level) =2D org-inlinetask-min-level) =2D (hide-sublevels (1- org-inlinetask-min-level)))) + "Re-hide inline tasks when switching to 'contents or 'children +visibility state." + (cl-case state + (contents + (when (org-bound-and-true-p org-inlinetask-min-level) + (hide-sublevels (1- org-inlinetask-min-level)))) + (children + (when (featurep 'org-inlinetask) + (let ((end (save-excursion + (if (re-search-forward + (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t) + (match-beginning 1) + (point-max))))) + (save-excursion + (while (re-search-forward (org-inlinetask-outline-regexp) end t) + (org-inlinetask-toggle-visibility) + (org-inlinetask-goto-end)))))))) =20 (defun org-flag-drawer (flag) "When FLAG is non-nil, hide the drawer we are within. =2D-=20 1.8.4 --=-=-= Content-Type: text/plain p.s.: for some weird reason, i was convinced i submitted this mail a few days ago ... but my mail program says otherwise. --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJSd2BoAAoJECrXDlJwTJyR5KUQAMeJlKFiWf8R5AwEBY8nsm9k MdRfws5MPrp9crWL/1cCfHXNjav7WiN06bFqPvjYt4N4QWjFo+NbwI/aIlvN6aqa 1kgb4YRQXvT60uWGaVi59tRYjzJP5QHn3JvgL+LD9MmPdNpmkASelHKVuBWolo8T pFlIP95P2tJp8ztHnVLclYcUSkehY5iNkMrKt/l0yaKJsGEhHRgW0EMAd4PWDel7 xehiuvsfN3WmtBxmPlWVbtnNUgvgfjCCH78Jn7QSZEgwCL8TuCPgZfaGYUExuNMF BtW+SM7JvhIaqiD+j7Vn7dyoZm3LZw3ctUByYpm+3wU7jn1isPpb+vE/1WDod8fn Yy/VkrTeZhqnJCM7HuN8aSCFzLo+nXe58IKe1gjJ2UmFnVtza1ug5YuHl4rxXOG1 1Y5yxzPRUgGcwRUJLHHem5g8zXGGwQg31daQcWOBS/sjW1UbqSViV6lzXQuQtDUr ZGgvvslOqNs709advFzfsBx7O6v9EeD+/HgPAaWZBuLG4AjWQBT4+fXg2ntJjHHT BAC6f0E7DEgiJe5UJaG+tI8usBU8gbN6G7GGekBBBL4CV7pX/G9ZuHPIA0d074H6 XHmEiTOEasjIchVdGcA5IZ20vwVEnmQvLV9V6I16x7KWkfPEgDQ8CVKz0sgCoyjZ m/+3sXH1gq/ryhJnUaSC =guCU -----END PGP SIGNATURE----- --==-=-=--