From 85acebdc2e3f50d7476581b886ad5f9aace475e1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 16 Sep 2017 14:14:46 +0200 Subject: [PATCH] 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. --- lisp/org-pcomplete.el | 6 ++---- lisp/org.el | 22 ++++++---------------- testing/lisp/test-org.el | 8 +------- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 61ec5fad4..aeaef4b83 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -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)) diff --git a/lisp/org.el b/lisp/org.el index 08ed909d8..4453c9ff7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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)))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index c4a2a58e9..c3e7aa2d6 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -4916,13 +4916,7 @@ Paragraph" (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." -- 2.11.4.GIT