emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Loury <konubinix@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: OrgMode ML <emacs-orgmode@gnu.org>
Subject: [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	[thread overview]
Message-ID: <871tj4g2gw.fsf@konixwork.incubateur.ens-lyon.fr> (raw)
In-Reply-To: <874mo0g2wx.fsf@konixwork.incubateur.ens-lyon.fr>


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

  reply	other threads:[~2015-04-28  7:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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     ` Samuel Loury [this message]
2015-04-28  7:42       ` [PATCH] Fix `org-refresh-category-properties' Nicolas Goaziou
2015-04-28  8:14         ` Samuel Loury

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=871tj4g2gw.fsf@konixwork.incubateur.ens-lyon.fr \
    --to=konubinix@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).