Subject: Re: bug#7966: 23.1.50; bold property, dark background, and defface

From: Glenn Morris <[email-masked]>
Date: Fri, 04 Feb 2011 14:02:35 -0500

"Jose F. Morales" wrote:

> BTW, I have checked that the font-locking part of many .el files still
> use the old ":bold t" (e.g., org-mode), and so, are misbehaving.

I would change them all to use :weight, but I imagine it's because they
want to be compatible with old Emacs versions, sigh.

Can the use of :bold and :italic at least be declared obsolete?

Anyway, here is a possible fix. I would appreciate comments from people
who understand the face code.

I wonder if this issue affects anything else. I also tried adding bold
and italic to face-attribute-name-alist, and changing
internal-get-lisp-face-attribute; but that seemed to cause problems.

=== modified file 'lisp/faces.el'
*** lisp/faces.el	2011-02-03 06:55:48 +0000
--- lisp/faces.el	2011-02-04 18:53:56 +0000
***************
*** 1605,1617 ****
  is used.  If nil or omitted, use the selected frame."
    (unless frame
      (setq frame (selected-frame)))
!   (let ((list face-attribute-name-alist)
! 	(match t))
      (while (and match (not (null list)))
        (let* ((attr (car (car list)))
  	     (specified-value
! 	      (if (plist-member attrs attr)
! 		  (plist-get attrs attr)
  		'unspecified))
  	     (value-now (face-attribute face attr frame)))
  	(setq match (equal specified-value value-now))
--- 1605,1631 ----
  is used.  If nil or omitted, use the selected frame."
    (unless frame
      (setq frame (selected-frame)))
!   (let* ((list face-attribute-name-alist)
! 	 (match t)
! 	 (bold (and (plist-member attrs :bold)
! 		    (not (plist-member attrs :weight))))
! 	 (italic (and (plist-member attrs :italic)
! 		      (not (plist-member attrs :slant))))
! 	 (plist (if (or bold italic)
! 		    (copy-sequence attrs)
! 		  attrs)))
!     ;; Handle the Emacs 20 :bold and :italic properties.
!     (if bold
! 	(plist-put plist :weight (if bold 'bold 'normal)))
!     (if italic
! 	(plist-put plist :slant (if italic 'italic 'normal)))
      (while (and match (not (null list)))
        (let* ((attr (car (car list)))
  	     (specified-value
! 	      (if (plist-member plist attr)
! 		  (plist-get plist attr)
  		'unspecified))
  	     (value-now (face-attribute face attr frame)))
  	(setq match (equal specified-value value-now))