From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Danjou Subject: Re: Re: [PATCH] Always return refreshed category Date: Mon, 27 Dec 2010 11:56:13 +0100 Message-ID: References: <1293026785-12467-1-git-send-email-julien@danjou.info> <74C83FF2-959A-4C7D-B161-0C333EEE36DD@gmail.com> <87d3osa42b.fsf@fastmail.fm> <87r5d7xjfv.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0560963378==" Return-path: Received: from [140.186.70.92] (port=49676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXAkV-0004A1-GC for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXAkT-0003Ip-Pf for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:19 -0500 Received: from coquelicot-s.easter-eggs.com ([213.215.37.94]:49755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXAkS-0003EQ-QK for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:17 -0500 In-Reply-To: (Carsten Dominik's message of "Fri, 24 Dec 2010 17:33:41 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Matt Lundin , emacs-orgmode@gnu.org --===============0560963378== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Always-return-refreshed-category.patch Content-Transfer-Encoding: quoted-printable From=203821f60475b20df92ad21afc7604b4c7f0c3d9bb Mon Sep 17 00:00:00 2001 From: Julien Danjou 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 =2D-- 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 =2D-- 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 =2D (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 =2D-- 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)) =2D cat (or (org-get-category) =2D (progn (org-refresh-category-properties) =2D (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 =2D-- 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*"))) =2D (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 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -8142,7 +8142,10 @@ call CMD." =20 (defun org-get-category (&optional pos) "Get the category applying to position POS." =2D (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))))) =20 (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 =2D (file-name-nondirectory buffer-file-name)) =2D "???")) + (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 avoi= ded." 'add_times)) props)) (unless (assoc "CATEGORY" props) =2D (setq value (or (org-get-category) =2D (progn (org-refresh-category-properties) =2D (org-get-category)))) =2D (push (cons "CATEGORY" value) props)) + (push (cons "CATEGORY" (org-get-category)) props)) (append sum-props (nreverse props))))))) =20 (defun org-entry-get (pom property &optional inherit literal-nil) @@ -15702,7 +15701,6 @@ When a buffer is unmodified, it is just killed. Wh= en modified, it is saved (set-buffer (org-get-agenda-file-buffer file))) (widen) (setq bmp (buffer-modified-p)) =2D (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 =2D-=20 1.7.2.3 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sorry for the mess. :) =2D-=20 Julien Danjou =E2=9D=B1 http://julien.danjou.info --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk0YcM0ACgkQpGK1HsL+5c3yGwCeKo96LntGH06i+muekscLi3m4 HkYAoJ4hxdG3fydpaBVMAGaCPY0i739g =TV43 -----END PGP SIGNATURE----- --==-=-=-- --===============0560963378== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0560963378==--