Browse Source

Fix minor bugs in org-capture.el, and keep byte-compiler happy

Carsten Dominik 15 years ago
parent
commit
19602fa56e
2 changed files with 15 additions and 4 deletions
  1. 9 3
      lisp/org-capture.el
  2. 6 1
      lisp/org-mks.el

+ 9 - 3
lisp/org-capture.el

@@ -53,6 +53,11 @@
 (require 'org)
 (require 'org-mks)
 
+(declare-function org-datetree-find-date-create "org-datetree"
+		  (DATE &optional KEEP-RESTRICTION))
+(defvar org-remember-default-headline)
+(defvar org-remember-templates)
+
 (defvar org-capture-clock-was-started nil
   "Internal flag, noting if the clock was started.")
 
@@ -451,8 +456,7 @@ already gone."
   (let ((pos (point)) (base (buffer-base-buffer (current-buffer))))
     (org-capture-finalize)
     (save-window-excursion
-      (save-excursion
-	(set-buffer (or base (current-buffer)))
+      (with-current-buffer (or base (current-buffer))
 	(save-excursion
 	  (save-restriction
 	    (widen)
@@ -522,6 +526,7 @@ already gone."
 	  (error "No match for target regexp in file %s" (nth 1 target))))
 
        ((eq (car target) 'file+datetree)
+	(require 'org-datetree)
 	(set-buffer (org-capture-target-buffer (nth 1 target)))
 	;; Make a date tree entry, with the current date (or yesterday,
 	;; if we are extending dates for a couple of hours)
@@ -839,7 +844,7 @@ Lisp programs can force the template by setting KEYS to a string."
   (when org-capture-templates
     (if keys
 	(or (assoc keys org-capture-templates)
-	    (error "No capture template referred to by \"%s\" keys"))
+	    (error "No capture template referred to by \"%s\" keys" keys))
       (org-mks org-capture-templates
 	       "Select a capture template\n========================="
 	       "Template key: "
@@ -1087,6 +1092,7 @@ The template may still contain \"%?\" for cursor positioning."
 	      "Import old remember templates into org-capture-templates? ")
 	     (yes-or-no-p
 	      "Note that this will remove any templates currently defined in `org-capture-templates'.  Do you still want to go ahead? "))
+    (require 'org-remember)
     (setq org-capture-templates
 	  (mapcar
 	   (lambda (entry)

+ 6 - 1
lisp/org-mks.el

@@ -23,6 +23,10 @@
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(require 'org)
+(eval-when-compile
+  (require 'cl))
+
 (defun org-mks (table title &optional prompt specials)
   "Select a member of an alist with multiple keys.
 TABLE is the alist which should contain entries where the car is a string.
@@ -49,7 +53,8 @@ also (\"key\" \"description\") entries.  When they are selected,
 
 "
   (setq prompt (or prompt "Select: "))
-  (let (tbl orig-table dkey ddesc des-keys allowed-keys current prefix rtn)
+  (let (tbl orig-table dkey ddesc des-keys allowed-keys
+	    current prefix rtn re pressed)
     (save-window-excursion
       (org-switch-to-buffer-other-window "*Org Select*")
       (setq orig-table table)