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

* Re: [PATCH] org.el (org-delete-property): Remove bogus properties
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2014-03-12 18:22 UTC (permalink / raw)
  To: Oleh; +Cc: org mode

Hi Oleh,

Oleh <ohwoeowho@gmail.com> writes:

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

I applied a different patch, things are a bit more complicate:
(org-get-category) always returns a non-empty string (at least
after `org-refresh-category-properties' as been called once),
while (org-entry-get (point) "CATEGORY") is the real check we
need to perform.

Thanks for raising this!

-- 
 Bastien

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

* Re: [PATCH] org.el (org-delete-property): Remove bogus properties
  2014-03-12 18:22 ` Bastien
@ 2014-03-13 20:57   ` Oleh
  2014-03-13 22:22     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Oleh @ 2014-03-13 20:57 UTC (permalink / raw)
  To: Bastien; +Cc: org mode

Hi Bastien,

I've pushed a bugfix related to the patch.
`org-entry-delete' was being called with 3 args, although it takes 2.
I hope I understood it correctly. Could you please check?

regards,
Oleh

On Wed, Mar 12, 2014 at 7:22 PM, Bastien <bzg@gnu.org> wrote:
> Hi Oleh,
>
> Oleh <ohwoeowho@gmail.com> writes:
>
>> Can someone have a look at this patch and check it in?
>
> I applied a different patch, things are a bit more complicate:
> (org-get-category) always returns a non-empty string (at least
> after `org-refresh-category-properties' as been called once),
> while (org-entry-get (point) "CATEGORY") is the real check we
> need to perform.
>
> Thanks for raising this!
>
> --
>  Bastien
>

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

* Re: [PATCH] org.el (org-delete-property): Remove bogus properties
  2014-03-13 20:57   ` Oleh
@ 2014-03-13 22:22     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2014-03-13 22:22 UTC (permalink / raw)
  To: Oleh; +Cc: org mode

Oleh <ohwoeowho@gmail.com> writes:

> I've pushed a bugfix related to the patch.
> `org-entry-delete' was being called with 3 args, although it takes 2.
> I hope I understood it correctly. Could you please check?

Looks good, thanks for the fix,

-- 
 Bastien

^ permalink raw reply	[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).