annotate lisp/utils/text-props.el @ 8:4b173ad71786 r19-15b5

Import from CVS: tag r19-15b5
author cvs
date Mon, 13 Aug 2007 08:47:35 +0200
parents ac2d302a0011
children bcdc7deadc19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; text-props.el --- implements properties of characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Amdahl Corporation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Keywords: extensions, wp, faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Author: Jamie Zawinski <jwz@lucid.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; Modified: Ben Wing <wing@666.com> -- many of the Lisp functions below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; were completely broken.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; XEmacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; XEmacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; This is a nearly complete implementation of the FSF19 text properties API.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Please let me know if you notice any differences in behavior between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; this implementation and the FSF implementation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; However, keep in mind that this interface has been implemented because it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; is useful. Compatibility with code written for FSF19 is a secondary goal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; to having a clean and useful interface.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; The cruftier parts of the FSF API, such as the special handling of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; properties like `mouse-face', `front-sticky', and other properties whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; value is a list of names of *other* properties set at this position, are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; not implemented. The reason for this is that if you feel you need that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; kind of functionality, it's a good hint that you should be using extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;; instead of text properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; When should I use Text Properties, and when should I use Extents?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; ==================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; If you are putting a `button' or `hyperlink' of some kind into a buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; the most natural interface is one which deals with properties of regions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; with explicit endpoints that behave more-or-less like markers. That is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;; what `make-extent', `extent-at', and `extent-property' are for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; If you are dealing with styles of text, where things do not have explicit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; endpoints (as is done in font-lock.el and shell-font.el) or if you want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;; partition a buffer (that is, change some attribute of a range from one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; value to another without disturbing the properties outside of that range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;; then an interface that deals with properties of characters may be most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; natural.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;; Another way of thinking of it is, do you care where the endpoints of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; region are? If you do, then you should use extents. If it's ok for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;; region to become divided, and for two regions with identical properties to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;; be merged into one region, then you might want to use text properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;; Some applications want the attributes they add to be copied by the killing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;;; and yanking commands, and some do not. This is orthogonal to whether text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;; properties or extents are used. Remember that text properties are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;; implemented in terms of extents, so anything you can do with one you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; do with the other. It's just a matter of which way of creating and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;; managing them is most appropriate to your application.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;;; Implementation details:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;; =======================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;;; This package uses extents with a non-nil 'text-prop property. It assumes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;;; free reign over the endpoints of any extent with that property. It will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;;; not alter any extent which does not have that property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;; Right now, the text-property functions create one extent for each distinct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;;; property; that is, if a range of text has two text-properties on it, there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;; will be two extents. As the set of text-properties is going to be small,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;;; this is probably not a big deal. It would be possible to share extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;; One tricky bit is that undo/kill/yank must be made to not fragment things:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;; these extents must not be allowed to overlap. We accomplish this by using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;;; a custom `paste-function' property on the extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;;; shell-font.el and font-lock.el could put-text-property to attach fonts to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;;; the buffer. However, what these packages are interested in is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; efficient extent partitioning behavior which this code exhibits, not the
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
93 ;;; duplicability aspect of it. In fact, either of these packages could be
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;;; implemented by creating a one-character non-expandable extent for each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;; character in the buffer, except that that would be extremely wasteful of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;;; memory. (Redisplay performance would be fine, however.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;;; If these packages were to use put-text-property to make the extents, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;;; when one copied text from a shell buffer or a font-locked source buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;;; and pasted it somewhere else (a sendmail buffer, or a buffer not in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ;;; font-lock mode) then the fonts would follow, and there's no easy way to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;;; get rid of them (other than pounding out a call to put-text-property by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ;;; hand.) This is annoying. Maybe it wouldn't be so annoying if there was a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;;; more general set of commands for handling styles of text (in fact, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;;; there were such a thing, copying the fonts would probably be exactly what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;;; one wanted) but we aren't there yet. So these packages use the interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;; of `put-nonduplicable-text-property' which is the same, except that it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;;; doesn't make duplicable extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;;; `put-text-property' and `put-nonduplicable-text-property' don't get along:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; they will interfere with each other, reusing each others' extents without
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;; checking that the "duplicableness" is correct. This is a bug, but it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;; one that I don't care enough to fix this right now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; The following functions were ported to C for speed; the overhead of doing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; this many full lisp function calls was not small.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;; #### The C functions have changed since then; the Lisp equivalents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; should be updated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;(defun put-text-property (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ; "Adds the given property/value to all characters in the specified region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;The property is conceptually attached to the characters rather than the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;region. The properties are copied when the characters are copied/pasted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ; (put-text-property-1 start end prop value buffer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ; prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;(defun put-nonduplicable-text-property (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ; "Adds the given property/value to all characters in the specified region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;The property is conceptually attached to the characters rather than the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;region, however the properties will not be copied the characters are copied."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ; (put-text-property-1 start end prop value buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ; prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;(defun put-text-property-1 (start end prop value buffer duplicable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ; ;; returns whether any property of a character was changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ; (if (= start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ; nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ; (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ; (and buffer (set-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ; (let ((the-extent nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ; (changed nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ; ;; prop, value, the-extent, start, end, and changed are of dynamic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ; ;; scope. changed and the-extent are assigned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ; (map-extents (function put-text-property-mapper) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ; (max 1 (1- start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ; (min (buffer-size) (1+ end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ; ;; If we made it through the loop without reusing an extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ; ;; (and we want there to be one) make it now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ; (cond ((and value (not the-extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ; (setq the-extent (make-extent start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ; (set-extent-property the-extent 'text-prop prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ; (set-extent-property the-extent prop value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ; (setq changed t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ; (cond (duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ; (set-extent-property the-extent 'duplicable t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ; (set-extent-property the-extent 'paste-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ; 'text-prop-extent-paste-function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ; ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ; changed))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;(defun put-text-property-mapper (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ; ;; prop, value, the-extent, start, end, and changed are of dynamic scope.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ; ;; changed and the-extent are assigned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ; (let ((e-start (extent-start-position e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ; (e-end (extent-end-position e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ; (e-val (extent-property e prop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ; (cond ((not (eq (extent-property e 'text-prop) prop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ; ;; It's not for this property; do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ; nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ; ((and value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ; (not the-extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ; (eq value e-val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ; ;; we want there to be an extent here at the end, and we haven't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ; ;; picked one yet, so use this one. Extend it as necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ; ;; We only reuse an extent which has an EQ value for the prop in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ; ;; question to avoid side-effecting the kill ring (that is, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ; ;; never change the property on an extent after it has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ; ;; created.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ; (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ; ((or (/= e-start start) (/= e-end end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ; (set-extent-endpoints e (min e-start start) (max e-end end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ; (setq changed t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ; (setq the-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ; ;; Even if we're adding a prop, at this point, we want all other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ; ;; extents of this prop to go away (as now they overlap.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ; ;; So the theory here is that, when we are adding a prop to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ; ;; region that has multiple (disjoint) occurences of that prop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ; ;; in it already, we pick one of those and extend it, and remove
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ; ;; the others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ; ((eq e the-extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ; ;; just in case map-extents hits it again (does that happen?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ; nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ; ((and (>= e-start start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ; (<= e-end end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ; ;; extent is contained in region; remove it. Don't destroy or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ; ;; modify it, because we don't want to change the attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ; ;; pointed to by the duplicates in the kill ring.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ; (setq changed t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ; (detach-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ; ((and the-extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ; (eq value e-val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ; (<= e-start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ; (>= e-end start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ; ;; this extent overlaps, and has the same prop/value as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ; ;; extent we've decided to reuse, so we can remove this existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ; ;; extent as well (the whole thing, even the part outside of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ; ;; region) and extend the-extent to cover it, resulting in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ; ;; minimum number of extents in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ; (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ; ((and (/= (extent-start-position the-extent) e-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ; (/= (extent-end-position the-extent) e-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ; (set-extent-endpoints the-extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ; (min (extent-start-position the-extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ; e-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ; (max (extent-end-position the-extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ; e-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ; (setq changed t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ; (detach-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ; ((<= (extent-end-position e) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ; ;; extent begins before start but ends before end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ; ;; so we can just decrease its end position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ; (if (and (= (extent-start-position e) e-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ; (= (extent-end-position e) start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ; nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ; (set-extent-endpoints e e-start start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ; (setq changed t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ; ((>= (extent-start-position e) start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ; ;; extent ends after end but begins after start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ; ;; so we can just increase its start position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ; (if (and (= (extent-start-position e) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ; (= (extent-start-position e) e-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ; nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ; (set-extent-endpoints e end e-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ; (setq changed t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ; (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ; ;; Otherwise, the extent straddles the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ; ;; We need to split it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ; (set-extent-endpoints e e-start start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ; (setq e (copy-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ; (set-extent-endpoints e end e-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ; (setq changed t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ; ;; return nil to continue mapping over region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ; nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;(defun text-prop-extent-paste-function (extent from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ; ;; Whenever a text-prop extent is pasted into a buffer (via `yank' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ; ;; `insert' or whatever) we attach the properties to the buffer by calling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ; ;; `put-text-property' instead of by simply alowing the extent to be copied
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ; ;; or re-attached. Then we return nil, telling the C code not to attach
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ; ;; it again. By handing the insertion hackery in this way, we make kill/yank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ; ;; behave consistently iwth put-text-property and not fragment the extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ; ;; (since text-prop extents must partition, not overlap.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ; (let* ((prop (or (extent-property extent 'text-prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ; (error "internal error: no text-prop on %S" extent)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ; (val (or (extent-property extent prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ; (error "internal error: no text-prop %S on %S"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ; prop extent))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ; (put-text-property from to prop val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ; nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;(defun add-text-properties (start end props &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ; "Add properties to the characters from START to END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;The third argument PROPS is a property list specifying the property values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;to add. The optional fourth argument, OBJECT, is the buffer containing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;text. Returns t if any property was changed, nil otherwise."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ; (let ((changed nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ; (while props
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ; (setq changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ; (or (put-text-property-1 start end (car props) (car (cdr props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ; buffer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ; changed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ; (setq props (cdr (cdr props))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ; changed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;(defun remove-text-properties (start end props &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ; "Remove the given properties from all characters in the specified region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;PROPS should be a plist, but the values in that plist are ignored (treated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;as nil.) Returns t if any property was changed, nil otherwise."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ; (let ((changed nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ; (while props
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ; (setq changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ; (or (put-text-property-1 start end (car props) nil buffer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ; changed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ; (setq props (cdr (cdr props))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ; changed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (defun set-text-properties (start end props &optional buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 "You should NEVER use this function. It is ideologically blasphemous.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 It is provided only to ease porting of broken FSF Emacs programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 Completely replace properties of text from START to END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 The third argument PROPS is the new property list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 The optional fourth argument, BUFFER-OR-STRING,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 is the string or buffer containing the text."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (map-extents #'(lambda (extent ignored)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (remove-text-properties start end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (list (extent-property extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 'text-prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 buffer-or-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 buffer-or-string start end nil nil 'text-prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (add-text-properties start end props buffer-or-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;;; The following functions can probably stay in lisp, since they're so simple.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;(defun get-text-property (pos prop &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ; "Returns the value of the PROP property at the given position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ; (let ((e (extent-at pos buffer prop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ; (if e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ; (extent-property e prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 ; nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (defun extent-properties-at-1 (position buffer-or-string text-props-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (let ((extent nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (props nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 new-props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (while (setq extent (extent-at position buffer-or-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (if text-props-only 'text-prop nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (if text-props-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;; Only return the one prop which the `text-prop' property points at.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (let ((prop (extent-property extent 'text-prop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (setq new-props (list prop (extent-property extent prop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; Return all the properties...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (setq new-props (extent-properties extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ;; ...but! Don't return the `begin-glyph' or `end-glyph' properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ;; unless the position is exactly at the appropriate endpoint. Yeah,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;; this is kind of a kludge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; #### Bug, this doesn't work for end-glyphs (on end-open extents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; because we've already passed the extent with the glyph by the time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; it's appropriate to return the glyph. We could return the end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; glyph one character early I guess... But then next-property-change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ;; would have to stop one character early as well. It could back up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; when it hit an end-glyph...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; #### Another bug, if there are multiple glyphs at the same position,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;; we only see the first one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (cond ((or (extent-begin-glyph extent) (extent-end-glyph extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (if (/= position (if (extent-property extent 'begin-glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (extent-start-position extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (extent-end-position extent)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (let ((rest new-props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (while rest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (cond ((or (eq (car rest) 'begin-glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (eq (car rest) 'end-glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (if prev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (setcdr prev (cdr (cdr rest)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq new-props (cdr (cdr new-props))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (setq rest nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (setq prev rest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 rest (cdr rest))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (cond ((null props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (setq props new-props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (while new-props
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (or (getf props (car new-props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (setq props (cons (car new-props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (cons (car (cdr new-props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 props))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (setq new-props (cdr (cdr new-props)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun extent-properties-at (position &optional object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Returns the properties of the character at the given position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 in OBJECT (a string or buffer) by merging the properties of overlapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 extents. The returned value is a property list, some of which may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 shared with other structures. You must not modify it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 If POSITION is at the end of OBJECT, the value is nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 This returns all properties on all extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 See also `text-properties-at'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (extent-properties-at-1 position object nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (defun text-properties-at (position &optional object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 "Returns the properties of the character at the given position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 in OBJECT (a string or buffer) by merging the properties of overlapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 extents. The returned value is a property list, some of which may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 shared with other structures. You must not modify it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 If POSITION is at the end of OBJECT, the value is nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 This returns only those properties added with `put-text-property'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 See also `extent-properties-at'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (extent-properties-at-1 position object t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (defun text-property-any (start end prop value &optional buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 "Check text from START to END to see if PROP is ever `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 If so, return the position of the first character whose PROP is `eq'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 to VALUE. Otherwise return nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 The optional fifth argument, BUFFER-OR-STRING, is the buffer or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 containing the text and defaults to the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (while (and start (< start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (not (eq value (get-text-property start prop buffer-or-string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (setq start (next-single-property-change start prop buffer-or-string end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; we have to insert a special check for end due to the illogical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;; definition of next-single-property-change (blame FSF for this).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (if (eq start end) nil start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (defun text-property-not-all (start end prop value &optional buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 "Check text from START to END to see if PROP is ever not `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 If so, return the position of the first character whose PROP is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 `eq' to VALUE. Otherwise, return nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 The optional fifth argument, BUFFER-OR-STRING, is the buffer or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 containing the text and defaults to the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (if (not (eq value (get-text-property start prop buffer-or-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (let ((retval (next-single-property-change start prop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 buffer-or-string end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;; we have to insert a special check for end due to the illogical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;; definition of previous-single-property-change (blame FSF for this).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (if (eq retval end) nil retval))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;; Older versions that only work sometimes (when VALUE is non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ;; for text-property-any, and maybe only when VALUE is nil for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; text-property-not-all). They might be faster in those cases,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ;; but that's not obvious.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 ;(defun text-property-any (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ; "Check text from START to END to see if PROP is ever `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 ;If so, return the position of the first character whose PROP is `eq'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 ;to VALUE. Otherwise return nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ; ;; #### what should (text-property-any x y 'foo nil) return when there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ; ;; is no foo property between x and y? Either t or nil seems sensible,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ; ;; since a character with a property of nil is indistinguishable from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 ; ;; a character without that property set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ; (map-extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 ; #'(lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 ; (if (eq value (extent-property e prop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 ; ;; return non-nil to stop mapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ; (max start (extent-start-position e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ; nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 ; nil start end buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 ;(defun text-property-not-all (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 ; "Check text from START to END to see if PROP is ever not `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 ;If so, return the position of the first character whose PROP is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 ;`eq' to VALUE. Otherwise, return nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ; (let (maxend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ; (map-extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 ; #'(lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ; ;;### no, actually, this is harder. We need to collect all props
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ; ;; for a given character, and then determine whether no extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 ; ;; contributes the given value. Doing this without consing lots
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ; ;; of lists is the tricky part.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ; (if (eq value (extent-property e prop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ; (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ; (setq maxend (extent-end-position e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ; nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ; (max start maxend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ; nil start end buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (defun next-property-change (pos &optional buffer-or-string limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 "Return the position of next property change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 Scans forward from POS in BUFFER-OR-STRING (defaults to the current buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 until it finds a change in some text property, then returns the position of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 the change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 Returns nil if the properties remain unchanged all the way to the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 If the value is non-nil, it is a position greater than POS, never equal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 If the optional third argument LIMIT is non-nil, don't search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 past position LIMIT; return LIMIT if nothing is found before LIMIT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 If two or more extents with conflicting non-nil values for a property overlap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 a particular character, it is undefined which value is considered to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 the value of the property. (Note that this situation will not happen if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 you always use the text-property primitives.)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (let ((limit-was-nil (null limit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (or limit (setq limit (if (bufferp buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (point-max buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (length buffer-or-string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (let ((value (extent-properties-at pos buffer-or-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (and (< (setq pos (next-extent-change pos buffer-or-string)) limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (plists-eq value (extent-properties-at pos buffer-or-string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (if (< pos limit) pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (if limit-was-nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 limit))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (defun previous-property-change (pos &optional buffer-or-string limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 "Return the position of previous property change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 Scans backward from POS in BUFFER-OR-STRING (defaults to the current buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 until it finds a change in some text property, then returns the position of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 the change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 Returns nil if the properties remain unchanged all the way to the beginning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 If the value is non-nil, it is a position less than POS, never equal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 If the optional third argument LIMIT is non-nil, don't search back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 past position LIMIT; return LIMIT if nothing is found until LIMIT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 If two or more extents with conflicting non-nil values for a property overlap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 a particular character, it is undefined which value is considered to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 the value of the property. (Note that this situation will not happen if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 you always use the text-property primitives.)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (let ((limit-was-nil (null limit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (or limit (setq limit (if (bufferp buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (point-min buffer-or-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (let ((value (extent-properties-at (1- pos) buffer-or-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (and (> (setq pos (previous-extent-change pos buffer-or-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (plists-eq value (extent-properties-at (1- pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 buffer-or-string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (if (> pos limit) pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (if limit-was-nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 limit))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (defun text-property-bounds (pos prop &optional object at-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 "Return the bounds of property PROP at POS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 This returns a cons (START . END) of the largest region of text containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 POS which has a non-nil value for PROP. The return value is nil if POS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 does not have a non-nil value for PROP. OBJECT specifies the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 or string to search in. Optional arg AT-FLAG controls what \"at POS\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 means, and has the same meaning as for `extent-at'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (or object (setq object (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (and (get-char-property pos prop object at-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (let ((begin (if (stringp object) 0 (point-min object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (end (if (stringp object) (length object) (point-max object))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (cons (previous-single-property-change (1+ pos) prop object begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (next-single-property-change pos prop object end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defun next-text-property-bounds (count pos prop &optional object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 "Return the COUNTth bounded property region of property PROP after POS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 If COUNT is less than zero, search backwards. This returns a cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 \(START . END) of the COUNTth maximal region of text that begins after POS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 \(starts before POS) and has a non-nil value for PROP. If there aren't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 that many regions, nil is returned. OBJECT specifies the buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 string to search in."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (or object (setq object (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (let ((begin (if (stringp object) 0 (point-min object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (end (if (stringp object) (length object) (point-max object))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (catch 'hit-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (if (> count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (while (> count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (if (>= pos end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (throw 'hit-end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (and (get-char-property pos prop object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (setq pos (next-single-property-change pos prop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 object end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (setq pos (next-single-property-change pos prop object end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (setq count (1- count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (and (< pos end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (cons pos (next-single-property-change pos prop object end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (while (< count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (if (<= pos begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (throw 'hit-end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (and (get-char-property (1- pos) prop object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (setq pos (previous-single-property-change pos prop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 object begin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (setq pos (previous-single-property-change pos prop object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 begin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (setq count (1+ count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (and (> pos begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (cons (previous-single-property-change pos prop object begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 pos))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;(defun detach-all-extents (&optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ; (map-extents #'(lambda (x i) (detach-extent x) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ; buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (provide 'text-props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;;; text-props.el ends here