From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: invalid property drawer and C-c C-x p Date: Mon, 25 Aug 2014 15:38:32 +0200 Message-ID: <87wq9wit9j.fsf@nicolasgoaziou.fr> References: <874mx0lmq7.fsf@geodiff-mac3.ulb.ac.be> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLuTY-0004WH-Ud for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:38:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLuTR-0007P7-M7 for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:38:24 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:46931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLuTR-0007Ov-Fh for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:38:17 -0400 In-Reply-To: <874mx0lmq7.fsf@geodiff-mac3.ulb.ac.be> (Nicolas Richard's message of "Mon, 25 Aug 2014 15:31:28 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Richard Cc: emacs-orgmode@gnu.org Hello, Nicolas Richard 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