forked from mirrors/org-mode
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:
parent
3df23ef80c
commit
85acebdc2e
|
@ -34,8 +34,7 @@
|
||||||
(declare-function org-make-org-heading-search-string "org" (&optional string))
|
(declare-function org-make-org-heading-search-string "org" (&optional string))
|
||||||
(declare-function org-get-buffer-tags "org" ())
|
(declare-function org-get-buffer-tags "org" ())
|
||||||
(declare-function org-get-tags "org" ())
|
(declare-function org-get-tags "org" ())
|
||||||
(declare-function org-buffer-property-keys "org"
|
(declare-function org-buffer-property-keys "org" (&optional specials defaults columns))
|
||||||
(&optional specials defaults columns ignore-malformed))
|
|
||||||
(declare-function org-entry-properties "org" (&optional pom which))
|
(declare-function org-entry-properties "org" (&optional pom which))
|
||||||
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
|
(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)
|
(mapcar (lambda (x)
|
||||||
(concat x ": "))
|
(concat x ": "))
|
||||||
(let ((lst (pcomplete-uniqify-list
|
(let ((lst (pcomplete-uniqify-list
|
||||||
(copy-sequence
|
(copy-sequence (org-buffer-property-keys nil t t)))))
|
||||||
(org-buffer-property-keys nil t t t)))))
|
|
||||||
(dolist (prop (org-entry-properties))
|
(dolist (prop (org-entry-properties))
|
||||||
(setq lst (delete (car prop) lst)))
|
(setq lst (delete (car prop) lst)))
|
||||||
lst))
|
lst))
|
||||||
|
|
22
lisp/org.el
22
lisp/org.el
|
@ -16010,8 +16010,7 @@ decreases scheduled or deadline date by one day."
|
||||||
(org-indent-line)))))
|
(org-indent-line)))))
|
||||||
(run-hook-with-args 'org-property-changed-functions property value)))
|
(run-hook-with-args 'org-property-changed-functions property value)))
|
||||||
|
|
||||||
(defun org-buffer-property-keys
|
(defun org-buffer-property-keys (&optional specials defaults columns)
|
||||||
(&optional specials defaults columns ignore-malformed)
|
|
||||||
"Get all property keys in the current buffer.
|
"Get all property keys in the current buffer.
|
||||||
|
|
||||||
When SPECIALS is non-nil, also list the special properties that
|
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.
|
DESCRIPTION, LOCATION, and LOGGING and others.
|
||||||
|
|
||||||
When COLUMNS in non-nil, also include property names given in
|
When COLUMNS in non-nil, also include property names given in
|
||||||
COLUMN formats in the current buffer.
|
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."
|
|
||||||
(let ((case-fold-search t)
|
(let ((case-fold-search t)
|
||||||
(props (append
|
(props (append
|
||||||
(and specials org-special-properties)
|
(and specials org-special-properties)
|
||||||
|
@ -16034,15 +16030,9 @@ automatically performed, such drawers will be silently ignored."
|
||||||
(org-with-wide-buffer
|
(org-with-wide-buffer
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward org-property-start-re nil t)
|
(while (re-search-forward org-property-start-re nil t)
|
||||||
(let ((range (org-get-property-block)))
|
(catch :skip
|
||||||
(catch 'skip
|
(let ((range (org-get-property-block)))
|
||||||
(unless range
|
(unless range (throw :skip nil))
|
||||||
(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))
|
|
||||||
(goto-char (car range))
|
(goto-char (car range))
|
||||||
(let ((begin (car range))
|
(let ((begin (car range))
|
||||||
(end (cdr range)))
|
(end (cdr range)))
|
||||||
|
@ -16060,7 +16050,7 @@ automatically performed, such drawers will be silently ignored."
|
||||||
;; :PROPERTIES:
|
;; :PROPERTIES:
|
||||||
;; #+END_EXAMPLE
|
;; #+END_EXAMPLE
|
||||||
;;
|
;;
|
||||||
(if (< begin (point)) (throw 'skip nil) (goto-char begin))
|
(if (< begin (point)) (throw :skip nil) (goto-char begin))
|
||||||
(while (< (point) end)
|
(while (< (point) end)
|
||||||
(let ((p (progn (looking-at org-property-re)
|
(let ((p (progn (looking-at org-property-re)
|
||||||
(match-string-no-properties 2))))
|
(match-string-no-properties 2))))
|
||||||
|
|
|
@ -4916,13 +4916,7 @@ Paragraph<point>"
|
||||||
(equal '("A" "B" "COLUMNS")
|
(equal '("A" "B" "COLUMNS")
|
||||||
(org-test-with-temp-text
|
(org-test-with-temp-text
|
||||||
"* H\n:PROPERTIES:\n:COLUMNS: %25ITEM %A %20B\n:END:"
|
"* H\n:PROPERTIES:\n:COLUMNS: %25ITEM %A %20B\n:END:"
|
||||||
(org-buffer-property-keys nil nil t))))
|
(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)))))
|
|
||||||
|
|
||||||
(ert-deftest test-org/property-values ()
|
(ert-deftest test-org/property-values ()
|
||||||
"Test `org-property-values' specifications."
|
"Test `org-property-values' specifications."
|
||||||
|
|
Loading…
Reference in New Issue