emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* `invalid face reference nil` caused by `org-agenda-fontify-properties`
@ 2015-05-10  6:41 Keith David Bershatsky
  2015-05-10  7:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Keith David Bershatsky @ 2015-05-10  6:41 UTC (permalink / raw)
  To: emacs-orgmode

I had a little free time today and was finally able to track down the invalid face reference when generating an org-agenda buffer.  It is caused because the `car` of the `cons` cell created by `org-agenda-fontify-properties` is sometimes `nil`.  I threw in `bold` as a catch-all and the error is gone.

On a different note, the help mode buffer (C-u C-x =) doesn't seem to be able to follow the link of the cons cell to the face in the source code -- this should also be fixed (but I don't have a solution for that today).

(defun org-agenda-fontify-priorities ()
  "Make highest priority lines bold, and lowest italic."
  (interactive)
  (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority)
      (delete-overlay o)))
  (overlays-in (point-min) (point-max)))
  (save-excursion
    (let (b e p ov h l)
      (goto-char (point-min))
      (while (re-search-forward "\\[#\\(.\\)\\]" nil t)
  (setq h (or (get-char-property (point) 'org-highest-priority)
        org-highest-priority)
        l (or (get-char-property (point) 'org-lowest-priority)
        org-lowest-priority)
        p (string-to-char (match-string 1))
        b (match-beginning 0)
        e (if (eq org-agenda-fontify-priorities 'cookies)
        (match-end 0)
      (point-at-eol))
        ov (make-overlay b e))
  (overlay-put
   ov 'face
   (cons
     (cond
       ((org-face-from-face-or-color
                'priority nil
                (cdr (assoc p org-priority-faces))))
       ((and (listp org-agenda-fontify-priorities)
              (org-face-from-face-or-color
               'priority nil
               (cdr (assoc p org-agenda-fontify-priorities)))))
       ((equal p l) 'italic)
       ((equal p h) 'bold)
       (t 'bold)) ;; Here is a temporary fix!
     'org-priority))
  (overlay-put ov 'org-type 'org-priority)))))

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Emacs  : GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2014-10-01 on MP.local
Package: Org-mode version 8.2.6 (release_8.2.6-1 @ /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/org/)

current state:
==============
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe
		      org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
			  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-startup-folded nil
 org-support-shift-select 'always
 org-agenda-custom-commands '(("1" "Events" agenda
			       "excludes:  * Active | * Next Action"
			       ((org-agenda-span (quote month))
				(org-agenda-time-grid nil)
				(org-agenda-outline-show-all-dates nil)
				(org-agenda-entry-types (quote (:deadline)))
				(org-agenda-skip-function
				 (quote
				  (org-agenda-skip-entry-if (quote regexp)
				   "\\* Active\\|\\* Next Action")
				  )
				 )
				(org-deadline-warning-days 0))
			       )
			      ("2"
			       "TODAY:  Events (week) + Tasks (day) + Undated (all)"
			       ((agenda
				 
										       "Events"
				 
										       ((org-agenda-span
											 
											 
											 
												  
													 (quote week)
											 
											 
											 
												  
													 )
											
											
											
												 
													(org-agenda-time-grid nil)
											
											
											
												 
													(org-agenda-outline-show-all-dates nil)
											
											
											
												 
													(org-agenda-entry-types
													 
													 
													 
													 
													 (quote
													  
													  
													  
													  
													  
													  
													  
													  
													  
																 (:deadline)
													  
													  
													  
													  
													  
													  
													  
													  
													  
																 )
													 
													 
													 
													 
													 )
											
											
											
												 
													(org-agenda-skip-function
													 
													 
													 
													 
													 (quote
													  
													  
													  
													  
													  
													  
													  
													  
													  
																   (org-agenda-skip-entry-if
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																	  (quote notregexp)
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																    
																	  "\\* Reference\\|\\* Delegated")
													  
													  
													  
													  
													  
													  
													  
													  
													  
																   )
													 
													 
													 
													 
													 )
											
											
											
												 
													(org-deadline-warning-days 0)
											
											
											
												 
													)
				 
										       )
				
										      (agenda
										       
										       "Tasks"
										       
										       ((org-agenda-time-grid nil)
											
											
											
											
												
												       (org-agenda-outline-show-all-dates nil)
											
											
											
											
												
												       (org-agenda-span
													
													
													
													
													
													(quote week)
													
													
													
													
													
													)
											
											
											
											
												
												       (org-agenda-entry-types
													
													
													
													
													
													(quote
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																(:deadline)
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																)
													
													
													
													
													
													)
											
											
											
											
												
												       (org-agenda-skip-function
													
													
													
													
													
													(quote
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																  (org-agenda-skip-entry-if
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																	 (quote regexp)
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																   
																	 "\\* Reference|\\* Delegated")
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																  )
													
													
													
													
													
													)
											
											
											
											
												
												       (org-deadline-warning-days 0)
											
											
											
											
												
												       (org-agenda-sorting-strategy
													
													
													
													
													
													(quote
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																     ((agenda time-up)
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																      
																	    )
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																     )
													
													
													
													
													
													)
											
											
											
											
												
												       )
										       
										       )
				
										      (todo
										       
										       "Someday"
										       
										       ((org-agenda-sorting-strategy
											 
											 
											 
											 
												   
													(quote
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																     (alpha-up)
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
													 
																     )
											 
											 
											 
											 
												   
													)
											
											
											
											
												  
												       )
										       
										       )
				
										      )
			       )
			      ("3" "SNAP -- Events + Tasks + Undated"
			       ((agenda "Events"
				 ((org-agenda-span (quote month))
				  (org-agenda-outline-show-all-dates nil)
				  (org-agenda-entry-types (quote (:deadline)))
				  (org-agenda-skip-function
				   (quote
				    (org-agenda-skip-entry-if (quote notregexp)
				     "\\* Reference|\\* Delegated")
				    )
				   )
				  (org-deadline-warning-days 0))
				 )
				(agenda "Tasks"
				 ((org-agenda-span (quote month))
				  (org-agenda-outline-show-all-dates nil)
				  (org-agenda-entry-types (quote (:deadline)))
				  (org-agenda-skip-function
				   (quote
				    (org-agenda-skip-entry-if (quote regexp)
				     "\\* Reference|\\* Delegated")
				    )
				   )
				  (org-deadline-warning-days 0)
				  (org-agenda-sorting-strategy
				   (quote ((agenda time-up))))
				  )
				 )
				(todo "Someday"
				 ((org-agenda-sorting-strategy (quote (alpha-up)))))
				)
			       )
			      ("4" "ALL -- everything"
			       ((todo "Reference|Delegated"
				 ((org-agenda-sorting-strategy (quote (time-up)))))
				(todo "Active|Next Action"
				 ((org-agenda-sorting-strategy
				   (quote (todo-state-up time-up)))
				  )
				 )
				(todo "Someday"
				 ((org-agenda-sorting-strategy (quote (alpha-up)))))
				(todo "None"
				 ((org-agenda-sorting-strategy (quote (alpha-up)))))
				)
			       )
			      ("y" "365 Days (without undated)" agenda "Year View"
			       ((org-agenda-span 365)
				(org-agenda-entry-types
				 (quote (:deadline :scheduled)))
				(org-deadline-warning-days 0)
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				(org-agenda-time-grid nil))
			       )
			      ("u" alltodo "Undated TODOs"
			       ((org-agenda-skip-function
				 (lambda nil
				  (org-agenda-skip-entry-if (quote scheduled)
				   (quote deadline) (quote regexp) "<[^>\n]+>")
				  )
				 )
				(org-agenda-overriding-header
				 "Undated TODO entries: ")
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				)
			       )
			      ("P" . "Priority views")
			      ("pa" "#A" agenda "Priority #A"
			       ((org-agenda-entry-types (quote (:deadline)))
				(org-agenda-span (quote year))
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				(org-agenda-skip-function
				 (quote
				  (org-agenda-skip-entry-if (quote notregexp)
				   "\\[#A\\]")
				  )
				 )
				)
			       )
			      ("pb" "#B" agenda "Priority #B"
			       ((org-agenda-entry-types (quote (:deadline)))
				(org-agenda-span (quote year))
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				(org-agenda-skip-function
				 (quote
				  (org-agenda-skip-entry-if (quote notregexp)
				   "\\[#B\\]")
				  )
				 )
				)
			       )
			      ("pc" "#C" agenda "Priority #C"
			       ((org-agenda-entry-types (quote (:deadline)))
				(org-agenda-span (quote year))
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				(org-agenda-skip-function
				 (quote
				  (org-agenda-skip-entry-if (quote notregexp)
				   "\\[#C\\]")
				  )
				 )
				)
			       )
			      ("pd" "#D" agenda "Priority #D"
			       ((org-agenda-entry-types (quote (:deadline)))
				(org-agenda-span (quote year))
				(org-agenda-sorting-strategy
				 (quote ((agenda alpha-up priority-down time-up))))
				(org-agenda-skip-function
				 (quote
				  (org-agenda-skip-entry-if (quote notregexp)
				   "\\[#D\\]")
				  )
				 )
				)
			       )
			      ("9" . "Context List")
			      ("lh" "Home" ((tags-todo "@home/GOING|PAUSE|TODO")))
			      ("le" "Errands"
			       ((tags-todo "@errands/GOING|PAUSE|TODO")))
			      ("lc" "Computer"
			       ((tags-todo "@computer/GOING|PAUSE|TODO")))
			      ("lp" "Phone" ((tags-todo "@phone/GOING|PAUSE|TODO")))
			      ("lm" "Message"
			       ((tags-todo "@message/GOING|PAUSE|TODO")))
			      ("lr" "Reading"
			       ((tags-todo "@reading/GOING|PAUSE|TODO")))
			      ("b" "Balance"
			       ((agenda ""
				 ((org-agenda-skip-function
				   (quote (my-skip-by-tags "owner")))
				  (org-agenda-overriding-header "Fun: "))
				 )
				(agenda ""
				 ((org-agenda-skip-function
				   (quote (my-skip-by-tags "DUTY")))
				  (org-agenda-overriding-header "Duty: "))
				 )
				(agenda ""
				 ((org-agenda-skip-function
				   (quote (my-skip-by-tags "STUDIUM")))
				  (org-agenda-overriding-header "Studium: "))
				 )
				)
			       )
			      ("i" "Inbox" tags "inbox-CONTAINER=\"true\"")
			      ("r" "Review"
			       ((agenda ""
				 ((org-agenda-span (quote day))
				  (org-agenda-sorting-strategy
				   (quote ((agenda time-up priority-down tag-up))))
				  (org-deadline-warning-days 0)
				  (org-agenda-skip-deadline-if-done nil)
				  (org-agenda-skip-timestamp-if-done nil)
				  (org-agenda-skip-scheduled-if-done nil))
				 )
				(todo "GOING|PAUSE|TODO"))
			       )
			      ("5" todo "DONE|DEFD|CNCL" nil)
			      ("6" "My agenda"
			       ((org-agenda-list) (sacha/org-agenda-load)))
			      ("7" agenda "Today's Tasks Priority #A *BETA*"
			       ((org-agenda-skip-function
				 (lambda nil
				  (org-agenda-skip-entry-if (quote notregexp)
				   "\\=.*\\[#A\\]")
				  )
				 )
				(org-agenda-ndays 1)
				(org-agenda-overriding-header
				 "Today's Priority #A tasks: ")
				)
			       )
			      ("8" "Maybe"
			       ((todo "WAITING|LATER") (todo "SOMEDAY"))
			       ((org-agenda-todo-ignore-with-date nil)))
			      )
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\<lawlist\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
		     org-src-mode-configure-edit-buffer)
 org-tags-column 0
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '((lambda nil (hl-mode 1) (ws-mode 1) (ln-mode 1)
		  (lawlist-font-lock-mode 1))
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-show-block-all append
		    local]
		   5]
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-babel-show-result-all
		    append local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes ml-update-fn)
 org-use-speed-commands t
 org-agenda-time-grid '((daily weekly today required-time)
			#("--------------------" 0 20 (org-heading t))
			(0 800 1000 1200 1400 1600 1800 2000 2200))
 org-agenda-file-regexp "\\`[^.].*\\.org\\|\\.todo\\|\\.done\\'"
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
		  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
		  org-optimize-window-after-visibility-change)
 org-todo-keywords '((sequence "Active(a)" "Next Action(n)" "Canceled(c)" "Hold(h)"
		      "Reference(r)" "Delegated(d)" "Waiting(w)" "Postponed(P)"
		      "Someday(s)" "Planning(p)" "|" "None(N)")
		     )
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-agenda-mode-hook '((lambda nil) ml-update-fn)
 org-agenda-files '("/Users/HOME/.0.data/.0.emacs/")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-tag-alist '((:startgroup) ("event" . 69) ("task" . 84) ("contact" . 67)
		 ("undated" . 85) ("done" . 68) (:endgroup) ("lawlist" . 48)
		 ("home" . 104) ("work" . 119))
 )

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-10  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-10  6:41 `invalid face reference nil` caused by `org-agenda-fontify-properties` Keith David Bershatsky
2015-05-10  7:16 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).