Fix `org-delete-property-globally'

* lisp/org.el (org-delete-property-globally): Ignore false positive.
This commit is contained in:
Nicolas Goaziou 2015-03-15 16:51:36 +01:00
parent 84d6ff4ec1
commit 7b450bc7bb
1 changed files with 10 additions and 13 deletions

View File

@ -16230,24 +16230,21 @@ part of the buffer."
(message "Property \"%s\" deleted" property))) (message "Property \"%s\" deleted" property)))
(defun org-delete-property-globally (property) (defun org-delete-property-globally (property)
"Remove PROPERTY globally, from all entries." "Remove PROPERTY globally, from all entries.
This function ignores narrowing, if any."
(interactive (interactive
(let* ((completion-ignore-case t) (let* ((completion-ignore-case t)
(prop (org-icompleting-read (prop (org-icompleting-read
"Globally remove property: " "Globally remove property: "
(mapcar 'list (org-buffer-property-keys))))) (mapcar #'list (org-buffer-property-keys)))))
(list prop))) (list prop)))
(save-excursion (org-with-wide-buffer
(save-restriction
(widen)
(goto-char (point-min)) (goto-char (point-min))
(let ((cnt 0)) (let ((count 0)
(while (re-search-forward (re (org-re-property (concat (regexp-quote property) "\\+?") t t)))
(org-re-property property) (while (re-search-forward re nil t)
nil t) (when (org-entry-delete (point) property) (incf count)))
(setq cnt (1+ cnt)) (message "Property \"%s\" removed from %d entries" property count))))
(delete-region (match-beginning 0) (1+ (point-at-eol))))
(message "Property \"%s\" removed from %d entries" property cnt)))))
(defvar org-columns-current-fmt-compiled) ; defined in org-colview.el (defvar org-columns-current-fmt-compiled) ; defined in org-colview.el