From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: Idea: Be able to use text properties as face attributes Date: Sun, 26 Mar 2017 12:14:38 -0700 (PDT) Message-ID: <7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1490555703 27713 195.159.176.226 (26 Mar 2017 19:15:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Mar 2017 19:15:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 26 21:14:59 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csDcn-0005mR-0q for ged-emacs-devel@m.gmane.org; Sun, 26 Mar 2017 21:14:49 +0200 Original-Received: from localhost ([::1]:42006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csDcs-000402-Nt for ged-emacs-devel@m.gmane.org; Sun, 26 Mar 2017 15:14:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csDcm-0003zu-HI for emacs-devel@gnu.org; Sun, 26 Mar 2017 15:14:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csDch-0007zh-Je for emacs-devel@gnu.org; Sun, 26 Mar 2017 15:14:48 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:21149) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csDch-0007ym-Ar for emacs-devel@gnu.org; Sun, 26 Mar 2017 15:14:43 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v2QJEej0018562 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 26 Mar 2017 19:14:40 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v2QJEejZ020486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 26 Mar 2017 19:14:40 GMT Original-Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v2QJEdIC020478 for ; Sun, 26 Mar 2017 19:14:40 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213387 Archived-At: Proposal for discussion. I think it could be a useful feature. (It would no doubt involve Emacs C code, which I wouldn't be helping with. I could help with updating the doc, though.) The idea is to allow the use of text properties as attributes for the text (and overlay) properties `face', `font-lock-face', and `mouse-face'. This would apply to faces used in strings (e.g., `propertize') as well as in buffers. It would let you, for example, use a property such as `invisible', `keymap', or `read-only' (even `display'?) as part of a face definition. Any properties that either cannot be implemented or do not make sense for faces would be excluded (i.e., ignored). But I'm guessing that most could be accommodated. Setting such a face attribute would have the effect that all occurrences of text with that face, when redisplayed, would appear as if the text property were applied directly to the text that has that face. For example, this would make all doc strings invisible: (set-face-attribute 'font-lock-doc-face nil 'invisible t) Face merging is already well defined, in particular for cases where there is a conflict between the values of the same attribute, so I don't expect any problem there. One open question would be whether to allow the text properties `face', `font-lock-face', and `mouse-face' as properties for themselves and each other. E.g., be able to do this: (set-face-attribute 'face-1 nil 'face 'face-2) or this: (set-face-attribute 'face-1 nil 'font-lock-face 'face-1) These properties could be excluded (ignored), but allowing them might prove useful. It would provide a simple way to (e.g. temporarily) substitute one face for another or to give control over a face to font-lock (change `face' to `font-lock-face') or vice versa. WDOT? Is this something that would be useful? If so, would someone like to work on implementing it?