emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Fix org-meta-return for checkbox lists
Date: Thu, 14 Jun 2018 11:30:37 -0400	[thread overview]
Message-ID: <CAFyQvY3BiA31kAjqaBbQtQUMiTLpMDjqt+_VtvXRbjuSUreBQQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]

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 <kaushal.modi@gmail.com>
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

[-- Attachment #2: Type: text/html, Size: 2484 bytes --]

             reply	other threads:[~2018-06-14 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 15:30 Kaushal Modi [this message]
2018-06-14 18:41 ` Fix org-meta-return for checkbox lists Nicolas Goaziou
2018-06-15 13:53   ` Bernt Hansen
2018-06-15 14:01     ` Kaushal Modi
2018-06-15 14:10       ` Nicolas Goaziou
2018-06-15 14:19         ` Kaushal Modi

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=CAFyQvY3BiA31kAjqaBbQtQUMiTLpMDjqt+_VtvXRbjuSUreBQQ@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).