* [PATCH] hide inline-tasks in 'children visibility state
@ 2013-10-30 15:38 Jonas Hörsch
2013-10-31 10:11 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Jonas Hörsch @ 2013-10-30 15:38 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 236 bytes --]
hej,
one more patch, which takes care of re-hiding inline-tasks
properly. finally it is possible to work with longer inline tasks
without them getting always in the way.
just bump me, if anything is not to your liking
cheers,
jonas
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-org-inlinetask-hide-inline-tasks-in-children-visibil.patch --]
[-- Type: text/x-patch, Size: 1561 bytes --]
From 447d528263728ea56f390ae8dfdfa99880d6ccb4 Mon Sep 17 00:00:00 2001
From: Jonas Hoersch <coroa@online.de>
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
---
lisp/org.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 4f3bf4b..b93f3f4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7074,11 +7074,19 @@ open and agenda-wise Org files."
(org-flag-drawer t))))))
(defun org-cycle-hide-inline-tasks (state)
- "Re-hide inline task when switching to 'contents visibility state."
- (when (and (eq state 'contents)
- (boundp 'org-inlinetask-min-level)
- org-inlinetask-min-level)
- (hide-sublevels (1- org-inlinetask-min-level))))
+ "Re-hide inline tasks when switching to 'contents or 'children
+visibility state."
+ (cond ((eq state 'contents)
+ (when (and (boundp 'org-inlinetask-min-level)
+ org-inlinetask-min-level)
+ (hide-sublevels (1- org-inlinetask-min-level))))
+ ((eq state 'children)
+ (when (featurep 'org-inlinetask)
+ (save-excursion
+ (while (and (outline-next-heading)
+ (org-inlinetask-at-task-p))
+ (org-inlinetask-toggle-visibility)
+ (org-inlinetask-goto-end)))))))
(defun org-flag-drawer (flag)
"When FLAG is non-nil, hide the drawer we are within.
--
1.8.4
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hide inline-tasks in 'children visibility state
2013-10-30 15:38 [PATCH] hide inline-tasks in 'children visibility state Jonas Hörsch
@ 2013-10-31 10:11 ` Nicolas Goaziou
2013-11-04 8:52 ` Jonas Hörsch
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-10-31 10:11 UTC (permalink / raw)
To: Jonas Hörsch; +Cc: emacs-orgmode
Hello,
coroa@online.de (Jonas Hörsch) writes:
> one more patch, which takes care of re-hiding inline-tasks
> properly. finally it is possible to work with longer inline tasks
> without them getting always in the way.
Thank you for the patch. Here are a few comments.
> Subject: [PATCH] org-inlinetask: hide inline tasks in 'children visibility
> state
Nitpick: you need a capital letter after colons.
>
> * lisp/org.el (org-cycle-hide-inline-tasks): re-hide inline tasks when
> switching to 'children visibility state.
Ditto.
> + "Re-hide inline tasks when switching to 'contents or 'children
> +visibility state."
> + (cond ((eq state 'contents)
I suggest to use `case' here, but it's really a matter of style.
> + (when (and (boundp 'org-inlinetask-min-level)
> + org-inlinetask-min-level)
(and (boundp 'var) var) => (org-bound-and-true-p var)
> + (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'.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hide inline-tasks in 'children visibility state
2013-10-31 10:11 ` Nicolas Goaziou
@ 2013-11-04 8:52 ` Jonas Hörsch
2013-11-05 21:29 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Jonas Hörsch @ 2013-11-04 8:52 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 961 bytes --]
Hi,
On Thu, Oct 31 2013, Nicolas Goaziou wrote:
> coroa@online.de (Jonas Hörsch) 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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-org-inlinetask-Hide-inline-tasks-in-children-visibil.patch --]
[-- Type: text/x-patch, Size: 1708 bytes --]
From 763f4d8c8daa0c09809a677c8cd8358476336f24 Mon Sep 17 00:00:00 2001
From: Jonas Hoersch <coroa@online.de>
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
---
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
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7074,11 +7074,23 @@ open and agenda-wise Org files."
(org-flag-drawer t))))))
(defun org-cycle-hide-inline-tasks (state)
- "Re-hide inline task when switching to 'contents visibility state."
- (when (and (eq state 'contents)
- (boundp 'org-inlinetask-min-level)
- org-inlinetask-min-level)
- (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))))))))
(defun org-flag-drawer (flag)
"When FLAG is non-nil, hide the drawer we are within.
--
1.8.4
[-- Attachment #1.3: Type: text/plain, Size: 123 bytes --]
p.s.: for some weird reason, i was convinced i submitted this mail a
few days ago ... but my mail program says otherwise.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hide inline-tasks in 'children visibility state
2013-11-04 8:52 ` Jonas Hörsch
@ 2013-11-05 21:29 ` Nicolas Goaziou
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2013-11-05 21:29 UTC (permalink / raw)
To: Jonas Hörsch; +Cc: emacs-orgmode
Hello,
Jonas Hörsch <coroa@online.de> writes:
> On Thu, Oct 31 2013, Nicolas Goaziou wrote:
>
>> 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.
It's better to use `case' as long as we support Emacs 23.
>> 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?
You're right. Your first implementation is better in that regard. Could
you update that part so I can eventually apply it?
Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-05 21:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 15:38 [PATCH] hide inline-tasks in 'children visibility state Jonas Hörsch
2013-10-31 10:11 ` Nicolas Goaziou
2013-11-04 8:52 ` Jonas Hörsch
2013-11-05 21:29 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).