Procházet zdrojové kódy

org: Add customization to fontify TODO headlines

* lisp/org.el (org-fontify-todo-headline): Add new boolean customization to
  toggle this behavior.
* lisp/org.el (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): New face.

TINYCHANGE
Terje Larsen před 5 roky
rodič
revize
2dddaf474b
3 změnil soubory, kde provedl 40 přidání a 8 odebrání
  1. 6 0
      etc/ORG-NEWS
  2. 9 0
      lisp/org-faces.el
  3. 25 8
      lisp/org.el

+ 6 - 0
etc/ORG-NEWS

@@ -36,6 +36,12 @@ possible via column view value edit or with =<C-c C-q>=.
 See [[*~org-columns-toggle-or-columns-quit~]]
 
 ** Miscellaneous
+*** 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~.
+
 *** Exit column view with =<C-c C-c>=
 =<C-c C-c>= (almost) everywhere in a buffer exits column view.  Before
 there was only key =<q>= to exit column view and only functional on lines

+ 9 - 0
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"))

+ 25 - 8
lisp/org.el

@@ -3687,6 +3687,16 @@ 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
+  :safe t)
+
 (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.
@@ -5677,15 +5687,22 @@ 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
+	   (when org-fontify-todo-headline
+	     (list (format org-heading-keyword-regexp-format
+			   (concat
+			    "\\(?:"
+			    (mapconcat 'regexp-quote org-not-done-keywords "\\|")
+			    "\\)"))
+		   '(2 'org-headline-todo t)))
 	   ;; DONE
-	   (if org-fontify-done-headline
-	       (list (format org-heading-keyword-regexp-format
-			     (concat
-			      "\\(?:"
-			      (mapconcat 'regexp-quote org-done-keywords "\\|")
-			      "\\)"))
-		     '(2 'org-headline-done t))
-	     nil)
+	   (when org-fontify-done-headline
+	     (list (format org-heading-keyword-regexp-format
+			   (concat
+			    "\\(?:"
+			    (mapconcat 'regexp-quote org-done-keywords "\\|")
+			    "\\)"))
+		   '(2 'org-headline-done t)))
 	   ;; Priorities
 	   '(org-font-lock-add-priority-faces)
 	   ;; Tags