GNU bug report logs - #7966
23.1.50; bold property, dark background, and defface

Previous Next

Package: emacs;

Reported by: "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>

Date: Wed, 2 Feb 2011 17:34:02 UTC

Severity: normal

Found in version 23.1.50

Fixed in version 23.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7966 in the body.
You can then email your comments to 7966 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7966; Package emacs. (Wed, 02 Feb 2011 17:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 02 Feb 2011 17:34:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; bold property, dark background, and defface
Date: Wed, 2 Feb 2011 17:01:47 +0100
When defining a face color as:

    ...
    (((class color) (background light)) (:foreground "NavyBlue" :bold t))
    (((class color) (background dark)) (:foreground "Lavender" :bold t))
    ...

the face does not switch from the light to the dark setting (or
viceversa) when changing the frame background. However, it does if the
face color is defined as:

    (((class color) (background light)) (:foreground "NavyBlue" :weight bold))
    (((class color) (background dark)) (:foreground "Lavender" :weight bold))

Is it a bug or the expected behaviour? Can I safely replaced ":bold t"
by ":weight bold"? Thank you.

In GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25)
 of 2009-12-08 on huygens.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Org

Minor modes in effect:
  TeX-PDF-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
e - m o d C-s C-s C-s C-s C-s C-a C-n C-n C-n C-n C-n
C-n C-p C-n C-x o C-n C-v M-v M-< C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n
C-n C-n C-p C-x o C-x 1 C-n C-v C-v C-v C-v C-v C-v
C-v C-v C-v C-v C-v C-v C-v C-x C-f C-a C-f C-f C-g
C-a d C-_ C-s d e f f a C-a C-x b C-g C-x C-b C-x o
C-n C-s . o r g C-a <return> C-n C-p C-x 1 C-n <tab>
C-s T O D O C-s C-a C-n C-p C-p C-n C-p C-p M-x s e
t - b a c <tab> <return> b l <backspace> <backspace>
w h i t e <return> M-x M-p <return> b l a c k <return>
C-n C-p M-x s e t <M-backspace> c u s t o m i z e -
f a <tab> <return> o r g - t o d o <return> C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-p q C-n C-p C-n C-p
M-x M-p C-g M-x s e t - b a c <tab> <return> w h i
t e <return> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-n C-x b <return>
C-p M-x s e t - b a <tab> <return> b l a c k <return>
C-n C-p C-x b <return> C-p C-n M-x r e p o r <tab>
<return>

Recent messages:
Mark saved where search started
Quit
Mark saved where search started
CHILDREN
Mark saved where search started
Creating customization items...
Creating face editor...done
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
Quit

Load-path shadows:
/Users/jfran/Documents/git/prolog-commons/systems/ciao/emacs-mode/prolog
hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/prolog

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums mailabbrev nnheader gnus-util netrc mm-util mail-prsvr
gmm-utils mailheader canlock sha1 hex-util hashcash mail-utils warnings
emacsbug sendmail org-clock crm cus-edit wid-edit multi-isearch
mule-util parse-time vc-cvs js json thingatpt imenu newcomment python-21
python sym-comp cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs make-mode sgml-mode css-mode tex-info texinfo
sh-script executable bibtex reftex-auc latexenc preview prv-emacs
tex-buf reftex-vcr reftex-dcr reftex reftex-vars font-latex latex
tex-style tex org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html org-exp org-exp-blocks org-agenda
org-info org-gnus org-bibtex org-bbdb org byte-opt bytecomp byte-compile
advice help-fns advice-preload org-footnote org-src org-list org-faces
org-compat org-macs time-date noutline outline easy-mmode vc-git dired
regexp-opt ciao etags word-help comint ring info vc-dispatcher vc-svn
tex-site server edmacro kmacro desktop cus-start cus-load tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face text-properties overlay md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process ns
multi-tty emacs)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7966; Package emacs. (Fri, 04 Feb 2011 03:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 7966 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>
Cc: 7966 <at> debbugs.gnu.org
Subject: Re: bug#7966: 23.1.50; bold property, dark background, and defface
Date: Thu, 03 Feb 2011 22:25:20 -0500
"Jose F. Morales" wrote:

> Is it a bug or the expected behaviour? 

I would say a bug. (This issue still occurs in the current trunk on GNU/Linux.)

> Can I safely replaced ":bold t" by ":weight bold"?

Yes. The former exists for compatibility with Emacs 20.

> In GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25)
>  of 2009-12-08 on huygens.local

That is a very early pre-release of what became 23.2. There is no reason
to use that instead of the 23.2 release.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7966; Package emacs. (Fri, 04 Feb 2011 09:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 7966 <at> debbugs.gnu.org (full text, mbox):

From: "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 7966 <at> debbugs.gnu.org
Subject: Re: bug#7966: 23.1.50; bold property, dark background, and defface
Date: Fri, 4 Feb 2011 10:08:52 +0100
On Fri, Feb 4, 2011 at 4:25 AM, Glenn Morris <rgm <at> gnu.org> wrote:
>
> "Jose F. Morales" wrote:
>
>> Is it a bug or the expected behaviour?
>
> I would say a bug. (This issue still occurs in the current trunk on GNU/Linux.)
>
>> Can I safely replaced ":bold t" by ":weight bold"?
>
> Yes. The former exists for compatibility with Emacs 20.
>
>> In GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25)
>>  of 2009-12-08 on huygens.local
>
> That is a very early pre-release of what became 23.2. There is no reason
> to use that instead of the 23.2 release.

All right. Thank you for the quick answer.

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
understand that switching from bright to dark background on-the-fly is
not a common action. Nevertheless, a short line in the emacs
documentation (unless it is trivial to fix) would save a lot of
headaches :)

Cheers,
Jose




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7966; Package emacs. (Fri, 04 Feb 2011 18:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 7966 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>
Cc: 7966 <at> debbugs.gnu.org
Subject: Re: bug#7966: 23.1.50; bold property, dark background, and defface
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))





Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Tue, 08 Feb 2011 04:02:02 GMT) Full text and rfc822 format available.

Notification sent to "Jose F. Morales" <jfran <at> clip.dia.fi.upm.es>:
bug acknowledged by developer. (Tue, 08 Feb 2011 04:02:02 GMT) Full text and rfc822 format available.

Message #19 received at 7966-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 7966-done <at> debbugs.gnu.org
Subject: Re: bug#7966: 23.1.50; bold property, dark background, and defface
Date: Mon, 07 Feb 2011 23:10:08 -0500
Version: 23.3

In the absence of any comments about that patch I installed it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 08 Mar 2011 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.