* [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)] @ 2024-07-10 1:27 vitalij 2024-07-10 13:43 ` Ihor Radchenko 0 siblings, 1 reply; 4+ messages in thread From: vitalij @ 2024-07-10 1:27 UTC (permalink / raw) To: emacs-orgmode Hello. I use fill-paragraph function with (setq fill-prefix " ") variable. If I have list: 1) text text text texttext texttext texvttext texttext texttext texttext texttext texttext texttext texttext text 2) text text text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text After org-shiftright I have: - text text text texttext texttext texvttext texttext texttext texttext texttext texttext texttext texttext text - text text text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text This breakes list strcuture. I don't want to use (setq fill-prefix " ") with two spaces. I created this patch that don't change indentation of list by shifting. diff --git a/org-list.el b/org-list.el index 502e61b..2867149 100644 --- a/org-list.el +++ b/org-list.el @@ -1813,6 +1813,12 @@ 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-shift-body-ind nil + "Indent text of column when bullet was changed." + :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. @@ -1956,7 +1962,8 @@ Initial position of cursor is restored after the changes." ;; end to beginning. Take a special action when beginning is ;; at item bullet. (dolist (e sliced-struct) - (unless (zerop (nth 2 e)) (apply shift-body-ind e)) + (if org-list-shift-body-ind + (unless (zerop (nth 2 e)) (apply shift-body-ind e))) (let* ((beg (nth 1 e)) (cell (assq beg struct))) (unless (or (not cell) (equal cell (assq beg old-struct))) Emacs : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, X toolkit) of 2024-06-23 Package: Org mode version 9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/) -- Best regards, Python Middle Data Scientist. I am looking for a job for 1.5 years. ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)] 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> 0 siblings, 1 reply; 4+ messages in thread From: Ihor Radchenko @ 2024-07-10 13:43 UTC (permalink / raw) To: vitalij; +Cc: emacs-orgmode vitalij@gmx.com writes: > Hello. I use fill-paragraph function with (setq fill-prefix " ") variable. > If I have list: > 1) text text text texttext texttext texvttext texttext texttext > texttext texttext texttext texttext texttext text > 2) text text text texttext texttext texttext texttext texttext > texttext texttext texttext texttext texttext text > > After org-shiftright I have: > > - text text text texttext texttext texvttext texttext texttext > texttext texttext texttext texttext texttext text > - text text text texttext texttext texttext texttext texttext > texttext texttext texttext texttext texttext text > > This breakes list strcuture. I don't want to use (setq fill-prefix " ") > with two spaces. Thanks for reporting! Fixed, on main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f7ef4071b Although I am wondering how fill-prefix has anything to do with your report. -- 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> ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <871q40lvhm.fsf@gmx.com>]
* Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)] [not found] ` <871q40lvhm.fsf@gmx.com> @ 2024-07-11 13:40 ` Ihor Radchenko [not found] ` <87bk333ojl.fsf@gmx.com> 0 siblings, 1 reply; 4+ messages in thread From: Ihor Radchenko @ 2024-07-11 13:40 UTC (permalink / raw) To: Vitaliy Chepelev; +Cc: emacs-orgmode [ 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> ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <87bk333ojl.fsf@gmx.com>]
* Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)] [not found] ` <87bk333ojl.fsf@gmx.com> @ 2024-07-11 16:08 ` Ihor Radchenko 0 siblings, 0 replies; 4+ messages in thread From: Ihor Radchenko @ 2024-07-11 16:08 UTC (permalink / raw) To: Vitaliy Chepelev; +Cc: emacs-orgmode Vitaliy Chepelev <vitalij@gmx.com> writes: > Hi, In the first version I disabled indentation completely, > but this breaks sub-list items, as I found out later. In > the second version I disabled calculation of bullet lengths > ( 1. 1) = 2 (- +) = 1, all = 1 now, this works for text > formatted with fill-paragraph like this one that you read > now. I assume that bullet lenght calculated only for case > when user set custom bullets like: (First., Second., > Third.). FYI, I have already fixed the bug you reported. So, your patch should not be necessary, unless you think that my fix is not sufficient. See https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f7ef4071b -- 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> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-11 16:07 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 [not found] ` <87bk333ojl.fsf@gmx.com> 2024-07-11 16:08 ` Ihor Radchenko
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).