[ Adding Org mailing list back to CC to keep the conversation public ]

Vitaliy Chepelev <vita...@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>

Reply via email to