changeset 10596:3cda29fdf5f6

(make-extent, delete-extent, set-extent-property) (set-extent-face): New functions.
author Richard M. Stallman <rms@gnu.org>
date Mon, 30 Jan 1995 07:16:14 +0000
parents 06fa5b312280
children b357342180c2
files lisp/emacs-lisp/lucid.el
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lucid.el	Mon Jan 30 06:14:33 1995 +0000
+++ b/lisp/emacs-lisp/lucid.el	Mon Jan 30 07:16:14 1995 +0000
@@ -152,6 +152,38 @@
 (defalias 'get-face 'internal-get-face)
 (defalias 'try-face-font 'internal-try-face-font)
 
+(defun make-extent (beg end &optional buffer)
+  (make-overlay beg end buffer))
+
+(defun set-extent-property (extent prop value)
+  (if (eq prop 'duplicable)
+      (cond ((and value (not (overlay-get extent prop)))
+	     ;; If becoming duplicable, copy all overlayprops to text props.
+	     (add-text-properties (overlay-start extent)
+				  (overlay-end extent)
+				  (overlay-properties extent)
+				  (overlay-buffer extent)))
+	    ;; If becoming no longer duplicable, remove these text props.
+	    ((and (not value) (overlay-get extent prop))
+	     (remove-text-properties (overlay-start extent)
+				     (overlay-end extent)
+				     (overlay-properties extent)
+				     (overlay-buffer extent))))
+    ;; If extent is already duplicable, put this property
+    ;; on the text as well as on the overlay.
+    (if (overlay-get extent 'duplicable)
+	(put-text-property  (overlay-start extent)
+			    (overlay-end extent)
+			    prop value (overlay-buffer extent))))
+  (overlay-put extent prop value))
+
+(defun set-extent-face (extent face)
+  (set-extent-property extent 'face face))
+
+(defun delete-extent (extent)
+  (set-extent-property extent 'duplicable nil)
+  (delete-overlay extent))
+
 ;; Support the Lucid names with `screen' instead of `frame'.
 
 (defalias 'current-screen-configuration 'current-frame-configuration)