annotate lisp/utils/text-props.el @ 38:1a767b41a199 r19-15b102

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