From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: invalid property drawer and C-c C-x p Date: Mon, 25 Aug 2014 15:31:28 +0200 Message-ID: <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]:55858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLuLG-0000xh-Rv for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLuL6-0004Sw-3O for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:29:50 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:14494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLuL5-0004Rv-TH for emacs-orgmode@gnu.org; Mon, 25 Aug 2014 09:29:40 -0400 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: emacs-orgmode@gnu.org 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