From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Fix org-meta-return for checkbox lists Date: Thu, 14 Jun 2018 11:30:37 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a80b0e056e9bc864" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTUD6-0001fU-H1 for emacs-orgmode@gnu.org; Thu, 14 Jun 2018 11:30:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTUD5-0006Qr-BR for emacs-orgmode@gnu.org; Thu, 14 Jun 2018 11:30:52 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:35592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTUD4-0006PE-U6 for emacs-orgmode@gnu.org; Thu, 14 Jun 2018 11:30:51 -0400 Received: by mail-lf0-x231.google.com with SMTP id i15-v6so10099020lfc.2 for ; Thu, 14 Jun 2018 08:30:50 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org list --000000000000a80b0e056e9bc864 Content-Type: text/plain; charset="UTF-8" Hello, 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? Thanks. ===== >From 8572f66a514289e2193f162f8c3c24818af00912 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Wed, 21 Mar 2018 11:41:51 -0400 Subject: [PATCH] Make `org-meta-return' do the right thing for checkbox lists too --- 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) (org-list-struct))) (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)) -- 2.17.0.rc0 -- Kaushal Modi --000000000000a80b0e056e9bc864 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

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

I have been usin= g 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 maste= r?

Thanks.


=
=3D=3D=3D=3D=3D

From 8572f66a514289e2193f= 162f8c3c24818af00912 Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Da= te: Wed, 21 Mar 2018 11:41:51 -0400
Subject: [PATCH] Make `org-meta-retu= rn' do the right thing for checkbox lists
=C2=A0too

---
= =C2=A0lisp/org-list.el | 10 +++++++---
=C2=A01 file changed, 7 insertion= s(+), 3 deletions(-)

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


--

Kaushal Modi

--000000000000a80b0e056e9bc864--