[O] invalid property drawer and C-c C-x p
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
Re: [O] invalid property drawer and C-c C-x p
Hello, Nicolas Richard theonewiththeevill...@yahoo.fr writes: 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) AFAICT, a similar mechanism is already implemented in master. Regards, -- Nicolas Goaziou