summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-03-15 16:51:36 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-03-15 16:53:58 +0100
commit7b450bc7bbd24e79d2aca74210e1b580dc944284 (patch)
tree128c8916e32ab4e12f197b95d41cdb5b8398f818
parent84d6ff4ec134c3b1ae2ba05c10eaeddc70f8d56f (diff)
downloadorg-mode-7b450bc7bbd24e79d2aca74210e1b580dc944284.tar.gz
Fix `org-delete-property-globally'
* lisp/org.el (org-delete-property-globally): Ignore false positive.
-rwxr-xr-xlisp/org.el23
1 files changed, 10 insertions, 13 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 7f417ce..7beef2d 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16230,24 +16230,21 @@ part of the buffer."
(message "Property \"%s\" deleted" 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
(let* ((completion-ignore-case t)
(prop (org-icompleting-read
"Globally remove property: "
- (mapcar 'list (org-buffer-property-keys)))))
+ (mapcar #'list (org-buffer-property-keys)))))
(list prop)))
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- (let ((cnt 0))
- (while (re-search-forward
- (org-re-property property)
- nil t)
- (setq cnt (1+ cnt))
- (delete-region (match-beginning 0) (1+ (point-at-eol))))
- (message "Property \"%s\" removed from %d entries" property cnt)))))
+ (org-with-wide-buffer
+ (goto-char (point-min))
+ (let ((count 0)
+ (re (org-re-property (concat (regexp-quote property) "\\+?") t t)))
+ (while (re-search-forward re nil t)
+ (when (org-entry-delete (point) property) (incf count)))
+ (message "Property \"%s\" removed from %d entries" property count))))
(defvar org-columns-current-fmt-compiled) ; defined in org-colview.el