Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Michael Dauer
The main advantage is that all org-mode actions on subtrees would work
without any specific handling of inline tasks. e.g. visibility cycling,
hiding of none context, cut/copy, moving. With many of these actions I
experience some issues with inline tasks. And even from my personal user
perception I would like to have just the task headings on the same level,
not also the END marks.

Bastien  schrieb am Sa., 15. Mai 2021, 11:02:

> Hi Michael,
>
> Michael Dauer  writes:
>
> > Wouldn't it be the much better approach to change inline tasks so
> > that the END line is one level below the "begin" line?
>
> I'm not sure how this would be better, and I would rather find this
> more confusing.  What is the expected benefit?
>
> --
>  Bastien
>


Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Bastien
Ihor Radchenko  writes:

> Bastien  writes:
>> Can you make a patch for this?
>
> It was easier than I anticipated. See the attached.

Indeed!  Thanks, applied.

-- 
 Bastien



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Ihor Radchenko
Bastien  writes:
> Can you make a patch for this?

It was easier than I anticipated. See the attached.

>From f681dcb12df823cafe388973bb93c83ce2e0f6bb Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sat, 15 May 2021 20:57:00 +0800
Subject: [PATCH] Allow moving inlinetasks using org-metaup/down

* lisp/org.el (org-metaup, org-metadown): Use
`org-drag-elementbackward'/`org-drag-element-forward' to move
inlinetasks.
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ccf438f70..d031e6916 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16213,7 +16213,7 @@ (defun org-metaup ( _arg)
((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up))
((and (featurep 'org-inlinetask)
  (org-inlinetask-in-task-p))
-(user-error "Dragging inline tasks is not supported"))
+(org-drag-element-backward))
((org-at-heading-p) (call-interactively 'org-move-subtree-up))
((org-at-item-p) (call-interactively 'org-move-item-up))
(t (org-drag-element-backward
@@ -16246,7 +16246,7 @@ (defun org-metadown ( _arg)
((org-at-table-p) (call-interactively 'org-table-move-row))
((and (featurep 'org-inlinetask)
  (org-inlinetask-in-task-p))
-(user-error "Dragging inline tasks is not supported"))
+(org-drag-element-forward))
((org-at-heading-p) (call-interactively 'org-move-subtree-down))
((org-at-item-p) (call-interactively 'org-move-item-down))
(t (org-drag-element-forward
-- 
2.26.3



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Bastien
Ihor Radchenko  writes:

> Bastien  writes:
>> Carsten proposed a patch that I adapted a little bit and pushed to the
>> maint branch.  We now throw an error saying that dragging inline tasks
>> is not supported.  
>
> Isn't it easy to implement using org-element-swap-A-B?

Well, probably, I didn't try this.

> Something like
>
> (defun org-element-swap-at-point ( down)
>   (when-let* ((el-cur (org-element-at-point))
> (el-other (org-with-point-at
>   (if down
>   (org-element-property :end el-cur)
> (1- (org-element-property :begin el-cur)))
> (org-element-at-point
> (unless (equal el-cur el-other)
>   (org-element-swap-A-B el-cur el-other

Can you make a patch for this?

-- 
 Bastien



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Ihor Radchenko
Bastien  writes:
> Carsten proposed a patch that I adapted a little bit and pushed to the
> maint branch.  We now throw an error saying that dragging inline tasks
> is not supported.  

Isn't it easy to implement using org-element-swap-A-B?
Something like

(defun org-element-swap-at-point ( down)
  (when-let* ((el-cur (org-element-at-point))
  (el-other (org-with-point-at
(if down
(org-element-property :end el-cur)
  (1- (org-element-property :begin el-cur)))
  (org-element-at-point
(unless (equal el-cur el-other)
  (org-element-swap-A-B el-cur el-other

Best,
Ihor



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-15 Thread Bastien
Hi Michael,

Michael Dauer  writes:

> Wouldn't it be the much better approach to changeĀ inlineĀ tasks so
> that the END line is one level below the "begin" line?

I'm not sure how this would be better, and I would rather find this
more confusing.  What is the expected benefit?

-- 
 Bastien



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-14 Thread Michael Dauer
Hi,

Wouldn't it be the much better approach to change inline tasks so that the
END line is one level below the "begin" line?

I did not think it through. But IMO it would make IT more compatible with
normal org behavior, and also more visually appealing.

With the END notation it would still be unambiguous.

I'm aware that this change would have an impact on existing documents. But
worth a simple migration command the improvement would be worth the little
pain.

Regards,
m


Am Do., 13. Mai 2021 um 15:08 Uhr schrieb Bastien :

> Hi Christian,
>
> Bastien  writes:
>
> > Christian Hemminghaus  writes:
> >
> >> I ran into an error message while composing structured text with
> >> org-mode using org-inline-tasks. The error appears when moving around
> >> inline tasks in my document.
> >
> > yes, I confirm this bug.
>
> Carsten proposed a patch that I adapted a little bit and pushed to the
> maint branch.  We now throw an error saying that dragging inline tasks
> is not supported.
>
> Thanks,
>
> --
>  Bastien
>
>
> --
> Confidentiality Notice:This email and any attachments it may contain are
> intended for the individual or entity above and may be confidential and
> protected by legal privilege. SmartPM Technologies, Inc. makes no
> warranties, express or implied, concerning the accuracy of the information
> contained herein, which is subject to change without notice. Unintended
> recipients should be aware that use of this e-mail or any of its
> attachments in any way is forbidden.
>


Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2021-05-13 Thread Bastien
Hi Christian,

Bastien  writes:

> Christian Hemminghaus  writes:
>
>> I ran into an error message while composing structured text with
>> org-mode using org-inline-tasks. The error appears when moving around
>> inline tasks in my document.
>
> yes, I confirm this bug.

Carsten proposed a patch that I adapted a little bit and pushed to the
maint branch.  We now throw an error saying that dragging inline tasks
is not supported.  

Thanks,

-- 
 Bastien



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2020-09-07 Thread Christian Hemminghaus
Hi Bastien,

> I guess this is due to `org-element-at-point' considering inline tasks
> as headlines, thus trying to move only one line.
>
> Nicolas, would you know how to solve this (if it does not get us into
> hard syntactic decisions)?

This would probably be the clean solution. As a (temporary)
workaround, I hooked org-metaup/-down and ask for org-inlintask at
point explicitly.

```
(defun ch/org-metaup-inlinetask ()
"If at inline task and not active region, drag inline task backward."
(if (and (not (org-region-active-p)) (org-inlinetask-at-task-p))
(org-drag-element-backward)
  nil))

  (defun ch/org-metadown-inlinetask ()
"If at inline task and not active region, drag inline task forward."
(if (and (not (org-region-active-p)) (org-inlinetask-at-task-p))
(org-drag-element-forward)
  nil))

  (add-hook 'org-metaup-hook 'ch/org-metaup-inlinetask t)
  (add-hook 'org-metadown-hook 'ch/org-metadown-inlinetask t)
```

Regards,
Christian



Re: Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2020-09-05 Thread Bastien
Hi Christian,

Christian Hemminghaus  writes:

> I ran into an error message while composing structured text with
> org-mode using org-inline-tasks. The error appears when moving around
> inline tasks in my document.

yes, I confirm this bug.

The wrong behavior is here, whether you loaded org-inlinetask or not,
but the error ("Invalid...") is only triggered when org-inlinetask is
loaded.

I guess this is due to `org-element-at-point' considering inline tasks
as headlines, thus trying to move only one line.

Nicolas, would you know how to solve this (if it does not get us into
hard syntactic decisions)?

-- 
 Bastien



Bug: Moving org-inline-tasks produces error message [9.3.6 (9.3.6-elpa @ /home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)]

2020-07-18 Thread Christian Hemminghaus
Hello everyone,

I ran into an error message while composing structured text with
org-mode using org-inline-tasks. The error appears when moving around
inline tasks in my document.

Here is the example:

# # BEGIN EXAMPLE

This is a paragraph in my document.
It may contain multiple lines.

*** TODO Inline Task
*** END

This is another paragraph.
May be multiline aswell.

And a third paragraph.
May be multiline aswell.

# # END EXAMPLE

Putting the cursor on "Inline Task" and hitting org-metadown should (at
least in my opinion) swap the inline task with the second paragraph and
hence produce the following:

# # BEGIN EXAMPLE

This is a paragraph in my document.
It may contain multiple lines.

This is another paragraph.
May be multiline aswell.

*** TODO Inline Task
*** END

And a third paragraph.
May be multiline aswell.

# # END EXAMPLE

But instead it produces:

# # BEGIN EXAMPLE

This is a paragraph in my document.
It may contain multiple lines.

*** END

This is another paragraph.
May be multiline aswell.

And a third paragraph.
May be multiline aswell.

*** TODO Inline Task

# # END EXAMPLE

Together with an error message:

org-show-children: Invalid regexp: "Invalid content of \\{\\}"

As swapping paragraphs with inline tasks works the other way around, I
think that this is a bug. Since I am not much familiar with elisp, I
would appreciate a hint how to fix this bug.

Best regards,
Christian

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-09-16
Package: Org mode version 9.3.6 (9.3.6-elpa @
/home/c.hemminghaus/.emacs.d/elpa/org-9.3.6/)