From: Ihor Radchenko <yantar92@posteo.net>
To: Vitaliy Chepelev <vitalij@gmx.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)]
Date: Thu, 11 Jul 2024 13:40:39 +0000 [thread overview]
Message-ID: <87o77459ns.fsf@localhost> (raw)
In-Reply-To: <871q40lvhm.fsf@gmx.com>
[ Adding Org mailing list back to CC to keep the conversation public ]
Vitaliy Chepelev <vitalij@gmx.com> writes:
> I made much better patch for my org-9.6.28/org-list.el, now indentation
> is working and list don't breaks:
May you please explain in more details what is better in the proposed
patch compared to the already installed fix?
> diff --git a/org-list.el b/org-list.el
> index 502e61b..27617c5 100644
> --- a/org-list.el
> +++ b/org-list.el
> @@ -1813,6 +1813,14 @@ This function modifies STRUCT."
> (setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2)))))
> (org-list-struct-assoc-end struct end-list)))
>
> +(defcustom org-list-static-bullet-length t
> + "Assume that bullet length always equal one character.
> +Oterwise indent list items according to calculated length of
> +bullet."
> + :group 'org-plain-lists
> + :group 'org-cycle
> + :type 'boolean)
> +
> (defun org-list-struct-apply-struct (struct old-struct)
> "Apply set difference between STRUCT and OLD-STRUCT to the buffer.
>
> @@ -1900,8 +1908,12 @@ Initial position of cursor is restored after the changes."
> (ind-old (org-list-get-ind pos old-struct))
> (bul-pos (org-list-get-bullet pos struct))
> (bul-old (org-list-get-bullet pos old-struct))
> - (ind-shift (- (+ ind-pos (length bul-pos))
> - (+ ind-old (length bul-old))))
> + (ind-shift (if org-list-static-bullet-length
> + (- (+ ind-pos 1)
> + (+ ind-old 1))
> + ;; else
> + (- (+ ind-pos (length bul-pos))
> + (+ ind-old (length bul-old)))))
> (end-pos (org-list-get-item-end pos old-struct)))
> (push (cons pos ind-shift) itm-shift)
> (unless (assq end-pos old-struct)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2024-07-11 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 1:27 [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)] vitalij
2024-07-10 13:43 ` Ihor Radchenko
[not found] ` <871q40lvhm.fsf@gmx.com>
2024-07-11 13:40 ` Ihor Radchenko [this message]
[not found] ` <87bk333ojl.fsf@gmx.com>
2024-07-11 16:08 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o77459ns.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=vitalij@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).