* [PATCH][BUG] org-capture-templates checkitem not working as expected
@ 2014-09-17 9:06 Ohad Kammar
0 siblings, 0 replies; only message in thread
From: Ohad Kammar @ 2014-09-17 9:06 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Simon Castellan
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-17 9:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 9:06 [PATCH][BUG] org-capture-templates checkitem not working as expected Ohad Kammar
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.