emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Matt Lundin <mdl@imapmail.org>, emacs-orgmode@gnu.org
Subject: Re: Re: [PATCH] Always return refreshed category
Date: Mon, 27 Dec 2010 11:56:13 +0100	[thread overview]
Message-ID: <sa37hevscvm.fsf@cigue.easter-eggs.fr> (raw)
In-Reply-To: <D4BBC8E7-2E08-4A34-93B0-FAFF35516C4B@gmail.com> (Carsten Dominik's message of "Fri, 24 Dec 2010 17:33:41 +0100")


[-- Attachment #1.1.1: Type: text/plain, Size: 236 bytes --]

On Fri, Dec 24 2010, Carsten Dominik wrote:

> I have reverted the patch for now.  It would be great if the two of
> you could continue to try to fix it before we make another attempt.

Here's an updated patch with all the fixes above.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-Always-return-refreshed-category.patch --]
[-- Type: text/x-diff, Size: 4331 bytes --]

From 3821f60475b20df92ad21afc7604b4c7f0c3d9bb Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Wed, 22 Dec 2010 15:00:27 +0100
Subject: [PATCH] Always return refreshed category

* org-icalendar.el (org-print-icalendar-entries): Do not manually
  refresh categories.

* org-clock.el (org-clock-insert-selection-line): Do not manually
  refresh categories.

* org.el (org-get-category): Refresh categories if no category found.
(org-entry-properties): Do not manually refresh categories.
(org-prepare-agenda-buffers): Do not manually refresh categories.

It seems a very bad thing to call manually for a category refresh. It
seems better to try to refresh if we do not have a category.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/org-archive.el   |    1 -
 lisp/org-clock.el     |    4 +---
 lisp/org-icalendar.el |    1 -
 lisp/org.el           |   14 ++++++--------
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index e56b01f..c32ee23 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -226,7 +226,6 @@ this heading."
       (save-excursion
 	(org-back-to-heading t)
 	;; Get context information that will be lost by moving the tree
-	(org-refresh-category-properties)
 	(setq category (org-get-category)
 	      todo (and (looking-at org-todo-line-regexp)
 			(match-string 2))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 93b0b52..17fccae 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -442,9 +442,7 @@ pointing to it."
 	    (ignore-errors
 	      (goto-char marker)
 	      (setq file (buffer-file-name (marker-buffer marker))
-		    cat (or (org-get-category)
-			    (progn (org-refresh-category-properties)
-				   (org-get-category)))
+		    cat (org-get-category)
 		    heading (org-get-heading 'notags)
 		    prefix (save-excursion
 			     (org-back-to-heading t)
diff --git a/lisp/org-icalendar.el b/lisp/org-icalendar.el
index d4034fe..a1bc5ad 100644
--- a/lisp/org-icalendar.el
+++ b/lisp/org-icalendar.el
@@ -302,7 +302,6 @@ When COMBINE is non nil, add the category to each line."
 	scheduledp deadlinep todo prefix due start
 	tmp pri categories location summary desc uid alarm
 	(sexp-buffer (get-buffer-create "*ical-tmp*")))
-    (org-refresh-category-properties)
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward re1 nil t)
diff --git a/lisp/org.el b/lisp/org.el
index e190b84..125fbef 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8142,7 +8142,10 @@ call CMD."
 
 (defun org-get-category (&optional pos)
   "Get the category applying to position POS."
-  (get-text-property (or pos (point)) 'org-category))
+  (let ((pos (or pos (point))))
+    (or (get-text-property pos 'org-category)
+	(progn (org-refresh-category-properties)
+	       (get-text-property pos 'org-category)))))
 
 (defun org-refresh-category-properties ()
   "Refresh category text properties in the buffer."
@@ -8150,8 +8153,7 @@ call CMD."
 		  ((null org-category)
 		   (if buffer-file-name
 		       (file-name-sans-extension
-			(file-name-nondirectory buffer-file-name))
-		     "???"))
+			(file-name-nondirectory buffer-file-name))))
 		  ((symbolp org-category) (symbol-name org-category))
 		  (t org-category)))
 	beg end cat pos optionp)
@@ -13482,10 +13484,7 @@ things up because then unnecessary parsing is avoided."
 						       'add_times))
 		    props))
 	  (unless (assoc "CATEGORY" props)
-	    (setq value (or (org-get-category)
-			    (progn (org-refresh-category-properties)
-				   (org-get-category))))
-	    (push (cons "CATEGORY" value) props))
+	    (push (cons "CATEGORY" (org-get-category)) props))
 	  (append sum-props (nreverse props)))))))
 
 (defun org-entry-get (pom property &optional inherit literal-nil)
@@ -15702,7 +15701,6 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 	      (set-buffer (org-get-agenda-file-buffer file)))
 	    (widen)
 	    (setq bmp (buffer-modified-p))
-	    (org-refresh-category-properties)
 	    (setq org-todo-keywords-for-agenda
 		  (append org-todo-keywords-for-agenda org-todo-keywords-1))
 	    (setq org-done-keywords-for-agenda
-- 
1.7.2.3


[-- Attachment #1.1.3: Type: text/plain, Size: 79 bytes --]


Sorry for the mess. :)

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-12-27 10:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 14:06 [PATCH] Always return refreshed category Julien Danjou
2010-12-23  7:43 ` [Accepted] " Carsten Dominik
2010-12-23  7:43 ` [PATCH] " Carsten Dominik
2010-12-23 15:42   ` Matt Lundin
2010-12-23 16:03     ` Julien Danjou
2010-12-24 15:46       ` Matt Lundin
2010-12-24 16:33         ` Carsten Dominik
2010-12-27 10:56           ` Julien Danjou [this message]
2010-12-27 14:23             ` Julien Danjou
2011-01-03  8:39               ` Carsten Dominik
2011-01-03 10:57                 ` Julien Danjou
2011-01-03 12:14                   ` Carsten Dominik
2010-12-24 16:33         ` Julien Danjou

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=sa37hevscvm.fsf@cigue.easter-eggs.fr \
    --to=julien@danjou.info \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.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).