From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Steven E. Harris" Subject: Problem with org-agenda-align-tags (patch supplied) Date: Sat, 26 Jul 2008 10:41:30 -0400 Message-ID: <83ej5gwvvp.fsf@torus.sehlabs.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KMkxz-0003nL-Ir for emacs-orgmode@gnu.org; Sat, 26 Jul 2008 10:41:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KMkxy-0003mx-1S for emacs-orgmode@gnu.org; Sat, 26 Jul 2008 10:41:51 -0400 Received: from [199.232.76.173] (port=45703 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMkxx-0003mu-Qg for emacs-orgmode@gnu.org; Sat, 26 Jul 2008 10:41:49 -0400 Received: from main.gmane.org ([80.91.229.2]:44854 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KMkxx-0000l3-Ei for emacs-orgmode@gnu.org; Sat, 26 Jul 2008 10:41:49 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KMkxr-00084o-Fz for emacs-orgmode@gnu.org; Sat, 26 Jul 2008 14:41:44 +0000 Received: from c-24-131-239-140.hsd1.pa.comcast.net ([24.131.239.140]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Jul 2008 14:41:43 +0000 Received: from seh by c-24-131-239-140.hsd1.pa.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Jul 2008 14:41:43 +0000 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: emacs-orgmode@gnu.org --=-=-= Midway through function `org-agenda-align-tags', there's a call to `add-text-properties' that attempts to take an existing text property and add symbols `org-tag' and `face' to it. Since around org-mode version 5.17 or so, I've noticed problems with the lists formed there -- particularly on XEmacs 21.4.21 (Cygwin build). Sometimes the existing text property already contains the symbol `org-tag'. Sometimes the existing text property is already a list; sometimes it's just an atom. I'm guessing the intent of the forms in `org-agenda-align-tags' is ensure that `org-tag' is part of the text properties; if it's already there, we should leave it there. Toward that end, I've found the following change makes things work as expected. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Conditionally-add-symbol-org-tag-only-when-it-s-no.patch >From 80515d825ed6b619008df9afaffc4cc0f925f754 Mon Sep 17 00:00:00 2001 From: Steven E. Harris Date: Fri, 25 Jul 2008 20:24:08 -0400 Subject: [PATCH] Conditionally add symbol `org-tag' only when it's not already part of the text properties. --- lisp/org-agenda.el | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 9a7ed8b..33c2a39 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4768,8 +4768,12 @@ the new TODO state." (if line (point-at-eol) nil) t) (add-text-properties (match-beginning 2) (match-end 2) - (list 'face (delq nil (list 'org-tag (get-text-property - (match-beginning 2) 'face))))) + (list 'face (delq nil (adjoin 'org-tag + (let ((prop (get-text-property + (match-beginning 2) 'face))) + (if (listp prop) + prop + (list prop))))))) (setq l (- (match-end 2) (match-beginning 2)) c (if (< org-agenda-tags-column 0) (- (abs org-agenda-tags-column) l) -- 1.5.6 --=-=-= Rather than unconditionally prepending `org-tag' to the existing text property, I used `adjoin' here. Also, since the text property is sometimes a list and sometimes just an atom, I make sure that we make an atom into a list before feeding it to `adjoin'. I've been applying this same change to the source every time I upgrade org-mode. Since the last time, I can see that there was a change here to strip nil property elements, but I'm guessing not too many others have seen the same problem with malformed text property lists. Please let me know if anyone would like more detail on the malformed text property lists I've seen arise without this patch in place. -- Steven E. Harris --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--