From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Idea: Be able to use text properties as face attributes Date: Wed, 29 Mar 2017 17:51:04 +0300 Message-ID: <83a8846srr.fsf@gnu.org> References: <<<<7a902f7b-d808-4d0f-8ff9-b8f07eaddf83@default>>>> <<<<83h92e93ip.fsf@gnu.org>>>> <<<8080a162-700f-42cc-aec9-5fdd7c646297@default>>> <<<8360iu8sdm.fsf@gnu.org>>> <<19e94d18-656f-4a8f-8843-4d46ffdd037b@default>> <<83shlx782i.fsf@gnu.org>> <403a3ff2-464f-4eb5-9843-60592e786955@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1490799120 13656 195.159.176.226 (29 Mar 2017 14:52:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Mar 2017 14:52:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 29 16:51:51 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 1ctEwl-0001aj-AS for ged-emacs-devel@m.gmane.org; Wed, 29 Mar 2017 16:51:39 +0200 Original-Received: from localhost ([::1]:59510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctEwr-0003py-94 for ged-emacs-devel@m.gmane.org; Wed, 29 Mar 2017 10:51:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctEwI-0003pd-Cb for emacs-devel@gnu.org; Wed, 29 Mar 2017 10:51:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctEwF-0000LM-N0 for emacs-devel@gnu.org; Wed, 29 Mar 2017 10:51:10 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctEwF-0000LF-Jm; Wed, 29 Mar 2017 10:51:07 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2115 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ctEwE-0002jx-St; Wed, 29 Mar 2017 10:51:07 -0400 In-reply-to: <403a3ff2-464f-4eb5-9843-60592e786955@default> (message from Drew Adams on Tue, 28 Mar 2017 14:39:36 -0700 (PDT)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:213499 Archived-At: > Date: Tue, 28 Mar 2017 14:39:36 -0700 (PDT) > From: Drew Adams > Cc: emacs-devel@gnu.org > > That's the point. The text-property fiddling is confined > to a particular face. It affects all occurrences of the > face (or all on a given frame, optionally). > > That's one advantage. Another is that we have commands > that let users easily apply faces to text in various ways > (match regexps,... whatever). Another is that users > already have lots of locations where faces are applied - > common and significant locations, for users. So this > feature has plenty of terrain of immediate application. Why would I want to make all stretches of text that have, say, font-lock-constant-face have a particular 'keymap' attribute? And how is that more convenient than simply scanning the text for the same regexp/syntax as the one which used to place the face and actually putting a 'keymap' property there? And why do you only ask this for the 'face' properties, but not for others? IOW, I'm still struggling to understand why you attach this feature to faces, and to faces only. Please also note that at least font-lock faces are by default placed lazily, on and around the portions of the buffer that are going to be displayed. So Lisp programs looking for your special attributes might not find them if JIT font-lock didn't yet fontify them. > > > I can't speak to the cost. > > > > I didn't ask you to. What I did ask is what are the user-level > > advantages which would justify those costs, whatever they are. I > > don't think you answered that question. > > I've described the point of the feature - the advantages. Am I correct concluding that the advantages, from your POV, are that users of this feature will be able to avoid the need of specifying the text to receive this special treatment with regexps, syntax classes, and other similar means, and instead will be able to use the definitions already provided for faces? Is this the only advantage, or are there others? > You've hinted at the cost. Do the advantages outweigh > the cost? I have no idea, because I don't know the costs. I didn't ask you to weigh the costs against the advantages, I asked only about the advantages. > So users will be able to: > > 1. Put a face wherever they want (they can do that now). > > 2. Manipulate any text properties (that are supported) > at those locations. Why is it better than just put any property you need, such as 'read-only', directly on that same text? What non-trivial parts of the job would be saved by using face attributes instead? > Faces are special in those senses - they constitute > especially handy affordances for manipulating text at > locations that are common or significant for users. If this is the answer to my question above, then I'm not sure I agree with you. E.g., Text mode has no faces by default, but that doesn't mean Lisp programs working in Text mode won't want to manipulate text at significant locations.