comparison src/buffer.c @ 9922:f653d8aac66a

(Fmake_overlay, Foverlay_properties, Foverlay_get, Foverlay_put): Use new overlay substructure. (list_buffers_1): Use PT, not point.
author Karl Heuer <kwzh@gnu.org>
date Tue, 15 Nov 1994 02:02:34 +0000
parents 6cd89eaf36c9
children d3f22955b872
comparison
equal deleted inserted replaced
9921:62392796a691 9922:f653d8aac66a
1165 /* Optionally don't mention buffers that lack files. */ 1165 /* Optionally don't mention buffers that lack files. */
1166 if (!NILP (files) && NILP (b->filename)) 1166 if (!NILP (files) && NILP (b->filename))
1167 continue; 1167 continue;
1168 /* Identify the current buffer. */ 1168 /* Identify the current buffer. */
1169 if (b == old) 1169 if (b == old)
1170 XSETFASTINT (desired_point, point); 1170 XSETFASTINT (desired_point, PT);
1171 write_string (b == old ? "." : " ", -1); 1171 write_string (b == old ? "." : " ", -1);
1172 /* Identify modified buffers */ 1172 /* Identify modified buffers */
1173 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1); 1173 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1);
1174 /* The current buffer is special-cased to be marked read-only. 1174 /* The current buffer is special-cased to be marked read-only.
1175 It is actually made read-only by the call to 1175 It is actually made read-only by the call to
1365 tail = XCONS (tail)->cdr) 1365 tail = XCONS (tail)->cdr)
1366 { 1366 {
1367 int startpos, endpos; 1367 int startpos, endpos;
1368 1368
1369 overlay = XCONS (tail)->car; 1369 overlay = XCONS (tail)->car;
1370 if (XGCTYPE (overlay) != Lisp_Overlay)
1371 abort ();
1372 1370
1373 start = OVERLAY_START (overlay); 1371 start = OVERLAY_START (overlay);
1374 end = OVERLAY_END (overlay); 1372 end = OVERLAY_END (overlay);
1375 endpos = OVERLAY_POSITION (end); 1373 endpos = OVERLAY_POSITION (end);
1376 if (endpos < pos) 1374 if (endpos < pos)
1412 tail = XCONS (tail)->cdr) 1410 tail = XCONS (tail)->cdr)
1413 { 1411 {
1414 int startpos, endpos; 1412 int startpos, endpos;
1415 1413
1416 overlay = XCONS (tail)->car; 1414 overlay = XCONS (tail)->car;
1417 if (XGCTYPE (overlay) != Lisp_Overlay)
1418 abort ();
1419 1415
1420 start = OVERLAY_START (overlay); 1416 start = OVERLAY_START (overlay);
1421 end = OVERLAY_END (overlay); 1417 end = OVERLAY_END (overlay);
1422 startpos = OVERLAY_POSITION (start); 1418 startpos = OVERLAY_POSITION (start);
1423 if (pos < startpos) 1419 if (pos < startpos)
1842 b = XBUFFER (buffer); 1838 b = XBUFFER (buffer);
1843 1839
1844 beg = Fset_marker (Fmake_marker (), beg, buffer); 1840 beg = Fset_marker (Fmake_marker (), beg, buffer);
1845 end = Fset_marker (Fmake_marker (), end, buffer); 1841 end = Fset_marker (Fmake_marker (), end, buffer);
1846 1842
1847 overlay = Fcons (Fcons (beg, end), Qnil); 1843 overlay = allocate_misc ();
1848 XSETTYPE (overlay, Lisp_Overlay); 1844 XMISC (overlay)->type = Lisp_Misc_Overlay;
1845 XOVERLAY (overlay)->start = beg;
1846 XOVERLAY (overlay)->end = end;
1847 XOVERLAY (overlay)->plist = Qnil;
1849 1848
1850 /* Put the new overlay on the wrong list. */ 1849 /* Put the new overlay on the wrong list. */
1851 end = OVERLAY_END (overlay); 1850 end = OVERLAY_END (overlay);
1852 if (OVERLAY_POSITION (end) < XINT (b->overlay_center)) 1851 if (OVERLAY_POSITION (end) < XINT (b->overlay_center))
1853 b->overlays_after = Fcons (overlay, b->overlays_after); 1852 b->overlays_after = Fcons (overlay, b->overlays_after);
2047 (overlay) 2046 (overlay)
2048 Lisp_Object overlay; 2047 Lisp_Object overlay;
2049 { 2048 {
2050 CHECK_OVERLAY (overlay, 0); 2049 CHECK_OVERLAY (overlay, 0);
2051 2050
2052 return Fcopy_sequence (Fcdr_safe (XCONS (overlay)->cdr)); 2051 return Fcopy_sequence (XOVERLAY (overlay)->plist);
2053 } 2052 }
2054 2053
2055 2054
2056 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, 2055 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
2057 "Return a list of the overlays that contain position POS.") 2056 "Return a list of the overlays that contain position POS.")
2201 2200
2202 CHECK_OVERLAY (overlay, 0); 2201 CHECK_OVERLAY (overlay, 0);
2203 2202
2204 fallback = Qnil; 2203 fallback = Qnil;
2205 2204
2206 for (plist = Fcdr_safe (XCONS (overlay)->cdr); 2205 for (plist = XOVERLAY (overlay)->plist;
2207 CONSP (plist) && CONSP (XCONS (plist)->cdr); 2206 CONSP (plist) && CONSP (XCONS (plist)->cdr);
2208 plist = XCONS (XCONS (plist)->cdr)->cdr) 2207 plist = XCONS (XCONS (plist)->cdr)->cdr)
2209 { 2208 {
2210 if (EQ (XCONS (plist)->car, prop)) 2209 if (EQ (XCONS (plist)->car, prop))
2211 return XCONS (XCONS (plist)->cdr)->car; 2210 return XCONS (XCONS (plist)->cdr)->car;
2224 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, 2223 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
2225 "Set one property of overlay OVERLAY: give property PROP value VALUE.") 2224 "Set one property of overlay OVERLAY: give property PROP value VALUE.")
2226 (overlay, prop, value) 2225 (overlay, prop, value)
2227 Lisp_Object overlay, prop, value; 2226 Lisp_Object overlay, prop, value;
2228 { 2227 {
2229 Lisp_Object plist, tail, buffer; 2228 Lisp_Object tail, buffer;
2230 int changed; 2229 int changed;
2231 2230
2232 CHECK_OVERLAY (overlay, 0); 2231 CHECK_OVERLAY (overlay, 0);
2233 2232
2234 buffer = Fmarker_buffer (OVERLAY_START (overlay)); 2233 buffer = Fmarker_buffer (OVERLAY_START (overlay));
2235 2234
2236 plist = Fcdr_safe (XCONS (overlay)->cdr); 2235 for (tail = XOVERLAY (overlay)->plist;
2237
2238 for (tail = plist;
2239 CONSP (tail) && CONSP (XCONS (tail)->cdr); 2236 CONSP (tail) && CONSP (XCONS (tail)->cdr);
2240 tail = XCONS (XCONS (tail)->cdr)->cdr) 2237 tail = XCONS (XCONS (tail)->cdr)->cdr)
2241 if (EQ (XCONS (tail)->car, prop)) 2238 if (EQ (XCONS (tail)->car, prop))
2242 { 2239 {
2243 changed = !EQ (XCONS (XCONS (tail)->cdr)->car, value); 2240 changed = !EQ (XCONS (XCONS (tail)->cdr)->car, value);
2244 XCONS (XCONS (tail)->cdr)->car = value; 2241 XCONS (XCONS (tail)->cdr)->car = value;
2245 goto found; 2242 goto found;
2246 } 2243 }
2247 /* It wasn't in the list, so add it to the front. */ 2244 /* It wasn't in the list, so add it to the front. */
2248 changed = !NILP (value); 2245 changed = !NILP (value);
2249 if (! CONSP (XCONS (overlay)->cdr)) 2246 XOVERLAY (overlay)->plist
2250 XCONS (overlay)->cdr = Fcons (Qnil, Qnil); 2247 = Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist));
2251 XCONS (XCONS (overlay)->cdr)->cdr = Fcons (prop, Fcons (value, plist));
2252 found: 2248 found:
2253 if (! NILP (buffer)) 2249 if (! NILP (buffer))
2254 { 2250 {
2255 if (changed) 2251 if (changed)
2256 redisplay_region (XBUFFER (buffer), 2252 redisplay_region (XBUFFER (buffer),