* 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-15 9:07 Christian Hemminghaus
2020-09-05 10:42 ` Bastien
0 siblings, 1 reply; 11+ messages in thread
From: Christian Hemminghaus @ 2020-07-15 9:07 UTC (permalink / raw)
To: emacs-orgmode
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/)
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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-07-15 9:07 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/)] Christian Hemminghaus
@ 2020-09-05 10:42 ` Bastien
2020-09-07 6:45 ` Christian Hemminghaus
2021-05-13 13:06 ` Bastien
0 siblings, 2 replies; 11+ messages in thread
From: Bastien @ 2020-09-05 10:42 UTC (permalink / raw)
To: Christian Hemminghaus; +Cc: emacs-orgmode, mail
Hi Christian,
Christian Hemminghaus <chrhemmi@gmail.com> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 10:42 ` Bastien
@ 2020-09-07 6:45 ` Christian Hemminghaus
2021-05-13 13:06 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Christian Hemminghaus @ 2020-09-07 6:45 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, mail
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 10:42 ` Bastien
2020-09-07 6:45 ` Christian Hemminghaus
@ 2021-05-13 13:06 ` Bastien
2021-05-14 18:08 ` Michael Dauer
2021-05-15 11:06 ` Ihor Radchenko
1 sibling, 2 replies; 11+ messages in thread
From: Bastien @ 2021-05-13 13:06 UTC (permalink / raw)
To: Christian Hemminghaus; +Cc: emacs-orgmode, mail
Hi Christian,
Bastien <bzg@gnu.org> writes:
> Christian Hemminghaus <chrhemmi@gmail.com> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 13:06 ` Bastien
@ 2021-05-14 18:08 ` Michael Dauer
2021-05-15 9:02 ` Bastien
2021-05-15 11:06 ` Ihor Radchenko
1 sibling, 1 reply; 11+ messages in thread
From: Michael Dauer @ 2021-05-14 18:08 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, mail, Christian Hemminghaus
[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]
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 <bzg@gnu.org>:
> Hi Christian,
>
> Bastien <bzg@gnu.org> writes:
>
> > Christian Hemminghaus <chrhemmi@gmail.com> 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.
>
[-- Attachment #2: Type: text/html, Size: 2559 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 18:08 ` Michael Dauer
@ 2021-05-15 9:02 ` Bastien
2021-05-15 16:20 ` Michael Dauer
0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2021-05-15 9:02 UTC (permalink / raw)
To: Michael Dauer; +Cc: emacs-orgmode, Christian Hemminghaus, mail
Hi Michael,
Michael Dauer <mick.dauer@gmail.com> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 9:02 ` Bastien
@ 2021-05-15 16:20 ` Michael Dauer
0 siblings, 0 replies; 11+ messages in thread
From: Michael Dauer @ 2021-05-15 16:20 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Christian Hemminghaus, mail
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
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 <bzg@gnu.org> schrieb am Sa., 15. Mai 2021, 11:02:
> Hi Michael,
>
> Michael Dauer <mick.dauer@gmail.com> 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
>
[-- Attachment #2: Type: text/html, Size: 1184 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 13:06 ` Bastien
2021-05-14 18:08 ` Michael Dauer
@ 2021-05-15 11:06 ` Ihor Radchenko
2021-05-15 12:35 ` Bastien
1 sibling, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2021-05-15 11:06 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, mail, Christian Hemminghaus
Bastien <bzg@gnu.org> 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 (&optional 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 11:06 ` Ihor Radchenko
@ 2021-05-15 12:35 ` Bastien
2021-05-15 13:00 ` Ihor Radchenko
0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2021-05-15 12:35 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode, Christian Hemminghaus, mail
Ihor Radchenko <yantar92@gmail.com> writes:
> Bastien <bzg@gnu.org> 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 (&optional 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* 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 12:35 ` Bastien
@ 2021-05-15 13:00 ` Ihor Radchenko
2021-05-15 13:06 ` Bastien
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2021-05-15 13:00 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Christian Hemminghaus, mail
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
Bastien <bzg@gnu.org> writes:
> Can you make a patch for this?
It was easier than I anticipated. See the attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-moving-inlinetasks-using-org-metaup-down.patch --]
[-- Type: text/x-diff, Size: 1546 bytes --]
From f681dcb12df823cafe388973bb93c83ce2e0f6bb Mon Sep 17 00:00:00 2001
Message-Id: <f681dcb12df823cafe388973bb93c83ce2e0f6bb.1621083502.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
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 (&optional _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 (&optional _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
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-05-15 16:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-15 9:07 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/)] Christian Hemminghaus
2020-09-05 10:42 ` Bastien
2020-09-07 6:45 ` Christian Hemminghaus
2021-05-13 13:06 ` Bastien
2021-05-14 18:08 ` Michael Dauer
2021-05-15 9:02 ` Bastien
2021-05-15 16:20 ` Michael Dauer
2021-05-15 11:06 ` Ihor Radchenko
2021-05-15 12:35 ` Bastien
2021-05-15 13:00 ` Ihor Radchenko
2021-05-15 13:06 ` Bastien
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).