GNU bug report logs - #8396
24.0.50; why use options (vars) instead of faces for apropos?

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Thu, 31 Mar 2011 17:17:01 UTC

Severity: minor

Found in version 24.0.50

Done: Chong Yidong <cyd <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 8396 in the body.
You can then email your comments to 8396 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#8396; Package emacs. (Thu, 31 Mar 2011 17:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 31 Mar 2011 17:17:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.50; why use options (vars) instead of faces for apropos?
Date: Thu, 31 Mar 2011 10:16:14 -0700
Throughout apropos.el, we use `defcustom's instead of `defface's for
customizing the faces used.  Why?  Apropos should have its own faces,
not variables that can be assigned to only existing faces (that have
nothing to do with apropos).
 
Try, for instance, C-u C-x = on the bold text in *Apropos*.  You'll see
this:
 
There are text properties here:
  button               (t)
  category             apropos-symbol-button
  face                 bold    <====== WHAT'S THAT ABOUT?
  skip                 t
 
That doesn't help a user understand how to change the face used here.
S?he shouldn't think that s?he can only customize face `bold' to take
care of this.  And there is nothing to indicate to the user that there
is a customizable variable (`apropos-symbol-face') that is relevant
for this.  The user should have a real apropos face to customize.
 
There is no reason to avoid creating faces for the needs of apropos (or
anything else, for that matter.)  Faces are customizable by design -
there is no reason to resort to adding customizable variables when what
is wanted is customizing the appearance (faces).
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-03-21 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/imagesupport/include'
 





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8396; Package emacs. (Sun, 24 Apr 2011 19:46:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 8396 <at> debbugs.gnu.org
Subject: Re: bug#8396: 24.0.50;
	why use options (vars) instead of faces for apropos?
Date: Sun, 24 Apr 2011 15:45:13 -0400
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Throughout apropos.el, we use `defcustom's instead of `defface's for
> customizing the faces used.  Why?

Bad historical design.  I don't see a good way to revert this, though.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8396; Package emacs. (Sun, 24 Apr 2011 20:08:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: 8396 <at> debbugs.gnu.org
Subject: RE: bug#8396: 24.0.50;
	why use options (vars) instead of faces for apropos?
Date: Sun, 24 Apr 2011 13:07:28 -0700
> > Throughout apropos.el, we use `defcustom's instead of `defface's for
> > customizing the faces used.  Why?
> 
> Bad historical design.  I don't see a good way to revert this, though.

Surely this is not the first time Emacs has transitioned from variables to
faces. ;-)

Here's one suggestion: Start using `defface's and their resulting faces.
Declare the corresponding options obsolete.

If deemed absolutely necessary, the code could, for now, use either the option
value (if non-nil) or the face.  Eventually, we would remove the options.

Something like this, perhaps: (use-a-face (or the-face-option 'the-face))

E.g.:

(defcustom apropos-symbol-face nil
  "DOC MENTIONING IT IS OBSOLETE and to use face `apropos-symbol-face' instead."
  :group 'apropos :type '(choice (const :tag "None" nil) face))

(define-button-type 'apropos-symbol
  'face (or apropos-symbol-face 'apropos-symbol-face)
  'help-echo "mouse-2, RET: Display more help on this symbol"
  'follow-link t
  'action #'apropos-symbol-button-display-help)

Note the :type change for the option.

The current :type of `face' is incorrect - in all of the apropos.el face options
(another bug).  The doc strings for these face options, and some of the code
that uses them, expect that the value can be nil, meaning to use no face.  This
probably dates from ancient defvars, before defcustom. 

But the defcustom :type is `face' for each of them, which precludes using nil as
the value.  You cannot edit the value to `nil' and then use that, because `nil'
is not a face.  And if you use (setq apropos-symbol-face nil) then Customize
shows a type mismatch.

Note too this comment in the code of `apropos-print', which cries out for the
fix this bug requests:

;; Can't use default, since user may have changed the variable!
;; Just say `no' to variables containing faces!

And note the bugged code of `apropos-describe-plist', which in fact tests
whether variable `apropos-symbol-face' is nil (which it cannot be without
mismatching its :type).

In sum, please consider biting the bullet and getting rid of these face options.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8396; Package emacs. (Mon, 23 Apr 2012 15:41:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 8396 <at> debbugs.gnu.org
Subject: Re: bug#8396: 24.0.50;
	why use options (vars) instead of faces for apropos?
Date: Mon, 23 Apr 2012 23:39:26 +0800
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Throughout apropos.el, we use `defcustom's instead of `defface's for
> customizing the faces used.  Why?

Fixed now in trunk.




bug closed, send any further explanations to 8396 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 23 Apr 2012 15:41:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 11 years and 348 days ago.

Previous Next


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