From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Combining face and map stuff Date: Mon, 04 Oct 2010 01:37:26 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1286149056 30377 80.91.229.12 (3 Oct 2010 23:37:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 3 Oct 2010 23:37:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 04 01:37:35 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P2Y7b-0006sI-4Q for ged-emacs-devel@m.gmane.org; Mon, 04 Oct 2010 01:37:35 +0200 Original-Received: from localhost ([127.0.0.1]:42817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P2Y7a-0000Et-IB for ged-emacs-devel@m.gmane.org; Sun, 03 Oct 2010 19:37:34 -0400 Original-Received: from [140.186.70.92] (port=41157 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P2Y7V-0000En-Qi for emacs-devel@gnu.org; Sun, 03 Oct 2010 19:37:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P2Y7U-0005OY-Ed for emacs-devel@gnu.org; Sun, 03 Oct 2010 19:37:29 -0400 Original-Received: from smtp2a.orange.fr ([80.12.242.139]:27487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P2Y7U-0005OU-3o for emacs-devel@gnu.org; Sun, 03 Oct 2010 19:37:28 -0400 Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2a08.orange.fr (SMTP Server) with ESMTP id 2C51670002E5; Mon, 4 Oct 2010 01:37:27 +0200 (CEST) Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2a08.orange.fr (SMTP Server) with ESMTP id 1F75D70002E7; Mon, 4 Oct 2010 01:37:27 +0200 (CEST) Original-Received: from fmsmemgm.homelinux.net (AMontsouris-552-1-117-187.w92-140.abo.wanadoo.fr [92.140.60.187]) by mwinf2a08.orange.fr (SMTP Server) with ESMTP id E736170002E5; Mon, 4 Oct 2010 01:37:26 +0200 (CEST) X-ME-UUID: 20101003233726947.E736170002E5@mwinf2a08.orange.fr Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 706BDAE2BE; Mon, 4 Oct 2010 01:37:26 +0200 (CEST) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Sat, 02 Oct 2010 16:21:32 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:131304 Archived-At: > Which reminds me of another thing. I would like to define some commands > local to a region, which can be done with 'local-map in overlays or > 'keymap in text properties. But can I combine them, too, in possibly > overlapping regions, and get the aggregate keymap? Here's an idea with which I've beeing toying: - rather than have just one set of text-properties per char, make it possible to have several. E.g. font-lock would use its own set of text properties. One way to do that is that a `property' can now be a cons whose car is a "plane" and whose cdr is a property. So for example, the special font-lock-face (which currently gets "mapped" to face' via char-property-alias-alist) would just be `face' because font-lock would use (font-lock . face). A property like `face' would really be equivalent to (nil . face). - then you add property-specific merge functions. I.e. when looking up `face' you'd get the merge of all the `face' properties of the various text-property planes. You'd probably want those merge functions to be written in Elisp and customizable. So merging `keymap' properties becomes easy (well, it may benefit from multiple-keymap inheritance, which is a completely different topic). - now font-lock can erase all the properties of the `font-lock' plane without worrying about erasing properties installed by other packages. - to avoid calling Elisp code to merge things during text-property lookups, the merge would take place in put-text-property (i.e. no need to change the redisplay code at all). - modifying a plane other than the default (nil) one could be considered as "not modifying the buffer" (just like adding/removing overlays). - we could obsolete char-property-alias-alist which is only ever used by/for font-lock-face. - maybe outline-minor-mode could use text-properties rather than overlays to make text invisible (tho it would make it impossible(?) to use outline-minor-mode in an indirect buffer without affecting the base buffer and the other indirect buffers). So it might reduce the need for overlays (which have the disadvantage of being algorithmically slow/costly). Stefan