GNU bug report logs - #16483
24.3.50; `read-face-name' is a mess now (regression)

Previous Next

Package: emacs;

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

Date: Fri, 17 Jan 2014 23:55:01 UTC

Severity: minor

Tags: fixed

Found in version 24.3.50

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 16483 <at> debbugs.gnu.org
Subject: Re: bug#16483: 24.3.50; `read-face-name' is a mess now (regression)
Date: Fri, 29 Apr 2016 17:37:00 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> The doc string is a mess now.  Quite unclear, and incorrect in more than
> one way.  And so is the code a mess.
>
> 1. The doc string no longer says what the behavior is if DEFAULT is nil.
> In Emacs 24.3, it said this for that case:
>
>  If DEFAULT is nil, the list of default face names is taken from
>  the `read-face-name' property of the text at point, or, if that
>  is nil, from the `face' property of the text at point.
>
> What happens now?  No information about that.  See below for my guess.
> Please tell users of the function what its behavior is.

As far as I can see, if DEFAULT is nil, there is no list of default face
names?

> 2. The doc string says that DEFAULT is returned if the user enters the
> empty string.  That is clearly wrong, at least when DEFAULT is a list of
> faces or face names.  DEFAULT is not returned in such cases.  The most
> that can be said in general is that DEFAULT _determines_ what is
> returned for empty input - not that DEFAULT _is_ what is returned.

I've now made the doc string more correct, if more difficult to parse.

> 5. The code is wrong, at least in this regard: If DEFAULT is a list of
> strings (face names), and if MULTIPLE is nil, both of which are OK per
> the doc string, then you get this:
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp "font-lock-comme=
> nt-face")
> * symbol-name("font-lock-comment-face")

I've fixed that now.

> 8. What happened to the useful defaulting of previous Emacs versions?
> Yes, I know why you made the change, but now any existing code that uses
> `read-face-name' is broken if it depends on `r-f-n' to provide such
> defaulting.  Too bad.
>
> Please consider: There is more Elisp code in the world than just what is
> distributed by Emacs Dev.  `read-face-name' has been and continues to be
> a poster child of how not to evolve code.  It has morphed in incompatible
> ways from version to version.  The right way to do what you wanted to do
> for Emacs 24.4 would have been to go ahead and define `face-at-point',
> but to *use* it in `read-face-name', so that that function continues to
> provide the expected defaulting when DEFAULT is nil:
>
>   (unless default (setq default  (face-at-point)))
>
> I somehow doubt that that part of the regression will be fixed, but
> perhaps some of the other points above have a chance of being addressed.

Yes, that's outside the scope of read-face-name, I think.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 8 years and 228 days ago.

Previous Next


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