[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] invalid property drawer and C-c C-x p
From: |
Nicolas Richard |
Subject: |
[O] invalid property drawer and C-c C-x p |
Date: |
Mon, 25 Aug 2014 15:31:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux) |
Hi,
Sometimes I apparently manage to corrupt my org files by having an
unfinished drawers in them. Of course this is wrong and I should
investigate, but if it happens, hitting C-c C-x p leads to a useless
error (Wrong type argument: integer-or-marker-p, nil). I suggest to
following patch for a better error:
diff --git a/lisp/org.el b/lisp/org.el
index adfbeaa..4489287 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15612,6 +15612,8 @@ formats in the current buffer."
(goto-char (point-min))
(while (re-search-forward org-property-start-re nil t)
(setq range (org-get-property-block))
+ (when (not range)
+ (error "Invalid property block in buffer %s at position %d"
(current-buffer) (point)))
(goto-char (car range))
(while (re-search-forward org-property-re
(cdr range) t)
To test it :
(with-temp-buffer
(org-mode)
(insert "* foo\n:PROPERTIES:\n:BAR: \n\n bal")
(org-set-property nil nil))
--
Nicolas Richard
- [O] invalid property drawer and C-c C-x p,
Nicolas Richard <=