From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#19912: facemenu-add-face: does not handle 'face being set to a property list Date: Wed, 25 Feb 2015 07:05:20 +0000 Message-ID: <87r3te31zj.fsf@violet.siamics.net> References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> <87zj8731lf.fsf_-_@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1424847985 25786 80.91.229.3 (25 Feb 2015 07:06:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 07:06:25 +0000 (UTC) To: 19912@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 25 08:06:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YQW2w-0007Du-E7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 08:06:14 +0100 Original-Received: from localhost ([::1]:53103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQW2v-0006oE-NE for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 02:06:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQW2p-0006iF-4F for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 02:06:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQW2l-00051y-Ld for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 02:06:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQW2k-00051n-G3 for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 02:06:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YQW2k-0005av-A2 for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 02:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Feb 2015 07:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19912 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19912-submit@debbugs.gnu.org id=B19912.142484793221464 (code B ref 19912); Wed, 25 Feb 2015 07:06:02 +0000 Original-Received: (at 19912) by debbugs.gnu.org; 25 Feb 2015 07:05:32 +0000 Original-Received: from localhost ([127.0.0.1]:57174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQW2F-0005a7-Oz for submit@debbugs.gnu.org; Wed, 25 Feb 2015 02:05:32 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:46069) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQW2C-0005Zy-QH for 19912@debbugs.gnu.org; Wed, 25 Feb 2015 02:05:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=O8GQDevdPApK8WffG+AExP5KM7PSqXSuRa2EZ0BPycs=; b=lot3f/16RhnRK3F4LbkYPQVEy07lkZO3bYl93QEtbvSGzP639O94w19pjqvRGf3MsFdlb20KfDNN5vwDBiggOl4wLM2r/M1JkV5/pe0lUumsKxcFo++BZYvT+bKSw9RX2YP0X+++qgXKItSIQvqcX/xj4q4GRT8ioZq8w6zjXDE=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YQW2C-0004Xj-5b for 19912@debbugs.gnu.org; Wed, 25 Feb 2015 07:05:28 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YQW24-0005N1-Uc for 19912@debbugs.gnu.org; Wed, 25 Feb 2015 14:05:21 +0700 Mail-Followup-To: 19912@debbugs.gnu.org In-Reply-To: <87zj8731lf.fsf_-_@violet.siamics.net> (Ivan Shmakov's message of "Sat, 21 Feb 2015 12:12:28 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99789 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Ivan Shmakov writes: [=E2=80=A6] > * lisp/facemenu.el (facemenu-add-face): Follow the (stricter) logic > of merge_face_ref when determining whether the value of the 'face > property is a sole face or a list thereof. (Bug#???) > (Tested on c4e2be4587ec, 2015-02-16 07:22:46 UTC.) > Alternatively, a suitable, Lisp-callable predicate may be > split off =E2=80=98merge_face_ref=E2=80=99 (src/faces.c) and be used ine > =E2=80=98facemenu-add-face=E2=80=99. =E2=80=A6 Or should such a predicate be introduced to faces.el instead? The merge_face_ref () logic is a bit arcane, so I=E2=80=99d rather keep it confined to the inner parts of Emacs (whether faces.c, faces.el, or similar.) Please consider the revised patch MIMEd. * lisp/faces.el (face-list-p): New function. * lisp/facemenu.el (facemenu-add-face): Use it. (Bug#19912) Unless there be objections, I hope to push this new change to =E2=80=98master=E2=80=99 within the next day or two. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -732,7 +732,7 @@ defun facemenu-add-face (face &optional start end) face (facemenu-active-faces (cons face - (if (listp prev) + (if (face-list-p prev) prev (list prev))) ;; Specify the selected frame --- a/lisp/faces.el +++ b/lisp/faces.el @@ -273,6 +273,22 @@ (not (internal-lisp-face-empty-p face frame))) +(defun face-list-p (face-or-list) + "True if FACE-OR-LIST is a list of faces. +Return nil if FACE-OR-LIST is a non-nil atom, or a cons cell whose car +is either 'foreground-color, 'background-color, or a symbol starting +with a colon (:)." + ;; The logic of merge_face_ref (xfaces.c) is recreated here. + (or (null face-or-list) + (and (consp face-or-list) + (symbolp (car face-or-list)) + (not (memq (car face-or-list) + '(foreground-color background-color))) + (let ((n (symbol-name (car face-or-list)))) + (or (zerop (length n)) + (not (eq ?: (aref n 0)))))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setting face attributes from X resources. --=-=-=--