From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 21 07:12:40 2015 Received: (at submit) by debbugs.gnu.org; 21 Feb 2015 12:12:41 +0000 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 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=; 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 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 From: Ivan Shmakov To: submit@debbugs.gnu.org Subject: facemenu-add-face: does not handle 'face being set to a property list References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> Date: Sat, 21 Feb 2015 12:12:28 +0000 In-Reply-To: (Stefan Monnier's message of "Fri, 20 Feb 2015 12:18:38 -0500") Message-ID: <87zj8731lf.fsf_-_@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= 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, --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 25 02:05:32 2015 Received: (at 19912) by debbugs.gnu.org; 25 Feb 2015 07:05:32 +0000 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 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=; 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 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 From: Ivan Shmakov To: 19912@debbugs.gnu.org Subject: Re: bug#19912: facemenu-add-face: does not handle 'face being set to a property list References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> <87zj8731lf.fsf_-_@violet.siamics.net> Mail-Followup-To: 19912@debbugs.gnu.org Date: Wed, 25 Feb 2015 07:05:20 +0000 In-Reply-To: <87zj8731lf.fsf_-_@violet.siamics.net> (Ivan Shmakov's message of "Sat, 21 Feb 2015 12:12:28 +0000") Message-ID: <87r3te31zj.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 19912 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 25 12:24:31 2015 Received: (at 19912) by debbugs.gnu.org; 25 Feb 2015 17:24:31 +0000 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 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=; 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 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 From: Ivan Shmakov To: 19912@debbugs.gnu.org Subject: Re: bug#19912: facemenu-add-face: does not handle 'face being set to a property list References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> <87zj8731lf.fsf_-_@violet.siamics.net> <87r3te31zj.fsf@violet.siamics.net> Mail-Followup-To: 19912@debbugs.gnu.org Date: Wed, 25 Feb 2015 17:24:21 +0000 In-Reply-To: <87r3te31zj.fsf@violet.siamics.net> (Ivan Shmakov's message of "Wed, 25 Feb 2015 07:05:20 +0000") Message-ID: <87a9013nwa.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 19912 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= 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)))))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 26 13:13:03 2015 Received: (at 19912-done) by debbugs.gnu.org; 26 Feb 2015 18:13:03 +0000 Received: from localhost ([127.0.0.1]:58926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YR2vn-000269-5C for submit@debbugs.gnu.org; Thu, 26 Feb 2015 13:13:03 -0500 Received: from fely.am-1.org ([78.47.74.50]:46747) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YR2vl-00025j-4T for 19912-done@debbugs.gnu.org; Thu, 26 Feb 2015 13:13:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=MzMOPHRDXjUZ/vcMtDJTfKicIvyZf6wp7cofSlNXdwQ=; b=TJUsqV4yQa1IFjQx5la8hrwFGGDOFX5prPELEAeFyOQOwX9Rn+iC0kVavzpY4YgL0lkbvK7dlEOtu9yC6Lv2ir4ZG4YxGthhcX7uaceL8ls59WGI4tJXRbZTL01ZpXz6ov4XuFZQ7J53lTd7ICwpkeNum/Ef8DvpUsFcc8p4mig=; 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 1YR2vk-0008Je-3R for 19912-done@debbugs.gnu.org; Thu, 26 Feb 2015 18:13:00 +0000 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 1YR2vd-0005B7-AS for 19912-done@debbugs.gnu.org; Fri, 27 Feb 2015 01:12:53 +0700 From: Ivan Shmakov To: 19912-done@debbugs.gnu.org Subject: Re: bug#19912: facemenu-add-face: does not handle 'face being set to a property list References: <87pp953q1j.fsf_-_@violet.siamics.net> <83lhjslwup.fsf@gnu.org> <87zj8731lf.fsf_-_@violet.siamics.net> <87r3te31zj.fsf@violet.siamics.net> <87a9013nwa.fsf@violet.siamics.net> Mail-Followup-To: 19912@debbugs.gnu.org Date: Thu, 26 Feb 2015 18:12:52 +0000 In-Reply-To: <87a9013nwa.fsf@violet.siamics.net> (Ivan Shmakov's message of "Wed, 25 Feb 2015 17:24:21 +0000") Message-ID: <87pp8w1qzf.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 19912-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) >>>>> Ivan Shmakov writes: > * 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. Pushed, closing. commit 619fc5c197ebef5444aed24fe30657989fc2a839 CommitDate: 2015-02-26 18:09:48 +0000 Fix 'face property handling in facemenu-add-face. =20=20=20=20 * lisp/faces.el (face-list-p): Split from face-at-point. (face-at-point): Use it. * lisp/facemenu.el (facemenu-add-face): Likewise. =20=20=20=20 Fixes: debbugs:19912 --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From unknown Sat Aug 09 15:19:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 27 Mar 2015 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator