emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Oleh <ohwoeowho@gmail.com>
To: org mode <emacs-orgmode@gnu.org>
Subject: [PATCH] org.el (org-delete-property): Remove bogus properties
Date: Wed, 12 Mar 2014 17:19:55 +0100	[thread overview]
Message-ID: <CAA01p3rMKvbnmnF6hs-7pZ0JBeKdpb+H8TB7n_gh7V7eN5mDZg@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2014-03-12 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 16:19 Oleh [this message]
2014-03-12 18:22 ` [PATCH] org.el (org-delete-property): Remove bogus properties Bastien
2014-03-13 20:57   ` Oleh
2014-03-13 22:22     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA01p3rMKvbnmnF6hs-7pZ0JBeKdpb+H8TB7n_gh7V7eN5mDZg@mail.gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).