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 17:24:21 +0000 Message-ID: <87a9013nwa.fsf@violet.siamics.net> References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> <87zj8731lf.fsf_-_@violet.siamics.net> <87r3te31zj.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1424885126 9978 80.91.229.3 (25 Feb 2015 17:25:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 17:25:26 +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 18:25:18 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 1YQfi1-0004HG-FU for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 18:25:17 +0100 Original-Received: from localhost ([::1]:55436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfi0-0005in-QY for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Feb 2015 12:25:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfhq-0005Ur-Hy for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:25:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQfhn-000464-6U for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:25:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQfhm-00045g-Lz for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:25:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YQfhm-0007Gz-AG for bug-gnu-emacs@gnu.org; Wed, 25 Feb 2015 12:25: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 17:25: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.142488507127912 (code B ref 19912); Wed, 25 Feb 2015 17:25:02 +0000 Original-Received: (at 19912) by debbugs.gnu.org; 25 Feb 2015 17:24:31 +0000 Original-Received: from localhost ([127.0.0.1]:58015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQfhH-0007G7-CC for submit@debbugs.gnu.org; Wed, 25 Feb 2015 12:24:31 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:46295) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YQfhF-0007Fz-Hj for 19912@debbugs.gnu.org; Wed, 25 Feb 2015 12:24:30 -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=D8rMXlGUMj/mvLR7lW6/veO4ry+YLgT2s6GuFOw0wsQ=; b=mrSjKZz9f1W98xl0ghTOR2QRLyrDRm6PweFGAde8u1riElcgkAzyaw6K/Jj9uRW8dxdd6EYZ6fop2bMkOxrhY/WymWKoxyKGXxPXW8bhB59fsl0n1XWYld53a1bSYkxW7VcjyHHnXG8vrjif2yYdR3FrTWV30P4Ihdo+SHXX6SM=; 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 1YQfhE-0002Wy-Pi for 19912@debbugs.gnu.org; Wed, 25 Feb 2015 17:24: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 1YQfh8-0008Ez-5I for 19912@debbugs.gnu.org; Thu, 26 Feb 2015 00:24:22 +0700 Mail-Followup-To: 19912@debbugs.gnu.org In-Reply-To: <87r3te31zj.fsf@violet.siamics.net> (Ivan Shmakov's message of "Wed, 25 Feb 2015 07:05:20 +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:99811 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Please consider the (once again) revised patch MIMEd. * lisp/faces.el (face-list-p): Split from face-at-point. (face-at-point): Use it. * lisp/facemenu.el (facemenu-add-face): Likewise. (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 np. Isle of Avalon =E2=80=94 Iron Maiden =E2=80= =A6 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,17 @@ defun face-nontrivial-p (face &optional frame) (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 keyword." + ;; The logic of merge_face_ref (xfaces.c) is recreated here. + (and (listp face-or-list) + (not (memq (car face-or-list) + '(foreground-color background-color))) + (not (keywordp (car face-or-list))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setting face attributes from X resources. @@ -1922,11 +1933,7 @@ defun face-at-point (&optional thing multiple) (get-char-property (point) 'face)))) (cond ((facep faceprop) (push faceprop faces)) - ((and (listp faceprop) - ;; Don't treat an attribute spec as a list of faces. - (not (keywordp (car faceprop))) - (not (memq (car faceprop) - '(foreground-color background-color)))) + ((face-list-p faceprop) (dolist (face faceprop) (if (facep face) (push face faces)))))) --=-=-=--