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: Sat, 21 Feb 2015 12:12:28 +0000 Message-ID: <87zj8731lf.fsf_-_@violet.siamics.net> References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1424520803 29734 80.91.229.3 (21 Feb 2015 12:13:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2015 12:13:23 +0000 (UTC) To: 19912@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 21 13:13:12 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 1YP8vn-0006sI-Nk for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Feb 2015 13:13:11 +0100 Original-Received: from localhost ([::1]:35762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP8vn-0004Ye-0p for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Feb 2015 07:13:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP8vi-0004Xi-Jx for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 07:13:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YP8vf-00019N-FM for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 07:13:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP8ve-000196-8k for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 07:13:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YP8vd-00033K-RD for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 07:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Feb 2015 12:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19912 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142452076111703 (code B ref -1); Sat, 21 Feb 2015 12:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Feb 2015 12:12:41 +0000 Original-Received: from localhost ([127.0.0.1]:49897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YP8vI-00032g-F9 for submit@debbugs.gnu.org; Sat, 21 Feb 2015 07:12:40 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:45199) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YP8vF-00032X-5O for submit@debbugs.gnu.org; Sat, 21 Feb 2015 07:12:38 -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=KulGWVY/CVs3tUFIGoMUvP2ssBlaMkkp9sZEZUUEQmA=; b=kLL3WyUlmrtkKMby2Yw4RuqlfUsLxNfKAgDhl6TGGmJLnLUWwJUehh512cXHr2WDwgmPjn4d7UHGBuhqiWBpuQsEExO7J5zEXt3i2375WN632IqxQwxhioZPNopQ0gTcR/vop6jV+I0AQEHpmjIuGwsq2pgYhn03b7HQQnXkB4o=; 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 1YP8vE-0002LA-7U for submit@debbugs.gnu.org; Sat, 21 Feb 2015 12:12:36 +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 1YP8v6-00040H-RV for submit@debbugs.gnu.org; Sat, 21 Feb 2015 19:12:28 +0700 In-Reply-To: (Stefan Monnier's message of "Fri, 20 Feb 2015 12:18:38 -0500") 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:99673 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: minor Tags: patch As currently implemented, facemenu-add-face doesn=E2=80=99t handle the case of the 'face property value being a property list, like: (with-temp-buffer (insert "Hello, world!") (put-text-property 3 11 'face '(:weight bold)) (facemenu-add-face 'italic 5 7) (buffer-string)) The relevant part of the backtrace is like: check-face(:weight) facemenu-active-faces((italic :weight bold) #) facemenu-add-face(italic 5 7) With the patch MIMEd, the example produces the expected result: #("Hello, world!" 2 4 (face (:weight bold)) 4 6 (face (italic (:weight bold))) 6 10 (face (:weight bold))) * 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. --=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,9 +732,17 @@ defun facemenu-add-face (face &optional start end) face (facemenu-active-faces (cons face - (if (listp prev) - prev - (list prev))) + (if (or (atom prev) + (not (symbolp (car prev))) + (memq (car prev) + '(foreground-color + background-color)) + (let ((n (symbol-name + (car prev)))) + (and (> (length n) 0) + (eq ?: (aref n 0))))) + (list prev) + prev)) ;; Specify the selected frame ;; because nil would mean to use ;; the new-frame default settings, --=-=-=--