From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: A vision for multiple major modes: some design notes Date: Wed, 20 Apr 2016 16:00:28 -0700 (PDT) Message-ID: <3211e317-a79c-46ec-a3bd-7341cc275e65@default> References: <20160420194450.GA3457@acm.fritz.box> <05d5bd7e-1cea-4336-a37c-fe6bd6752558@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1461193257 20453 80.91.229.3 (20 Apr 2016 23:00:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Apr 2016 23:00:57 +0000 (UTC) To: Alan Mackenzie , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 21 01:00:44 2016 Return-path: Envelope-to: ged-emacs-devel@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 1at16x-0005Yo-Ai for ged-emacs-devel@m.gmane.org; Thu, 21 Apr 2016 01:00:43 +0200 Original-Received: from localhost ([::1]:58147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at16w-0007cC-8Y for ged-emacs-devel@m.gmane.org; Wed, 20 Apr 2016 19:00:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at16s-0007ZZ-IM for emacs-devel@gnu.org; Wed, 20 Apr 2016 19:00:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1at16n-0004CW-GK for emacs-devel@gnu.org; Wed, 20 Apr 2016 19:00:38 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:38949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1at16n-0004CP-2b for emacs-devel@gnu.org; Wed, 20 Apr 2016 19:00:33 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3KN0UmQ008557 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Apr 2016 23:00:31 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u3KN0UVK003688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Apr 2016 23:00:30 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u3KN0TRR020215; Wed, 20 Apr 2016 23:00:29 GMT In-Reply-To: <05d5bd7e-1cea-4336-a37c-fe6bd6752558@default> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6744.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:203140 Archived-At: I said: > And I would probably want user-level operations, to > combine chains (append, intersect, union/coalesce, > difference). And complement - get a new chain as the complement of a chain, i.e., the islands of one are the non-islands of the other. You should easily be able to search etc. _outside_ the islands of a given chain. -- I did that for zones.el, for instance: zz-zones-complement is a Lisp function in `zones.el'. (zz-zones-complement ZONES &optional BEG END BUFFER) Return a list of zones that is the complement of ZONES, from BEG to END. ZONES is assumed to be a union, i.e., sorted by car, with no overlaps. Any extra info in a zone of ZONES, i.e., after the cadr, is ignored. (The bit about being a union and sorted by car just means that the list of zones must be like your chain of islands: no overlaps and ordered by buffer position. The bit about ignoring cadr has to do with the fact that a zone (~island) can contain other information, in addition to its limits.)