Merge branch 'maint'
This commit is contained in:
commit
eda4684d35
34
lisp/org.el
34
lisp/org.el
|
@ -16000,24 +16000,22 @@ If yes, return this value. If not, return the current value of the variable."
|
||||||
"Delete PROPERTY from entry at point-or-marker POM.
|
"Delete PROPERTY from entry at point-or-marker POM.
|
||||||
Accumulated properties, i.e. PROPERTY+, are also removed. Return
|
Accumulated properties, i.e. PROPERTY+, are also removed. Return
|
||||||
non-nil when a property was removed."
|
non-nil when a property was removed."
|
||||||
(unless (member property org-special-properties)
|
(org-with-point-at pom
|
||||||
(org-with-point-at pom
|
(pcase (org-get-property-block)
|
||||||
(let ((range (org-get-property-block)))
|
(`(,begin . ,origin)
|
||||||
(when range
|
(let* ((end (copy-marker origin))
|
||||||
(let* ((begin (car range))
|
(re (org-re-property
|
||||||
(origin (cdr range))
|
(concat (regexp-quote property) "\\+?") t t)))
|
||||||
(end (copy-marker origin))
|
(goto-char begin)
|
||||||
(re (org-re-property
|
(while (re-search-forward re end t)
|
||||||
(concat (regexp-quote property) "\\+?") t t)))
|
(delete-region (match-beginning 0) (line-beginning-position 2)))
|
||||||
(goto-char begin)
|
;; If drawer is empty, remove it altogether.
|
||||||
(while (re-search-forward re end t)
|
(when (= begin end)
|
||||||
(delete-region (match-beginning 0) (line-beginning-position 2)))
|
(delete-region (line-beginning-position 0)
|
||||||
;; If drawer is empty, remove it altogether.
|
(line-beginning-position 2)))
|
||||||
(when (= begin end)
|
;; Return non-nil if some property was removed.
|
||||||
(delete-region (line-beginning-position 0)
|
(prog1 (/= end origin) (set-marker end nil))))
|
||||||
(line-beginning-position 2)))
|
(_ nil))))
|
||||||
;; Return non-nil if some property was removed.
|
|
||||||
(prog1 (/= end origin) (set-marker end nil))))))))
|
|
||||||
|
|
||||||
;; Multi-values properties are properties that contain multiple values
|
;; Multi-values properties are properties that contain multiple values
|
||||||
;; These values are assumed to be single words, separated by whitespace.
|
;; These values are assumed to be single words, separated by whitespace.
|
||||||
|
|
|
@ -4220,7 +4220,12 @@ Paragraph<point>"
|
||||||
(org-entry-delete (point) "A")))
|
(org-entry-delete (point) "A")))
|
||||||
(should-not
|
(should-not
|
||||||
(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:B: 2\n:END:"
|
(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:B: 2\n:END:"
|
||||||
(org-entry-delete (point) "C"))))
|
(org-entry-delete (point) "C")))
|
||||||
|
;; Special properties cannot be located in a drawer. Allow to
|
||||||
|
;; remove them anyway, in case of user error.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "* H\n:PROPERTIES:\n:SCHEDULED: 1\n:END:"
|
||||||
|
(org-entry-delete (point) "SCHEDULED"))))
|
||||||
|
|
||||||
(ert-deftest test-org/entry-get ()
|
(ert-deftest test-org/entry-get ()
|
||||||
"Test `org-entry-get' specifications."
|
"Test `org-entry-get' specifications."
|
||||||
|
|
Loading…
Reference in New Issue