From 9f1e6fa95264abb84a0afd04f55b175210f1c0e1 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 18 Nov 2008 08:59:39 +0100 Subject: [PATCH] Avoid error when ID is created in buffer without a file. When ID's are created, Org tries to remember in which file the id is located. However, if an ID is created in a remember buffer, no file is known. This patch makes sure that this condition does not lead to an error. --- lisp/ChangeLog | 3 +++ lisp/org-id.el | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cba055615..20dc9b64d 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2008-11-18 Carsten Dominik + * org-id.el (org-id-add-location): Avoid error when no file is + given. + * org-remember.el (org-remember-apply-template): Fix the way how the list of allowed properties is retrieved from the target file. diff --git a/lisp/org-id.el b/lisp/org-id.el index 7b18e988c..0613662c6 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -376,15 +376,16 @@ Store the relation between files and corresponding ID's." (defun org-id-add-location (id file) "Add the ID with location FILE to the database of ID loations." - (unless org-id-locations (org-id-locations-load)) - (catch 'exit - (let ((locs org-id-locations) list) - (while (setq list (pop locs)) - (when (equal (file-truename file) (file-truename (car list))) - (setcdr list (cons id (cdr list))) - (throw 'exit t)))) - (push (list file id) org-id-locations)) - (org-id-locations-save)) + (when (and id file) ; don't error when called from a buffer with no file + (unless org-id-locations (org-id-locations-load)) + (catch 'exit + (let ((locs org-id-locations) list) + (while (setq list (pop locs)) + (when (equal (file-truename file) (file-truename (car list))) + (setcdr list (cons id (cdr list))) + (throw 'exit t)))) + (push (list file id) org-id-locations)) + (org-id-locations-save))) ;; Finding entries with specified id -- 2.11.4.GIT