* invalid property drawer and C-c C-x p
@ 2014-08-25 13:31 Nicolas Richard
2014-08-25 13:38 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Richard @ 2014-08-25 13:31 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: invalid property drawer and C-c C-x p
2014-08-25 13:31 invalid property drawer and C-c C-x p Nicolas Richard
@ 2014-08-25 13:38 ` Nicolas Goaziou
2014-08-25 13:49 ` [Bulk] " Nicolas Richard
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2014-08-25 13:38 UTC (permalink / raw)
To: Nicolas Richard; +Cc: emacs-orgmode
Hello,
Nicolas Richard <theonewiththeevillook@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-25 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 13:31 invalid property drawer and C-c C-x p Nicolas Richard
2014-08-25 13:38 ` Nicolas Goaziou
2014-08-25 13:49 ` [Bulk] " Nicolas Richard
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.