Commits

aidan  committed cec30e5

This is Steve Youngs change of microsoft-free.87vf7z6dqk.fsf@youngs.au.com ,
moving re-builder to using extents, and fixing a bug related to
reb-color-display-p.

  • Participants
  • Parent commits 8e38f89

Comments (0)

Files changed (3)

+2005-03-10  Steve Youngs  <steve@sxemacs.org>
+
+	* Makefile (REQUIRES): Remove fsf-compat.  This package uses
+	extents natively now.
+
+	* re-builder.el: Set up better extent/overlay compatibility. 
+	(reb-delete-overlays): Use it here.
+	(reb-update-overlays): Ditto.
+
+	(reb-color-display-p): Call `device-class' in
+	XEmacs so this function will DTRT in XEmacs.
+
 2005-03-09  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.01 released.
 MAINTAINER = Aidan Kehoe <aidan@xemacs.org>
 PACKAGE = re-builder
 PKG_TYPE = regular
-REQUIRES = fsf-compat
+REQUIRES = 
 CATEGORY = standard
 STANDARD_DOCS = t
 

File re-builder.el

 
 ;;; Code:
 
-;; On XEmacs, load the overlay compatibility library
-(if (not (fboundp 'make-overlay))
-    (require 'overlay))
+;; Extent/overlay compatibility
+(if (featurep 'xemacs)
+    ;; (S)XEmacs
+    (progn
+      (defalias 'reb-delete-overlay 'delete-extent)
+      (defalias 'reb-make-overlay 'make-extent)
+      (defalias 'reb-overlay-put 'set-extent-property))
+  ;; GNU/Emacs
+  (defalias 'reb-delete-overlay 'delete-overlay)
+  (defalias 'reb-make-overlay 'make-overlay)
+  (defalias 'reb-overlay-put 'overlay-put))
 
 ;; User costomizable variables
 (defgroup re-builder nil
       ;; emacs/xemacs compatibility
       (if (fboundp 'frame-parameter)
 	  (frame-parameter (selected-frame) 'display-type)
-	(frame-property (selected-frame) 'display-type))))
+	(device-class (frame-device (selected-frame))))))
 
 (defsubst reb-lisp-syntax-p ()
   "Return non-nil if RE Builder uses a Lisp syntax."
   "Delete all RE Builder overlays in the `reb-target-buffer' buffer."
   (if (buffer-live-p reb-target-buffer)
     (with-current-buffer reb-target-buffer
-      (mapcar 'delete-overlay reb-overlays)
+      (mapcar 'reb-delete-overlay reb-overlays)
       (setq reb-overlays nil))))
 
 (defun reb-assert-buffer-in-window ()
 		  (or (not reb-auto-match-limit)
 		      (< matches reb-auto-match-limit)))
 	(if (= 0 (length (match-string 0)))
-	  (error "Empty regular expression!"))
+	    (error "Empty regular expression!"))
 	(let ((i 0))
 	  (setq matches (1+ matches))
 	  (while (<= i subexps)
 	    (if (and (or (not subexp) (= subexp i))
 		     (match-beginning i))
-		(let ((overlay (make-overlay (match-beginning i)
-					     (match-end i)))
+		(let ((overlay (reb-make-overlay (match-beginning i)
+						 (match-end i)))
 		      (face-name (format "reb-match-%d" i)))
 		  (if (not firstmatch)
 		      (setq firstmatch (match-data)))
 		  (setq reb-overlays (cons overlay reb-overlays)
 			submatches (1+ submatches))
-		  (overlay-put
+		  (reb-overlay-put
 		   overlay 'face
 		   (or (intern-soft face-name)
 		       (error "Too many subexpressions - face `%s' not defined"
 			      face-name )))
-		  (overlay-put overlay 'priority i)))
+		  (reb-overlay-put overlay 'priority i)))
 	    (setq i (1+ i))))))
     (let ((count (if subexp submatches matches)))
       (message "%s %smatch%s%s"