* Bug: Indenting empty description list item leaves point at beginning of line [9.4.4]
@ 2021-09-24 21:32 Bodertz
2021-09-27 8:24 ` Bastien
2021-10-02 10:47 ` [PATCH] " Ihor Radchenko
0 siblings, 2 replies; 5+ messages in thread
From: Bodertz @ 2021-09-24 21:32 UTC (permalink / raw)
To: emacs-orgmode
See this example plain list, where point is represented by <point>:
- list item
- Indent the empty list item below by pressing M-<right>
- <point>
After pressing M-<right> as asked, the list will look like this:
- list item
- Indent the empty list item below by pressing M-<right>
- <point>
As you can see, point is after the dash.
Next see this example description list:
- list item :: with description
- Indent the empty list item below by pressing M-<right> :: description
- <point> ::
After pressing M-<right> as asked, the list will look like this:
- list item :: with description
- Indent the empty list item below by pressing M-<right> :: description
<point> - ::
As you can see, point is at the beginning of the line. I think it
should be after the dash, as is the case when indenting plain list
items.
Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
Package: Org mode version 9.4.4 (release_9.4.4 @ /gnu/store/qbd7y4jm3lp1sgzyl6b8cqcf8hb3w1wz-emacs-pgtk-native-comp-28.0.50-203.92bc69e/share/emacs/28.0.50/lisp/org/)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Indenting empty description list item leaves point at beginning of line [9.4.4]
2021-09-24 21:32 Bug: Indenting empty description list item leaves point at beginning of line [9.4.4] Bodertz
@ 2021-09-27 8:24 ` Bastien
2021-10-02 10:47 ` [PATCH] " Ihor Radchenko
1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2021-09-27 8:24 UTC (permalink / raw)
To: Bodertz; +Cc: emacs-orgmode
Hi,
Bodertz <bodertz@gmail.com> writes:
> After pressing M-<right> as asked, the list will look like this:
>
>
> - list item :: with description
> - Indent the empty list item below by pressing M-<right> :: description
> <point> - ::
>
>
> As you can see, point is at the beginning of the line. I think it
> should be after the dash, as is the case when indenting plain list
> items.
Confirmed, I'm adding this to updates.orgmode.org.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Bug: Indenting empty description list item leaves point at beginning of line [9.4.4]
2021-09-24 21:32 Bug: Indenting empty description list item leaves point at beginning of line [9.4.4] Bodertz
2021-09-27 8:24 ` Bastien
@ 2021-10-02 10:47 ` Ihor Radchenko
2021-10-25 13:34 ` Ihor Radchenko
1 sibling, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2021-10-02 10:47 UTC (permalink / raw)
To: Bodertz; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
Bodertz <bodertz@gmail.com> writes:
> As you can see, point is at the beginning of the line. I think it
> should be after the dash, as is the case when indenting plain list
> items.
The fix is attached.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-list-Do-not-move-point-when-promoting-demoting-i.patch --]
[-- Type: text/x-diff, Size: 2107 bytes --]
From 63870bec28e59732cbbdf8b2534f6ece96e2d5d8 Mon Sep 17 00:00:00 2001
Message-Id: <63870bec28e59732cbbdf8b2534f6ece96e2d5d8.1633171544.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 2 Oct 2021 18:32:34 +0800
Subject: [PATCH] org-list: Do not move point when promoting/demoting items
* lisp/org-list.el (org-list-struct-apply-struct): Make sure the
origin marker is not moved to bol when promoting/demoting item in
special case:
- item
- <point> ::
* testing/lisp/test-org-list.el (test-org-list/indent-item): Add test
Fixes https://orgmode.org/list/87o88hlkvv.fsf@gmail.com
---
lisp/org-list.el | 5 ++++-
testing/lisp/test-org-list.el | 10 +++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 2bd9dc4d9..b6ab14f84 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -1866,7 +1866,10 @@ (defun org-list-struct-apply-struct (struct old-struct)
(looking-at org-list-full-item-re)
;; a. Replace bullet
(unless (equal old-bul new-bul)
- (replace-match new-bul nil nil nil 1))
+ (save-excursion
+ (replace-match "" nil nil nil 1)
+ (goto-char (match-end 1))
+ (insert-before-markers new-bul)))
;; b. Replace checkbox.
(cond
((equal (match-string 3) new-box))
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index 3689a172f..e3d904b1e 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -298,7 +298,15 @@ (ert-deftest test-org-list/indent-item ()
(push-mark (point) t t)
(goto-char (point-max))
(let (org-list-demote-modify-bullet) (org-indent-item))
- (buffer-string)))))
+ (buffer-string))))
+ ;; When point is right after empty item, do not move point.
+ (should
+ (= 13
+ (org-test-with-temp-text "
+- item
+- <point> ::"
+ (org-indent-item)
+ (point)))))
(ert-deftest test-org-list/indent-item-tree ()
"Test `org-indent-item-tree' specifications."
--
2.32.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug: Indenting empty description list item leaves point at beginning of line [9.4.4]
2021-10-02 10:47 ` [PATCH] " Ihor Radchenko
@ 2021-10-25 13:34 ` Ihor Radchenko
2021-10-25 21:39 ` Bodertz
0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2021-10-25 13:34 UTC (permalink / raw)
To: Bodertz; +Cc: emacs-orgmode
Ihor Radchenko <yantar92@gmail.com> writes:
> Bodertz <bodertz@gmail.com> writes:
>
>> As you can see, point is at the beginning of the line. I think it
>> should be after the dash, as is the case when indenting plain list
>> items.
>
> The fix is attached.
Are you still seeing the issue with the proposed patch?
Best,
Ihor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug: Indenting empty description list item leaves point at beginning of line [9.4.4]
2021-10-25 13:34 ` Ihor Radchenko
@ 2021-10-25 21:39 ` Bodertz
0 siblings, 0 replies; 5+ messages in thread
From: Bodertz @ 2021-10-25 21:39 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Apologies, I wasn't aware you were asking for feedback.
The issue I described no longer occurs.
However, there is still a minor issue with the proposed fix.
After creating a new empty description list item by pressing {M-RET}
after a description list item, the item created is the following:
--8<---------------cut here---------------start------------->8---
- | ::
--8<---------------cut here---------------end--------------->8---
That is, "dash space <cursor> space colon colon".
After indenting, it becomes:
--8<---------------cut here---------------start------------->8---
- |::
--8<---------------cut here---------------end--------------->8---
That is, "dash space <cursor> colon colon". The space before the colon
is no longer present.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-25 21:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 21:32 Bug: Indenting empty description list item leaves point at beginning of line [9.4.4] Bodertz
2021-09-27 8:24 ` Bastien
2021-10-02 10:47 ` [PATCH] " Ihor Radchenko
2021-10-25 13:34 ` Ihor Radchenko
2021-10-25 21:39 ` Bodertz
Code repositories for project(s) associated with this 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).