From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#37806: 27.0.50; Need to "extend" face-remap.el Date: Sun, 20 Oct 2019 16:39:30 +0200 Message-ID: <20191020143930.ugxiakrap7yym6qw@Ergus> References: <875zkmmn4u.fsf@gmx.net> <835zkk7i8i.fsf@gnu.org> <87r237txnl.fsf@gmx.net> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="207635"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: Eli Zaretskii , 37806@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 20 16:40:26 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iMCNb-000rrT-CW for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Oct 2019 16:40:23 +0200 Original-Received: from localhost ([::1]:36746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMCNZ-0001ks-PU for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Oct 2019 10:40:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51296) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMCNH-0001SB-A9 for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2019 10:40:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMCNF-00079w-VL for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2019 10:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46259) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMCNF-00079r-RY for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2019 10:40:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iMCNF-0002D5-Lv for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2019 10:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Oct 2019 14:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37806 X-GNU-PR-Package: emacs Original-Received: via spool by 37806-submit@debbugs.gnu.org id=B37806.15715823938477 (code B ref 37806); Sun, 20 Oct 2019 14:40:01 +0000 Original-Received: (at 37806) by debbugs.gnu.org; 20 Oct 2019 14:39:53 +0000 Original-Received: from localhost ([127.0.0.1]:55079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMCN6-0002Ce-Lb for submit@debbugs.gnu.org; Sun, 20 Oct 2019 10:39:53 -0400 Original-Received: from sonic308-17.consmr.mail.ir2.yahoo.com ([77.238.178.145]:44949) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMCN3-0002CP-Ie for 37806@debbugs.gnu.org; Sun, 20 Oct 2019 10:39:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1571582383; bh=nkc1BF//uplB9NpgYWoTLzLKoI4vieNqfJVSLKEfuzk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=aPNIoDR9D9trqC+Fl93BoZm5t1qjm8Oygce/HSZPJ06PCjBwcTVPgw1eUiLU0x6E+NA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N.2sQOr3bTu_HP48gBWQKMRFoBJen FUcOdBOR4MZRp3._ZLpMTm93P8UaFPg5NnzODWlWbh Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Sun, 20 Oct 2019 14:39:43 +0000 Original-Received: by smtp423.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7c57f1cb39c2c41acd44f63b33a75af1; Sun, 20 Oct 2019 14:39:42 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87r237txnl.fsf@gmx.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:169818 Archived-At: On Sun, Oct 20, 2019 at 02:21:50PM +0200, Stephen Berman wrote: >On Sat, 19 Oct 2019 20:33:33 +0300 Eli Zaretskii wrote: > >>> From: Stephen Berman >>> Date: Fri, 18 Oct 2019 11:14:09 +0200 >>> >>> 0. emacs -Q >>> 1. C-x C-+ (i.e. M-x text-scale-adjust) >>> 2. M-x variable-pitch-mode or M-x buffer-face-mode >>> => Args out of range: [nil :family :foundry :swidth :height :weight :slant :underline :inverse :foreground ...], 19 >>> >>> The error happens because the vector of face attributes defined in >>> face-remap.el is missing the recently added :extend attribute, so it is >>> too short. This also breaks the MELPA package charmap.el (that's where >>> I hit the error). The patch below fixes this, though perhaps now would >>> be a good time to do what the comment above the definition of the vector >>> says: "This variable should probably be defined in C code where the >>> actual definitions are available." Or is this simple fix good enough? >>> >>> (The vector is also missing the :distant-foreground attribute, so the >>> patch adds that as well. This absence happened to be innocuous because >>> the first element of the vector is nil, in order to make the attribute >>> indices match those of the enum lface_attribute_index defined in >>> dispextern.h, so the vector was long enough; but after the addition of >>> the :extend attribute, it wasn't anymore (only the indices of the vector >>> are used in face-remap.el).) >>> >>> In GNU Emacs 27.0.50 (build 17, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) >>> of 2019-10-18 built on strobe-lfs84 >>> Repository revision: 2d13a3f68d4724af52e47675bedf60709c7b5171 >>> Repository branch: master >>> Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 >>> System Description: Linux From Scratch >>> >>> >>> diff --git a/lisp/face-remap.el b/lisp/face-remap.el >>> index 5cdecb92ee..8e565264fe 100644 >>> --- a/lisp/face-remap.el >>> +++ b/lisp/face-remap.el >>> @@ -69,7 +69,7 @@ internal-lisp-face-attributes >>> [nil >>> :family :foundry :swidth :height :weight :slant :underline :inverse >>> :foreground :background :stipple :overline :strike :box >>> - :font :inherit :fontset :vector]) >>> + :font :inherit :fontset :distant :extend :vector]) >>> >>> (defun face-attrs-more-relative-p (attrs1 attrs2) >>> "Return true if ATTRS1 contains a greater number of relative >> >> Thanks. >> >> Jimmy, could you please take a look? > >This bug (and bug#37824, which is the same) isn't due to the addition of >the :extend attribute per se, but to that addition increasing the length >of lface_attribute_index, which makes it necessary to adjust the length >of internal-lisp-face-attributes, only the indices of which >face-remap.el actually uses, as I noted above. Indeed, the following >patch also fixes this bug: > >diff --git a/lisp/face-remap.el b/lisp/face-remap.el >index 5cdecb92ee..e429752df9 100644 >--- a/lisp/face-remap.el >+++ b/lisp/face-remap.el >@@ -66,7 +66,7 @@ > ;; definitions are available. > ;; > (defvar internal-lisp-face-attributes >- [nil >+ [nil nil > :family :foundry :swidth :height :weight :slant :underline :inverse > :foreground :background :stipple :overline :strike :box > :font :inherit :fontset :vector]) > >But then we might as well just use a vector with all nil (or arbitrary) >elements whose length is LFACE_VECTOR_SIZE (maybe that's even how the >comment in face-remap.el quoted above could be understood). > >The simplest fix is to just add the missing attributes, as my first >patch does, but then on any future changes to lface_vector_size >internal-lisp-face-attributes will have to be correspondingly adjusted. > >Steve Berman Yes the problem is just the size of the vector, because actually the elements in it are wrong as they are not as defined anywhere else. The proper fix must be to declare the vector in the C side using the real symbols like: Lisp_Object internal-lisp-face-attributes[LFACE_VECTOR_SIZE] = { Qnil QCfamily, QCfoundry, QCwidth QCheight, QCweight, QCslant, QCunderline, QCinverse_video, QCforeground, QCbackground, QCstipple, QCoverline, QCstrike_through, QCbox, QCfont, QCinherit, QCfontset, QCdistant_foreground, QCextend }; But using makevector or a similar api from C. This vector can be used in some other parts in the code where we are duplicating code now, but this will require a refactor I don't know if it is desired. So I will submit the simplest fix now and if Eli gives me a green light I will implement the better version.