Remove auto-repair of malformed property drawers

* lisp/org.el (org-buffer-property-keys): Remove optional argument
  IGNORE-MALFORMED.
* lisp/org-pcomplete.el (pcomplete/org-mode/prop): Update call to
  previous function.

* testing/lisp/test-org.el (test-org/buffer-property-keys): Remove
  a test.

More often than not, the question just gets in the way.  Use `M-x
org-lint' instead.
This commit is contained in:
Nicolas Goaziou 2017-09-16 14:14:46 +02:00
parent 3df23ef80c
commit 85acebdc2e
3 changed files with 9 additions and 27 deletions

View File

@ -34,8 +34,7 @@
(declare-function org-make-org-heading-search-string "org" (&optional string))
(declare-function org-get-buffer-tags "org" ())
(declare-function org-get-tags "org" ())
(declare-function org-buffer-property-keys "org"
(&optional specials defaults columns ignore-malformed))
(declare-function org-buffer-property-keys "org" (&optional specials defaults columns))
(declare-function org-entry-properties "org" (&optional pom which))
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
@ -345,8 +344,7 @@ This needs more work, to handle headings with lots of spaces in them."
(mapcar (lambda (x)
(concat x ": "))
(let ((lst (pcomplete-uniqify-list
(copy-sequence
(org-buffer-property-keys nil t t t)))))
(copy-sequence (org-buffer-property-keys nil t t)))))
(dolist (prop (org-entry-properties))
(setq lst (delete (car prop) lst)))
lst))

View File

@ -16010,8 +16010,7 @@ decreases scheduled or deadline date by one day."
(org-indent-line)))))
(run-hook-with-args 'org-property-changed-functions property value)))
(defun org-buffer-property-keys
(&optional specials defaults columns ignore-malformed)
(defun org-buffer-property-keys (&optional specials defaults columns)
"Get all property keys in the current buffer.
When SPECIALS is non-nil, also list the special properties that
@ -16022,10 +16021,7 @@ special meaning internally: ARCHIVE, CATEGORY, SUMMARY,
DESCRIPTION, LOCATION, and LOGGING and others.
When COLUMNS in non-nil, also include property names given in
COLUMN formats in the current buffer.
When IGNORE-MALFORMED is non-nil, malformed drawer repair will not be
automatically performed, such drawers will be silently ignored."
COLUMN formats in the current buffer."
(let ((case-fold-search t)
(props (append
(and specials org-special-properties)
@ -16034,15 +16030,9 @@ automatically performed, such drawers will be silently ignored."
(org-with-wide-buffer
(goto-char (point-min))
(while (re-search-forward org-property-start-re nil t)
(let ((range (org-get-property-block)))
(catch 'skip
(unless range
(when (and (not ignore-malformed)
(not (org-before-first-heading-p))
(y-or-n-p (format "Malformed drawer at %d, repair?"
(line-beginning-position))))
(org-get-property-block nil t))
(throw 'skip nil))
(catch :skip
(let ((range (org-get-property-block)))
(unless range (throw :skip nil))
(goto-char (car range))
(let ((begin (car range))
(end (cdr range)))
@ -16060,7 +16050,7 @@ automatically performed, such drawers will be silently ignored."
;; :PROPERTIES:
;; #+END_EXAMPLE
;;
(if (< begin (point)) (throw 'skip nil) (goto-char begin))
(if (< begin (point)) (throw :skip nil) (goto-char begin))
(while (< (point) end)
(let ((p (progn (looking-at org-property-re)
(match-string-no-properties 2))))

View File

@ -4916,13 +4916,7 @@ Paragraph<point>"
(equal '("A" "B" "COLUMNS")
(org-test-with-temp-text
"* H\n:PROPERTIES:\n:COLUMNS: %25ITEM %A %20B\n:END:"
(org-buffer-property-keys nil nil t))))
;; With non-nil IGNORE-MALFORMED malformed property drawers are silently ignored.
(should
(equal '("A")
(org-test-with-temp-text
"* a\n:PROPERTIES:\n:A: 1\n:END:\n* b\n:PROPERTIES:\nsome junk here\n:END:\n"
(org-buffer-property-keys nil nil nil t)))))
(org-buffer-property-keys nil nil t)))))
(ert-deftest test-org/property-values ()
"Test `org-property-values' specifications."