* Faces interaction between org-mode and emacs24
@ 2012-08-18 17:24 Jay McCarthy
2012-08-19 15:13 ` Bastien
0 siblings, 1 reply; 4+ messages in thread
From: Jay McCarthy @ 2012-08-18 17:24 UTC (permalink / raw)
To: emacs-orgmode
I recently upgraded from emacs23 to emacs24, using the current git
version of org-mode with both (current = e4c4d85). I am now
experiencing something odd.
If I open up the org-agenda to see my TODOs, the node titles are
colored one way (red for late, gray for future, etc). I have this
color setup using the org-agenda-before-sorting-filter-function
variable, it basically looks at the deadline time and then calls
put-text-property to give the text a new 'face property. You can see
the code here:
https://github.com/jeapostrophe/exp/blob/master/.emacs.el#L627 (it
goes to about line 736)
This worked great in emacs23. But now with emacs24, the colors are
only correct when I first start emacs and load the agenda the first
time. If I ever go to visit a TODO item in the org buffer (for
example, by pressing <Tab>) then the color of the item from the org
buffer appears in the agenda. For example, if something is one level
deep (*) then it becomes blue-ish, even though my filtering function
has change the face to be red.
If I put my cursor in the org-buffer on the item and describe its
text-properties, then I get the face to be, for example 'org-level-6,
but if I go to the org-agenda and put my cursor on the text, I see
that the face is 'due (what it is supposed to be)
Even stranger, if I am in the org-agenda and turn OFF column mode
(org-columns), then I see the "correct" colors of all the items. It is
just in column mode that I see the colors from the org buffer.
I was able to fix this with the following patch:
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index ff75af6..bee908b 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -150,6 +150,8 @@ This is the compiled version of the format.")
"Create a new column overlay and add it to the list."
(let ((ov (make-overlay beg end)))
(overlay-put ov 'face (or face 'secondary-selection))
+ (remove-text-properties
+ 0 (length string) '(face nil) string)
(org-overlay-display ov string face)
(push ov org-columns-overlays)
ov))
Basically, it removes whatever face was on the string that the column
is made out of before it creates the overlay, otherwise the face for
the column doesn't get applied.
I have no idea if this is a good solution overall, but I got it
work... and maybe others will have a similar problem.
Jay
--
Jay McCarthy <jay@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Faces interaction between org-mode and emacs24
2012-08-18 17:24 Faces interaction between org-mode and emacs24 Jay McCarthy
@ 2012-08-19 15:13 ` Bastien
2012-08-20 15:22 ` Jay McCarthy
0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2012-08-19 15:13 UTC (permalink / raw)
To: Jay McCarthy; +Cc: emacs-orgmode
Hi Jay,
Jay McCarthy <jay.mccarthy@gmail.com> writes:
> I recently upgraded from emacs23 to emacs24, using the current git
> version of org-mode with both (current = e4c4d85). I am now
> experiencing something odd.
>
> If I open up the org-agenda to see my TODOs, the node titles are
> colored one way (red for late, gray for future, etc). I have this
> color setup using the org-agenda-before-sorting-filter-function
> variable, it basically looks at the deadline time and then calls
> put-text-property to give the text a new 'face property. You can see
> the code here:
>
> https://github.com/jeapostrophe/exp/blob/master/.emacs.el#L627 (it
> goes to about line 736)
>
> This worked great in emacs23. But now with emacs24, the colors are
> only correct when I first start emacs and load the agenda the first
> time. If I ever go to visit a TODO item in the org buffer (for
> example, by pressing <Tab>) then the color of the item from the org
> buffer appears in the agenda. For example, if something is one level
> deep (*) then it becomes blue-ish, even though my filtering function
> has change the face to be red.
I assume the above is with column-mode turned on, right?
...
> If I put my cursor in the org-buffer on the item and describe its
> text-properties, then I get the face to be, for example 'org-level-6,
> but if I go to the org-agenda and put my cursor on the text, I see
> that the face is 'due (what it is supposed to be)
>
> Even stranger, if I am in the org-agenda and turn OFF column mode
> (org-columns), then I see the "correct" colors of all the items. It is
> just in column mode that I see the colors from the org buffer.
>
> I was able to fix this with the following patch:
... otherwise I don't see why just fixing `org-columns-new-overlay'
should fix the first situation you describe.
I under the idea behind the patch but I'd like to make sure there is
nothing more than this. Perhaps a simple reproducible example?
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Faces interaction between org-mode and emacs24
2012-08-19 15:13 ` Bastien
@ 2012-08-20 15:22 ` Jay McCarthy
2012-08-21 18:10 ` Bastien
0 siblings, 1 reply; 4+ messages in thread
From: Jay McCarthy @ 2012-08-20 15:22 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
Yes, it was under column mode.
I tried in vain to make a small example but my emacs-fu is not strong
enough. Attached is what I started to do...
Jay
On Sun, Aug 19, 2012 at 9:13 AM, Bastien <bzg@altern.org> wrote:
> Hi Jay,
>
> Jay McCarthy <jay.mccarthy@gmail.com> writes:
>
>> I recently upgraded from emacs23 to emacs24, using the current git
>> version of org-mode with both (current = e4c4d85). I am now
>> experiencing something odd.
>>
>> If I open up the org-agenda to see my TODOs, the node titles are
>> colored one way (red for late, gray for future, etc). I have this
>> color setup using the org-agenda-before-sorting-filter-function
>> variable, it basically looks at the deadline time and then calls
>> put-text-property to give the text a new 'face property. You can see
>> the code here:
>>
>> https://github.com/jeapostrophe/exp/blob/master/.emacs.el#L627 (it
>> goes to about line 736)
>>
>> This worked great in emacs23. But now with emacs24, the colors are
>> only correct when I first start emacs and load the agenda the first
>> time. If I ever go to visit a TODO item in the org buffer (for
>> example, by pressing <Tab>) then the color of the item from the org
>> buffer appears in the agenda. For example, if something is one level
>> deep (*) then it becomes blue-ish, even though my filtering function
>> has change the face to be red.
>
> I assume the above is with column-mode turned on, right?
>
> ...
>
>> If I put my cursor in the org-buffer on the item and describe its
>> text-properties, then I get the face to be, for example 'org-level-6,
>> but if I go to the org-agenda and put my cursor on the text, I see
>> that the face is 'due (what it is supposed to be)
>>
>> Even stranger, if I am in the org-agenda and turn OFF column mode
>> (org-columns), then I see the "correct" colors of all the items. It is
>> just in column mode that I see the colors from the org buffer.
>>
>> I was able to fix this with the following patch:
>
> ... otherwise I don't see why just fixing `org-columns-new-overlay'
> should fix the first situation you describe.
>
> I under the idea behind the patch but I'd like to make sure there is
> nothing more than this. Perhaps a simple reproducible example?
>
> Thanks!
>
> --
> Bastien
--
Jay McCarthy <jay@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93
[-- Attachment #2: faces.el --]
[-- Type: application/octet-stream, Size: 1131 bytes --]
(setq load-path (cons "~/Dev/dist/org-mode/lisp" load-path))
(setq load-path (cons "~/Dev/dist/org-mode/contrib/lisp" load-path))
(add-to-list 'Info-default-directory-list
(expand-file-name "~/Dev/dist/org-mode/doc"))
(require 'org-install)
(require 'org)
(require 'org-faces)
(setq org-directory "~/Dev/dist/org-mode/errors/faces/")
(setq org-agenda-files (list org-directory))
(setq org-agenda-before-sorting-filter-function 'todo-colorize)
(setq org-agenda-custom-commands
'(("t" "Todo list" todo "TODO"
())))
(defface due
(org-compatible-face 'default
'((t (:foreground "#000000"))))
"Face for due items"
:group 'org-faces)
(set-face-foreground 'due "#dc322f")
(defun todo-colorize (a)
(let* ()
;; Remove the TODO
(put-text-property
0 (length a)
'txt
(replace-regexp-in-string "^TODO *" "" (get-text-property 0 'txt a))
a)
;; Remove the old face
(remove-text-properties 0 (length a) '((face nil) (fontified nil)) a)
;; Put on the new face
(put-text-property 0 (length a) 'face 'due a)
a))
(org-agenda "" "t")
(org-agenda-columns)
[-- Attachment #3: faces.org --]
[-- Type: application/octet-stream, Size: 116 bytes --]
* TODO First
** TODO Second
*** TODO Third
**** TODO Fourth
***** TODO Fifth
****** TODO Sixth
******* TODO Seventh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Faces interaction between org-mode and emacs24
2012-08-20 15:22 ` Jay McCarthy
@ 2012-08-21 18:10 ` Bastien
0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-08-21 18:10 UTC (permalink / raw)
To: Jay McCarthy; +Cc: emacs-orgmode
Hi Jay,
Jay McCarthy <jay.mccarthy@gmail.com> writes:
> Yes, it was under column mode.
Okay, thanks...
> I tried in vain to make a small example but my emacs-fu is not strong
> enough. Attached is what I started to do...
I applied your patch. Thanks for hunting this!
--
Bastien
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-21 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18 17:24 Faces interaction between org-mode and emacs24 Jay McCarthy
2012-08-19 15:13 ` Bastien
2012-08-20 15:22 ` Jay McCarthy
2012-08-21 18:10 ` Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.