From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Subject: Re: Agenda view > Face for deadlines > PATCH Date: Mon, 12 Jul 2010 23:02:25 +0200 Message-ID: <87sk3o76se.fsf@mundaneum.com> References: <87vdasfb1w.fsf@mundaneum.com> <87r5l94ozf.fsf@mundaneum.com> <87d3wrh82w.fsf_-_@mundaneum.com> <877hmxaedn.fsf@mundaneum.com> <8E1C97F0-8A90-4C39-A0A5-A2146E875795@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: 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-mXXj517/zsQ@public.gmane.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Carsten, Carsten Dominik wrote: > On May 21, 2010, at 9:43 AM, S=C3=A9bastien Vauban wrote: >> S=C3=A9bastien Vauban wrote: >>> S=C3=A9bastien Vauban wrote: >>>> In the same kind of thought, trying to enhance the way we (or I) visua= lize >>>> tasks in the agenda, I have chosen some sort of "inverse video" face f= or >>>> deadlines. >>>> >>>> (my-org-deadline-yesterday ((t (:foreground "white" :background "#D800= 00" >>>> :weight bold)))) >>>> (my-org-deadline-today ((t (:foreground "white" :background "#E9A36A" >>>> :weight bold)))) >>>> (my-org-deadline-tomorrow ((t (:foreground "black" :background "#B4F1B= 3" >>>> :weight bold)))) >>>> (my-org-deadline-later ((t (:foreground "black" :background "#AACAFC")= ))) >>>> >>>> with the following code in my .emacs file: >>>> >>>> ;; faces for showing deadlines in the agenda >>>> (setq org-agenda-deadline-faces >>>> '((1.01 . my-org-deadline-yesterday) >>>> (0.99 . my-org-deadline-today) >>>> (0.49 . my-org-deadline-tomorrow) >>>> (0.00 . my-org-deadline-later))) >>>> >>>> The result is the following: >>>> >>>> Week-agenda (W20-W21): >>>> 2010-05-18 Tue >>>> _________________________________________________________________ >>>> Personal: 17:15-17:20 Sarah! :home= ::errands: >>>> refile: Sched. 2x: TODO [#A] Update reservations Scorpios = :refile:: >>>> x Family: xxx In -1 d.: TODO [#A] Photos-reportage Andre xxxx :home:= :computer: >>>> >>>> where `xxx' is just some textual way to represent background color. >>>> >>>> For the sake of clarity, I'd like the first 2 characters (in front of >>>> `Family', in my example) not to be "impacted" by that face. Otherwise, >>>> when in inverse video, they obfuscate the view of the day separators a= nd >>>> of the deadline lines. >>> >>> I was so disturbed by this, and have always wanted to become (and still >>> wants) enlightened in Emacs Lisp and in Org's code that I finally took = the >>> time to try and understand how all this works. >>> >>> Not easy for me, I must admit. Cannot say I can follow the code, either, >>> because of lack of knowledge, on ELisp and on how to trace through the >>> code. >>> >>> Though, I've been able to answer my own demand, by [...] changing one l= ine >>> of `org-agenda.el' (L4619, function `org-agenda-get-deadlines'): >>> >>> (org-add-props txt props >>> >>> to >>> >>> (org-add-props-from-2 txt props >>> >>> Maybe that can be factored (much, much) more smartly? >>> >>> Can this be patched against the source code? >> >> After applying my patch, and playing a bit more with the results, I >> observed that entering RET on such lines (where the 2 first characters a= re >> not highlighted anymore) does not work anymore: "command not allowed on >> this line". >> >> Is there someone more knowledgeable than I am that could help? > > `props' contains a text property with the marker that points to the origi= n of > this entry. Org tries to find this property at the beginning of the lin= e and > does not find it. > > You would have to apply all properties to the full line, then remove the = face > property from the first two characters. > > However, I am not sure if this will work, because when one of these lines > changes, Org might spread the text properties again over the full line. = But > maybe it will be OK, try it out. I'm really not knowledgeable about faces, text properties, overlays, and so on. Though, I tried two things, on line 4636 of `org-agenda.el': --8<---------------cut here---------------start------------->8--- (let ((ov (make-overlay 0 2))) (overlay-put ov 'face (list :background "white")) (overlay-put ov 'evaporate t)) --8<---------------cut here---------------end--------------->8--- Nothing changed. The first 2 characters of every line still display the background face of the deadlines (red, orange or green, depending on urgenc= y). Next try (replacing the above): --8<---------------cut here---------------start------------->8--- (set-text-properties 0 2 nil txt) --8<---------------cut here---------------end--------------->8--- Here, the background color of the first 2 characters is... white, as I want. Though, "org-agenda-error: Command not allowed in this line" when clicking = on such a line... Solution still to be found... Anybody having an hint. I am willing to try to solve this. Best regards, Seb --=20 S=C3=A9bastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode