From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Agenda view > Face for deadlines > PATCH Date: Fri, 21 May 2010 16:37:40 +0200 Message-ID: <8E1C97F0-8A90-4C39-A0A5-A2146E875795@gmail.com> References: <87vdasfb1w.fsf@mundaneum.com> <87r5l94ozf.fsf@mundaneum.com> <87d3wrh82w.fsf_-_@mundaneum.com> <877hmxaedn.fsf@mundaneum.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=35266 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFTMJ-0002ZK-UG for emacs-orgmode@gnu.org; Fri, 21 May 2010 10:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFTMD-0003uM-8L for emacs-orgmode@gnu.org; Fri, 21 May 2010 10:37:55 -0400 Received: from ey-out-1920.google.com ([74.125.78.149]:1883) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFTM8-0003tg-FU for emacs-orgmode@gnu.org; Fri, 21 May 2010 10:37:48 -0400 Received: by ey-out-1920.google.com with SMTP id 13so233831eye.34 for ; Fri, 21 May 2010 07:37:43 -0700 (PDT) In-Reply-To: <877hmxaedn.fsf@mundaneum.com> 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: =?ISO-8859-1?Q?S=E9bastien_Vauban?= Cc: emacs-orgmode@gnu.org On May 21, 2010, at 9:43 AM, S=E9bastien Vauban wrote: > Hi all, > > S=E9bastien Vauban wrote: >> S=E9bastien Vauban wrote: >>> In the same kind of thought, trying to enhance the way we (or I) =20 >>> visualize >>> tasks in the agenda, I have chosen some sort of "inverse video" =20 >>> face for >>> deadlines. >>> >>> (my-org-deadline-yesterday ((t (:foreground "white" :background =20 >>> "#D80000" :weight bold)))) >>> (my-org-deadline-today ((t (:foreground "white" :background =20 >>> "#E9A36A" :weight bold)))) >>> (my-org-deadline-tomorrow ((t (:foreground "black" :background =20 >>> "#B4F1B3" :weight bold)))) >>> (my-org-deadline-later ((t (:foreground "black" :background =20 >>> "#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 =20 >>> _________________________________________________________________ >>> Personal: 17:15-17:20 =20 >>> Sarah! :home::errands: >>> refile: Sched. 2x: TODO [#A] Update reservations =20 >>> Scorpios :refile:: >>> x Family: xxx In -1 d.: TODO [#A] Photos-reportage Andre =20 >>> 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 =20= >>> of >>> `Family', in my example) not to be "impacted" by that face. =20 >>> Otherwise, when >>> in inverse video, they obfuscate the view of the day separators =20 >>> and of the >>> deadline lines. >> >> I was so disturbed by this, and have always wanted to become (and =20 >> still >> wants) enlightened in Emacs Lisp and in Org's code that I finally =20 >> 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, =20 >> either, >> because of lack of knowledge, on ELisp and on how to trace through =20= >> the code. >> >> Though, I've been able to answer my own demand, by adding a =20 >> function (code >> stolen from `org-compat.el'): >> >> (defun org-add-props-from-2 (string plist &rest props) >> "Add text properties to string, from position 2 to end. >> PLIST may be a list of properties, PROPS are individual properties =20= >> and values >> that will be added to PLIST. Returns the string that was modified." >> (add-text-properties >> 2 (length string) (if props (append plist props) plist) string) >> string) >> >> and changing one line 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 =20= > observed > that entering RET on such lines (where the 2 first characters are not > highlighted anymore) does not work anymore: "command not allowed on =20= > 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 =20 origin of this entry. Org tries to find this property at the =20 beginning of the line and does not find it. You would have to apply all properties to the full line, then remove =20 the face property from the first two characters. However, I am not sure if this will work, because when one of these =20 lines changes, Org might spread the text properties again over the =20 full line. But maybe it will be OK, try it out. - Carsten