* `org-get-category' and `org-entry-get' do not return the same value
@ 2015-01-30 7:56 Samuel Loury
2015-01-30 8:57 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Loury @ 2015-01-30 7:56 UTC (permalink / raw)
To: OrgMode ML
[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]
Hi,
I use the version cd6fa4c15e8e35afa6beb9e89ad3723fb82df091 (git sha) of
org-mode.
Let's say I have a file looking like this:
--8<---------------cut here---------------start------------->8---
#+CATEGORY: c
* foo
:PROPERTIES:
:CATEGORY: a
:END:
** bar
:PROPERTIES:
:CREATED: [2015-01-30 Fri 08:37]
:END:
--8<---------------cut here---------------end--------------->8---
With the point on bar, `org-get-category' returns "a" while
(org-entry-get (point) "CATEGORY" t) returns "c". Notice that it returns
"c" even if the third argument is INHERIT.
This causes the strange behavior that I cannot set interactively the
CATEGORY property value to "c" with C-x C-c p.
The behavior is again more strange in the agenda, where the bar entry is
correctly shown with the CATEGORY "a" and trying to change it with
--8<---------------cut here---------------start------------->8---
C-x C-c p CATEGORY c
--8<---------------cut here---------------end--------------->8---
does nothing.
Is there a new way to interactively edit the CATEGORY or should
`org-set-property' tackle the special case of CATEGORY?
Best regards,
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `org-get-category' and `org-entry-get' do not return the same value
2015-01-30 7:56 `org-get-category' and `org-entry-get' do not return the same value Samuel Loury
@ 2015-01-30 8:57 ` Nicolas Goaziou
2015-04-28 6:52 ` Samuel Loury
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-01-30 8:57 UTC (permalink / raw)
To: Samuel Loury; +Cc: OrgMode ML
Hello,
Samuel Loury <konubinix@gmail.com> writes:
> I use the version cd6fa4c15e8e35afa6beb9e89ad3723fb82df091 (git sha) of
> org-mode.
>
> Let's say I have a file looking like this:
>
> #+CATEGORY: c
> * foo
> :PROPERTIES:
> :CATEGORY: a
> :END:
> ** bar
> :PROPERTIES:
> :CREATED: [2015-01-30 Fri 08:37]
> :END:
>
> With the point on bar, `org-get-category' returns "a" while
> (org-entry-get (point) "CATEGORY" t) returns "c". Notice that it returns
> "c" even if the third argument is INHERIT.
This should be fixed. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: `org-get-category' and `org-entry-get' do not return the same value
2015-01-30 8:57 ` Nicolas Goaziou
@ 2015-04-28 6:52 ` Samuel Loury
2015-04-28 7:02 ` [PATCH] Fix `org-refresh-category-properties' (was: `org-get-category' and `org-entry-get' do not return the same value) Samuel Loury
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Loury @ 2015-04-28 6:52 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: OrgMode ML
[-- Attachment #1: Type: text/plain, Size: 2336 bytes --]
Dear Nicolas,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Samuel Loury <konubinix@gmail.com> writes:
>
>> I use the version cd6fa4c15e8e35afa6beb9e89ad3723fb82df091 (git sha) of
>> org-mode.
>>
>> Let's say I have a file looking like this:
>>
>> #+CATEGORY: c
>> * foo
>> :PROPERTIES:
>> :CATEGORY: a
>> :END:
>> ** bar
>> :PROPERTIES:
>> :CREATED: [2015-01-30 Fri 08:37]
>> :END:
>>
>> With the point on bar, `org-get-category' returns "a" while
>> (org-entry-get (point) "CATEGORY" t) returns "c". Notice that it returns
>> "c" even if the third argument is INHERIT.
>
> This should be fixed. Thank you.
Thank you for taking the time to fix the problem.
I just fetched the last version of the sources and realized the CATEGORY
handling still strange. The CATEGORY keyword is taken into account only
at the upper level in the headline hierarchy.
I will illustrate the in the same example as above with a small
modification:
--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 realized that this change was introduced in the following commit:
--8<---------------cut here---------------start------------->8---
commit 80bccca4e249cbb5812963863ccffbdcf4b25edd
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Tue Mar 31 16:22:10 2015 +0200
Fix `org-refresh-category-properties'
* lisp/org.el (org-refresh-category-properties): Ignore false
positives when setting category. Also, deprecate old CATEGORY
keyword behaviour: new keywords override old ones.
--8<---------------cut here---------------end--------------->8---
Most of my work flow with org-mode relies on this old behavior.
I searched through the sources, the git history and the mailing list to
find out why this behavior was changed but found nothing.
I don't understand why one would want to remove this behavior. Does it
raise a technical issue?
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Fix `org-refresh-category-properties' (was: `org-get-category' and `org-entry-get' do not return the same value)
2015-04-28 6:52 ` Samuel Loury
@ 2015-04-28 7:02 ` Samuel Loury
2015-04-28 7:42 ` [PATCH] Fix `org-refresh-category-properties' Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Loury @ 2015-04-28 7:02 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: OrgMode ML
[-- Attachment #1.1: Type: text/plain, Size: 772 bytes --]
Samuel Loury <konubinix@gmail.com> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fix-org-refresh-category-properties.patch --]
[-- Type: text/x-diff, Size: 945 bytes --]
From 9de5161d4bf8a3a3be2fa91d48667d676233e1a4 Mon Sep 17 00:00:00 2001
From: Konubinix <konubinix@gmail.com>
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
[-- Attachment #1.3: Type: text/plain, Size: 119 bytes --]
Best regards,
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix `org-refresh-category-properties'
2015-04-28 7:02 ` [PATCH] Fix `org-refresh-category-properties' (was: `org-get-category' and `org-entry-get' do not return the same value) Samuel Loury
@ 2015-04-28 7:42 ` Nicolas Goaziou
2015-04-28 8:14 ` Samuel Loury
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-04-28 7:42 UTC (permalink / raw)
To: Samuel Loury; +Cc: OrgMode ML
Hello,
Samuel Loury <konubinix@gmail.com> writes:
> Samuel Loury <konubinix@gmail.com> 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?
No, it's a bug.
> After a quick look at the code, I wonder if this new behavior is a
> technical choice or hopefully a simple mistake.
The latter.
> Please find attached a patch that restores the behavior of taking into
> account the CATEGORY keyword in sub-trees also.
Applied, with an additional test. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix `org-refresh-category-properties'
2015-04-28 7:42 ` [PATCH] Fix `org-refresh-category-properties' Nicolas Goaziou
@ 2015-04-28 8:14 ` Samuel Loury
0 siblings, 0 replies; 6+ messages in thread
From: Samuel Loury @ 2015-04-28 8:14 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: OrgMode ML
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Samuel Loury <konubinix@gmail.com> writes:
>
>> Samuel Loury <konubinix@gmail.com> 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?
>
> No, it's a bug.
>
>> After a quick look at the code, I wonder if this new behavior is a
>> technical choice or hopefully a simple mistake.
>
> The latter.
>
>> Please find attached a patch that restores the behavior of taking into
>> account the CATEGORY keyword in sub-trees also.
>
>
> Applied, with an additional test. Thank you.
Thank you for the fast answer.
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-28 8:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30 7:56 `org-get-category' and `org-entry-get' do not return the same value Samuel Loury
2015-01-30 8:57 ` Nicolas Goaziou
2015-04-28 6:52 ` Samuel Loury
2015-04-28 7:02 ` [PATCH] Fix `org-refresh-category-properties' (was: `org-get-category' and `org-entry-get' do not return the same value) Samuel Loury
2015-04-28 7:42 ` [PATCH] Fix `org-refresh-category-properties' Nicolas Goaziou
2015-04-28 8:14 ` Samuel Loury
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.