[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Fix org-meta-return for checkbox lists

From: Kaushal Modi
Subject: [O] Fix org-meta-return for checkbox lists
Date: Thu, 14 Jun 2018 11:30:37 -0400


Currently if you do M-RET in a checkbox list item, the next item does not become a checkbox automatically. This patch fixes that.

I have been using this fix locally for few months. But never got to submitting it as I need to yet write a test for it.

Does that patch look good (apart from missing tests). Should I format it w.r.t to next? or master?



From 8572f66a514289e2193f162f8c3c24818af00912 Mon Sep 17 00:00:00 2001
From: Kaushal Modi <address@hidden>
Date: Wed, 21 Mar 2018 11:41:51 -0400
Subject: [PATCH] Make `org-meta-return' do the right thing for checkbox lists

 lisp/org-list.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index 0d20c9df7..6839105df 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2247,10 +2247,14 @@ item is invisible."
     (let* ((struct (save-excursion (goto-char itemp)
            (prevs (org-list-prevs-alist struct))
+           (list-type (org-list-get-list-type itemp struct prevs))
            ;; If we're in a description list, ask for the new term.
-           (desc (when (eq (org-list-get-list-type itemp struct prevs)
-                   'descriptive)
-               " :: ")))
+           (desc (when (eq list-type 'descriptive)
+               " :: "))
+           ;; Check if the current list item has a checkbox.
+           (checkbox (or checkbox
+                 (and (eq list-type 'unordered)
+                  (org-list-get-checkbox itemp struct)))))
       (setq struct (org-list-insert-item pos struct prevs checkbox desc))
       (org-list-write-struct struct (org-list-parents-alist struct))
       (when checkbox (org-update-checkbox-count-maybe))


Kaushal Modi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]