emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Fix `org-refresh-category-properties' (was: `org-get-categor


From: Samuel Loury
Subject: [O] [PATCH] Fix `org-refresh-category-properties' (was: `org-get-category' and `org-entry-get' do not return the same value)
Date: Tue, 28 Apr 2015 09:02:23 +0200
User-agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu)

Samuel Loury <address@hidden> writes:

> Dear Nicolas,

[...]

> --8<---------------cut here---------------start------------->8---
> #+CATEGORY: c
> * foo
>   :PROPERTIES:
>   :CATEGORY: a
>   :END:
> ** bar
>    :PROPERTIES:
>    :CATEGORY: b
>    :END:
>
> --8<---------------cut here---------------end--------------->8---
>
> `org-get-category' in the bar headline returns 'a', while I would expect
> it to return 'b'.

[...]

> I don't understand why one would want to remove this behavior. Does it
> raise a technical issue?

After a quick look at the code, I wonder if this new behavior is a
technical choice or hopefully a simple mistake.

Please find attached a patch that restores the behavior of taking into
account the CATEGORY keyword in sub-trees also.

From 9de5161d4bf8a3a3be2fa91d48667d676233e1a4 Mon Sep 17 00:00:00 2001
From: Konubinix <address@hidden>
Date: Tue, 28 Apr 2015 08:55:10 +0200
Subject: [PATCH] Fix `org-refresh-category-properties'

* lisp/org.el (org-refresh-category-properties): Prevent the `put-text-property'
  to change the point in order to take into account the CATEGORY keyword
  property in subtrees also.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index e52bf53..5b1dded 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9568,7 +9568,7 @@ The refresh happens only for the current tree (not 
subtree)."
            (when (org-at-property-p)
              (put-text-property
               (save-excursion (org-back-to-heading t) (point))
-              (org-end-of-subtree t t)
+              (save-excursion (org-end-of-subtree t t) (point))
               'org-category
               value)))))))))
 
-- 
2.1.4

Best regards,
-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]