From: Ohad Kammar <ohad.kammar@cl.cam.ac.uk>
To: emacs-orgmode@gnu.org
Cc: Simon Castellan <simon.castellan@iso.mor.phis.me>
Subject: [PATCH][BUG] org-capture-templates checkitem not working as expected
Date: Wed, 17 Sep 2014 10:06:06 +0100 [thread overview]
Message-ID: <CAGkJaNUVmq7h+J7JEd-vqD3BGJsBjwfH9tE6vN3ri4bNRq_Nxw@mail.gmail.com> (raw)
Dear Org users,
There's a bug with the checkitem type org-capture-templates.
To reproduce:
1) Choose an org file with the headline "Test list", e.g., execute:
$ cat > ~/org-capture-bugreport.org
* Test list [/]
^C
2) Add the following two templates to your org-capture-templates:
("b" "Demonstrate a bug in capture templates" checkitem (file
"~/org-capture-bugreport.org" "Test list")
"there should be '[ ]' at the beginning of this item,
but there isn't." :immediate-finish t)
("v" "Demonstrate a bug in capture templates" checkitem (file
"~/org-capture-bugreport.org" "Test list")
"[ ] This is how it should behave" :immediate-finish t)
3) org-capture b and org-capture v
I expected the 'b' option to add a checkbox item under "Test list",
but instead it only adds an item. The 'v' option behaves as I expect
from 'b', but I had to add the checkbox manually.
Below is a patch fixing this issue. (This is my first patch to Org, I'm
happy to fix any mistakes.
Yours,
Ohad.
From 8a09dd1e6aea78551d2958beebf88156ce54e774 Mon Sep 17 00:00:00 2001
From: Ohad Kammar <ohad.kammar@cl.cam.ac.uk>
Date: Wed, 17 Sep 2014 09:43:45 +0100
Subject: [PATCH] org-capture.el: Implemented checkitem capture type
org-capture.el (org-capture-place-item): Add check-box if appropriate.
Pre-patch, the checkitem and item types behave exactly the same,
rather than inserting a checkbox.
Fix by Simon Castellan and Ohad Kammar.
TINYCHANGE
---
lisp/org-capture.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9e33d25..365d7c5 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1094,7 +1094,7 @@ may have been stored before."
(setq txt (org-remove-indentation txt))
;; Make sure this is indeed an item
(unless (string-match (concat "\\`" (org-item-re)) txt)
- (setq txt (concat "- "
+ (setq txt (concat "- " (if (eq (org-capture-get :type)
'checkitem) "[ ] " "")
(mapconcat 'identity (split-string txt "\n")
"\n "))))
;; Set the correct indentation, depending on context
--
1.7.9.5
reply other threads:[~2014-09-17 9:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAGkJaNUVmq7h+J7JEd-vqD3BGJsBjwfH9tE6vN3ri4bNRq_Nxw@mail.gmail.com \
--to=ohad.kammar@cl.cam.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=simon.castellan@iso.mor.phis.me \
/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).