summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-12-20 14:22:14 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-12-20 15:14:00 +0100
commitaf33cb709a82981ba64cbb68afb756e10e21a506 (patch)
treea32ef1ba2e986c25d36a234bcf2bb66f667b7e0b
parentde62618009355eef3658fa4318b3c0a8144c1ec7 (diff)
downloadorg-mode-af33cb709a82981ba64cbb68afb756e10e21a506.tar.gz
Fix bug with capture to datetree
* lisp/org-capture.el (org-capture-set-target-location): Use `current-time'.
-rw-r--r--doc/org.texi8
-rw-r--r--lisp/org-capture.el31
2 files changed, 24 insertions, 15 deletions
diff --git a/doc/org.texi b/doc/org.texi
index ea05e22..7c62faa 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -6228,6 +6228,14 @@ extremely useful for deriving tasks from emails, for example. You fill in
the task definition, press @code{C-c C-c} and Org returns you to the same
place where you started the capture process.
+To define special keys to capture to a particular template without going
+through the interactive template selection, you can create your key binding
+like this:
+
+@lisp
+(define-key global-map "\C-c c"
+ (lambda () (interactive) (org-capture "t")))
+@end lisp
@menu
* Template elements:: What is needed for a complete template entry
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index eef8b5a..035f606 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -636,7 +636,9 @@ already gone. Any prefix argument will be passed to the refile comand."
(let ((hd (nth 2 target)))
(goto-char (point-min))
(unless (org-mode-p)
- (error "Target buffer for file+headline should be in Org mode"))
+ (error
+ "Target buffer \"%s\" for file+headline should be in Org mode"
+ (current-buffer)))
(if (re-search-forward
(format org-complex-heading-regexp-format (regexp-quote hd))
nil t)
@@ -679,7 +681,7 @@ already gone. Any prefix argument will be passed to the refile comand."
;; prompt for date
(time-to-days (org-read-date
nil t nil "Date for tree entry:"
- (days-to-time (org-today)))))
+ (current-time))))
(t
;; current date, possible corrected for late night workers
(org-today))))))
@@ -1096,19 +1098,18 @@ Use PREFIX as a prefix for the name of the indirect buffer."
(defun org-capture-select-template (&optional keys)
"Select a capture template.
Lisp programs can force the template by setting KEYS to a string."
- (if org-capture-templates
- (if keys
- (or (assoc keys org-capture-templates)
- (error "No capture template referred to by \"%s\" keys" keys))
- (if (= 1 (length org-capture-templates))
- (car org-capture-templates)
- (org-mks org-capture-templates
- "Select a capture template\n========================="
- "Template key: "
- '(("C" "Customize org-capture-templates")
- ("q" "Abort")))))
- ;; Use an arbitrary default template
- '("t" "Task" entry (file+headline "" "Tasks") "* TODO %?\n %u\n %a")))
+ (let ((org-capture-templates
+ (or org-capture-templates
+ '(("t" "Task" entry (file+headline "" "Tasks")
+ "* TODO %?\n %u\n %a")))))
+ (if keys
+ (or (assoc keys org-capture-templates)
+ (error "No capture template referred to by \"%s\" keys" keys))
+ (org-mks org-capture-templates
+ "Select a capture template\n========================="
+ "Template key: "
+ '(("C" "Customize org-capture-templates")
+ ("q" "Abort"))))))
(defun org-capture-fill-template (&optional template initial annotation)
"Fill a template and return the filled template as a string.