emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el (org-delete-property): Remove bogus properties
@ 2014-03-12 16:19 Oleh
  2014-03-12 18:22 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Oleh @ 2014-03-12 16:19 UTC (permalink / raw)
  To: org mode

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

Hi all,

Can someone have a look at this patch and check it in?

It fixes `org-delete-property` offering to delete "CATEGORY" property although
it's not present. Also skip completion when there's only one candidate.

regards,
Oleh

[-- Attachment #2: 0001-org.el-org-delete-property-Remove-bogus-properties.patch --]
[-- Type: text/x-patch, Size: 1431 bytes --]

From ad4415a4cbf67955c636b8a3384f3163cac61462 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <ohwoeowho@gmail.com>
Date: Wed, 12 Mar 2014 17:11:12 +0100
Subject: [PATCH] org.el (org-delete-property): Remove bogus properties

* lisp/org.el (org-delete-property): Don't offer to delete "CATEGORY"
  property, since it's not really there. If there's only one property
  to delete, don't call `org-icompleting-read'.
---
 lisp/org.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2f3820f..3a64d1d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15895,13 +15895,16 @@ in the current file."
   "In the current entry, delete PROPERTY."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (org-icompleting-read "Property: "
-				      (org-entry-properties nil 'standard))))
-     (list prop)))
+	 (props (org-remove-if
+		 (lambda (x) (string= (car x) "CATEGORY"))
+		 (org-entry-properties nil 'standard))))
+     (if (= 1 (length props))
+	 (list (caar props))
+       (list (org-icompleting-read "Property: " props)))))
   (message "Property %s %s" property
-	   (if (org-entry-delete nil property)
-	       "deleted"
-	     "was not present in the entry")))
+	 (if (org-entry-delete nil property)
+	 "deleted"
+	 "was not present in the entry")))
 
 (defun org-delete-property-globally (property)
   "Remove PROPERTY globally, from all entries."
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-13 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12 16:19 [PATCH] org.el (org-delete-property): Remove bogus properties Oleh
2014-03-12 18:22 ` Bastien
2014-03-13 20:57   ` Oleh
2014-03-13 22:22     ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).