all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Chong Yidong'" <cyd@stupidchicken.com>
Cc: 8396@debbugs.gnu.org
Subject: bug#8396: 24.0.50; why use options (vars) instead of faces for apropos?
Date: Sun, 24 Apr 2011 13:07:28 -0700	[thread overview]
Message-ID: <5814FFD2EF8F4E278D0ECDE2C5AC833A@us.oracle.com> (raw)
In-Reply-To: <87y62zv3g6.fsf@stupidchicken.com>

> > 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.






  reply	other threads:[~2011-04-24 20:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31 17:16 bug#8396: 24.0.50; why use options (vars) instead of faces for apropos? Drew Adams
2011-04-24 19:45 ` Chong Yidong
2011-04-24 20:07   ` Drew Adams [this message]
2012-04-23 15:39 ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5814FFD2EF8F4E278D0ECDE2C5AC833A@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=8396@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.