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: Wed, 19 May 2010 23:53:27 +0200 Message-ID: <87d3wrh82w.fsf_-_@mundaneum.com> References: <87vdasfb1w.fsf@mundaneum.com> <87r5l94ozf.fsf@mundaneum.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 all, S=C3=A9bastien Vauban wrote: > In the same kind of thought, trying to enhance the way we (or I) visualize > tasks in the agenda, I have chosen some sort of "inverse video" face for > deadlines. > > (my-org-deadline-yesterday ((t (:foreground "white" :background "#D80000"= :weight bold)))) > (my-org-deadline-today ((t (:foreground "white" :background "#E9A36A" :we= ight bold)))) > (my-org-deadline-tomorrow ((t (:foreground "black" :background "#B4F1B3" = :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::e= rrands: > refile: Sched. 2x: TODO [#A] Update reservations Scorpios :r= efile:: > x Family: xxx In -1 d.: TODO [#A] Photos-reportage Andre xxxx :home::co= mputer: > > 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, wh= en in > inverse video, they obfuscate the view of the day separators and of the > deadline lines. > > Is there a way to do so? I was so disturbed by this, and have always wanted to become (and still wan= ts) 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 adding a function (code stolen from `org-compat.el'): --8<---------------cut here---------------start------------->8--- (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 and valu= es 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) --8<---------------cut here---------------end--------------->8--- and changing one line of `org-agenda.el' (L4619, function `org-agenda-get-deadlines'): --8<---------------cut here---------------start------------->8--- (org-add-props txt props --8<---------------cut here---------------end--------------->8--- to --8<---------------cut here---------------start------------->8--- (org-add-props-from-2 txt props --8<---------------cut here---------------end--------------->8--- Maybe that can be factored (much, much) more smartly? Can this be patched against the source code? 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