emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with org-agenda-align-tags (patch supplied)
@ 2008-07-26 14:41 Steven E. Harris
  2008-07-26 14:51 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Steven E. Harris @ 2008-07-26 14:41 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Conditionally-add-symbol-org-tag-only-when-it-s-no.patch --]
[-- Type: text/x-patch, Size: 1237 bytes --]

From 80515d825ed6b619008df9afaffc4cc0f925f754 Mon Sep 17 00:00:00 2001
From: Steven E. Harris <seh@panix.com>
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


[-- Attachment #3: Type: text/plain, Size: 688 bytes --]


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

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Problem with org-agenda-align-tags (patch supplied)
  2008-07-26 14:41 Problem with org-agenda-align-tags (patch supplied) Steven E. Harris
@ 2008-07-26 14:51 ` Carsten Dominik
  2008-07-26 14:57   ` Steven E. Harris
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2008-07-26 14:51 UTC (permalink / raw)
  To: Steven E. Harris; +Cc: emacs-orgmode

Hi Steven,

thanks for the patch, I have applied it.

I am curious:  How did you notice this, i.e. under what circumstances
does this cause a problem?

- Carsten

On Jul 26, 2008, at 7:41 AM, Steven E. Harris wrote:

> 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.
>
> From 80515d825ed6b619008df9afaffc4cc0f925f754 Mon Sep 17 00:00:00 2001
> From: Steven E. Harris <seh@panix.com>
> 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
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with org-agenda-align-tags (patch supplied)
  2008-07-26 14:51 ` Carsten Dominik
@ 2008-07-26 14:57   ` Steven E. Harris
  0 siblings, 0 replies; 3+ messages in thread
From: Steven E. Harris @ 2008-07-26 14:57 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@uva.nl> writes:

> I am curious: How did you notice this, i.e. under what circumstances
> does this cause a problem?

When I change the state of a task using C-c C-t or C-u C-t C-t, either
in an agenda view or just in one of the task trees, I see this pop up
occasionally. I wonder if maybe XEmacs does more manipulation of text
properties, such as turning single-item lists into atoms, or the
converse, and maybe it's more fickle about what one can feed to
`add-text-properties'.

-- 
Steven E. Harris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-26 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-26 14:41 Problem with org-agenda-align-tags (patch supplied) Steven E. Harris
2008-07-26 14:51 ` Carsten Dominik
2008-07-26 14:57   ` Steven E. Harris

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).