From mboxrd@z Thu Jan 1 00:00:00 1970 From: Terje Larsen Subject: [PATCH] Add customization to fontify TODO headlines Date: Sun, 01 Dec 2019 21:27:27 +0100 Message-ID: <871rtniyfk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42868) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibVoq-00029X-2j for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 15:27:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibVoo-0006qu-FP for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 15:27:47 -0500 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:41750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibVoo-0006qP-6W for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 15:27:46 -0500 Received: by mail-lj1-x22b.google.com with SMTP id h23so1083970ljc.8 for ; Sun, 01 Dec 2019 12:27:45 -0800 (PST) Received: from beetle (h-212-85-78-248.NA.cust.bahnhof.se. [212.85.78.248]) by smtp.gmail.com with ESMTPSA id f3sm13703256lfl.58.2019.12.01.12.27.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Dec 2019 12:27:42 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain This adds a feature similar to the org-fontify-done-headline, but instead for the TODO headlines. This is enabled with the boolean customization org-fontify-todo-headline and can be themed via the face org-headline-todo. I was missing this when I wanted to distinguish more clearly between the TODO headlines and the other headlines (more so than the highlighted TODO keyword(s)). Hope someone else finds this useful. Best regards, Terje Larsen --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-Add-customization-to-fontify-TODO-headlines.patch Content-Description: org: Add customization to fontify TODO headlines >From 57dd1fca737794f4c20d439d1fbf288511b1e44f Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Sun, 1 Dec 2019 20:20:55 +0100 Subject: [PATCH] org: Add customization to fontify TODO headlines * lisp/org (org-fontify-todo-headline): Add new boolean customization to toggle this behavior. * lisp/org (org-set-font-lock-defaults): Apply face org-headline-todo to lines starting with keywords in org-not-done-keywords. * lisp/org-faces (org-headline-todo): Add new face to customize look of todo headlines. --- etc/ORG-NEWS | 5 +++++ lisp/org-faces.el | 9 +++++++++ lisp/org.el | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 689a07871..872cebf76 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -20,6 +20,11 @@ work also for this level. In other words; defining things in a property drawer before the first headline will make them "inheritable" for all headlines. +*** Fontify whole TODO headlines +This feature is the same as =org-fontify-done-headline=, but for TODO +headlines instead. This allows you to distinguish TODO headlines from +normal headlines. The face can be customized via =org-headline-todo=. + * Version 9.3 ** Incompatible changes diff --git a/lisp/org-faces.el b/lisp/org-faces.el index a97d4dc4a..416f49b52 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -243,6 +243,15 @@ is of course immediately visible, but for example a passed deadline is of the frame, for example." :group 'org-faces) +(defface org-headline-todo ;Copied from `font-lock-string-face' + '((((class color) (min-colors 16) (background light)) (:foreground "Red4")) + (((class color) (min-colors 16) (background dark)) (:foreground "Pink2")) + (((class color) (min-colors 8) (background light)) (:bold t))) + "Face used to indicate that a headline is marked as TODO. +This face is only used if `org-fontify-todo-headline' is set. If applies +to the part of the headline after the TODO keyword." + :group 'org-faces) + (defface org-headline-done ;Copied from `font-lock-string-face' '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) diff --git a/lisp/org.el b/lisp/org.el index 20c263f74..53bc47641 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3686,6 +3686,15 @@ hide them with `org-toggle-custom-properties-visibility'." :version "24.3" :type '(repeat (string :tag "Property Name"))) +(defcustom org-fontify-todo-headline nil + "Non-nil means change the face of a headline if it is marked as TODO. +Normally, only the TODO/DONE keyword indicates the state of a headline. +When this is non-nil, the headline after the keyword is set to the +`org-headline-todo' as an additional indication." + :group 'org-appearance + :package-version '(Org . "9.4") + :type 'boolean) + (defcustom org-fontify-done-headline nil "Non-nil means change the face of a headline if it is marked DONE. Normally, only the TODO/DONE keyword indicates the state of a headline. @@ -5652,6 +5661,15 @@ needs to be inserted at a specific position in the font-lock sequence.") (list (format org-heading-keyword-regexp-format org-todo-regexp) '(2 (org-get-todo-face 2) t)) + ;; TODO + (if org-fontify-todo-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-not-done-keywords "\\|") + "\\)")) + '(2 'org-headline-todo t)) + nil) ;; DONE (if org-fontify-done-headline (list (format org-heading-keyword-regexp-format -- 2.24.0 --=-=-=--