* Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)]
@ 2020-07-31 22:17 No Wayman
2020-07-31 22:50 ` No Wayman
0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2020-07-31 22:17 UTC (permalink / raw)
To: emacs-orgmode; +Cc: No Wayman
If `org-toggle-item' is called between the text of an entry and
the next heading,
it removes the tags from the next heading.
ECM:
With the following Org markup in a buffer and point denoted by
"|":
#+begin_example
,* First
Some text
|
,** Second :tag:
#+end_example
invoking `org-toggle-item' removes the second heading's tags,
resulting in:
#+begin_example
,* First
Some text
|
,** Second
#+end_example
`org-toggle-item's documentation claims:
> Convert headings or normal lines to items, items to normal
> lines.
> If there is no active region, only the current line is
> considered.
Though this doesn't seem to be the case here. There is no active
region, so I would expect it to do nothing in this case.
I stepped through `org-toggle-item' and I believe it's because of
the following logic:
>;; Determine boundaries of changes.
>(if (org-region-active-p)
>(setq beg (funcall skip-blanks (region-beginning))
>end (copy-marker (region-end)))
>(setq beg (funcall skip-blanks (point-at-bol))
>end (copy-marker (point-at-eol))))
Blank lines are being skipped regardless of whether region is
active or not.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)]
2020-07-31 22:17 Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)] No Wayman
@ 2020-07-31 22:50 ` No Wayman
2020-08-02 4:40 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2020-07-31 22:50 UTC (permalink / raw)
To: emacs-orgmode; +Cc: No Wayman
[-- Attachment #1: Type: text/plain, Size: 208 bytes --]
I've attached a patch which removes the call to skip-blanks if
there is no active region.
This works for me with the ECM I've provided.
Not sure if it will have any adverse repercussions outside of
that.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-toggle-item-operate-on-single-line --]
[-- Type: text/x-patch, Size: 972 bytes --]
From ada4f2a55b7a701aac02d4fc167be4b46e72f2c9 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Fri, 31 Jul 2020 18:38:11 -0400
Subject: [PATCH] org-list: Operate on single line if no active region
* lisp/org-list.el (org-toggle-item): Operate on single line if no
active region.
---
lisp/org-list.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-list.el b/lisp/org-list.el
index fb061b054..c43630d05 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -3032,7 +3032,7 @@ With a prefix argument ARG, change the region in a single item."
(if (org-region-active-p)
(setq beg (funcall skip-blanks (region-beginning))
end (copy-marker (region-end)))
- (setq beg (funcall skip-blanks (point-at-bol))
+ (setq beg (point-at-bol)
end (copy-marker (point-at-eol))))
;; Depending on the starting line, choose an action on the text
;; between BEG and END.
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)]
2020-07-31 22:50 ` No Wayman
@ 2020-08-02 4:40 ` Kyle Meyer
2020-08-02 17:13 ` No Wayman
0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2020-08-02 4:40 UTC (permalink / raw)
To: No Wayman; +Cc: emacs-orgmode
No Wayman writes:
> I've attached a patch which removes the call to skip-blanks if
> there is no active region.
> This works for me with the ECM I've provided.
> Not sure if it will have any adverse repercussions outside of
> that.
Taking a quick look, I don't spot anything. And the org-list tests
still pass with the change. Would you mind updating the patch to add a
test case along the lines of your ECM to test-org-list/toggle-item?
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)]
2020-08-02 4:40 ` Kyle Meyer
@ 2020-08-02 17:13 ` No Wayman
2020-08-03 3:04 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2020-08-02 17:13 UTC (permalink / raw)
To: Kyle Meyer; +Cc: emacs-orgmode, No Wayman
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Kyle Meyer <kyle@kyleam.com> writes:
> Would you mind updating the patch to add a
> test case along the lines of your ECM to
> test-org-list/toggle-item?
>
> Thanks.
Added the test in the attached patch.
Thanks, Kyle.
~ Nicholas Vollmer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-toggle-item-no-region-single-line --]
[-- Type: text/x-patch, Size: 1728 bytes --]
From 838a6a548396eecfa958161abb66f0a1719a9aef Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Fri, 31 Jul 2020 18:38:11 -0400
Subject: [PATCH] org-list: Operate on single line if no active region
* lisp/org-list.el (org-toggle-item): Operate on single line if no
active region.
---
lisp/org-list.el | 2 +-
testing/lisp/test-org-list.el | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/org-list.el b/lisp/org-list.el
index fb061b054..c43630d05 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -3032,7 +3032,7 @@ With a prefix argument ARG, change the region in a single item."
(if (org-region-active-p)
(setq beg (funcall skip-blanks (region-beginning))
end (copy-marker (region-end)))
- (setq beg (funcall skip-blanks (point-at-bol))
+ (setq beg (point-at-bol)
end (copy-marker (point-at-eol))))
;; Depending on the starting line, choose an action on the text
;; between BEG and END.
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index abd1a3c83..24a55464d 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -1109,6 +1109,13 @@ b. Item 2<point>"
(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n\n\nText"
(org-toggle-item nil)
(buffer-string))))
+ ;; When no region is marked and point is on a blank line
+ ;; only operate on current line
+ (should
+ (equal " \n* H :tag:"
+ (org-test-with-temp-text "<point> \n* H :tag:"
+ (org-toggle-item nil)
+ (buffer-string))))
;; When a region is marked and first line is a headline, all
;; headlines are turned into items.
(should
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-03 3:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-31 22:17 Bug: org-toggle-item removes tags from next heading [9.3.7 (release_9.3.7-696-g82b496 @ mixed installation! /home/n/.emacs.d/straight/build/org/ and /home/n/.emacs.d/straight/build/org/eln-x86_64-pc-linux-gnu-c50afd7f9e91fd04/)] No Wayman
2020-07-31 22:50 ` No Wayman
2020-08-02 4:40 ` Kyle Meyer
2020-08-02 17:13 ` No Wayman
2020-08-03 3:04 ` Kyle Meyer
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).