From xemacs-m  Tue Mar 11 18:47:29 1997
Received: from jens.metrix.de (jens@jens.metrix.de [194.123.88.124])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id SAA28443
	for <xemacs-beta@xemacs.org>; Tue, 11 Mar 1997 18:47:26 -0600 (CST)
Received: (from jens@localhost) by jens.metrix.de (8.7.6/8.7.3) id BAA00808; Wed, 12 Mar 1997 01:46:55 +0100
To: xemacs-beta@xemacs.org
Subject: Re: RFE extent properties
References: <199703112133.QAA12318@anthem.CNRI.Reston.Va.US>
X-Face: Z[@OB)("ZvE?ev~1b+b!0ZUB.$%rh.9qE>dVf>q}Q/V?%d`J3gd!LR\aAZ8<Hwi]xTA(:*c;i3,?K?+rCy*^b$)a,}E?eo},}x2]5LlJysyoUOK"o[>K)'\Ulb7y-7*.If^;rHl['oa)n_M7E6w+LDKMs"G8_`c)uOS1^}.1|8Ill]7X68X-paeUOpBhz<F`B0?~^2Et~GYfw~/0]H]nx4~C_E/_mp#^7Ixc:
Reply-To: jens@lemming0.lem.uni-karlsruhe.de
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Mar_12_01:46:50_1997-1"
Content-Transfer-Encoding: 7bit
From: Jens Lautenbacher <jens@metrix.de>
Date: 12 Mar 1997 01:46:50 +0100
In-Reply-To: "Barry A. Warsaw"'s message of Tue, 11 Mar 1997 16:33:04 -0500
Message-ID: <m367yylyx1.fsf@jens.metrix.de>
Lines: 99
X-Mailer: Gnus v5.4.24/XEmacs 19.15

--Multipart_Wed_Mar_12_01:46:50_1997-1
Content-Type: text/plain; charset=US-ASCII

"Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US> writes:

> I've been playing with some new ideas for Supercite 4, and I find
> myself wanting a few things from extent-properties that currently
> aren't supported (at least C-h f set-extent-property doesn't
> indicate), but *shouldn't* be to hard to add, if y'all think these are
> good ideas.
> 
> 1. I want an extent with 'mouse-face property to also highlight when
>    point is within the extent.  This would help those of us who are
>    really keyboard based and don't like using the mouse.  Right now,
>    if an extent has 'mouse-face set, the extent highlights when the
>    mouse is inside the extent.  But there's no way using keyboard
>    traversal to know that this is a sensitive extent.  I'd be happy if
>    there was a 'point-face property also that gives me this, but I
>    think both behaviors would fit nicely on one extent property.
> 
> 2. I'd like to be able to run a lisp function on entering or leaving
>    an extent, either with the mouse, or with point.  As an extension
>    to the above idea, I might want to print a message to the echo area
>    (e.g. a sort of echo help) when an extent gets highlighted.  I'm
>    thinking something along the lines of 'extent-enter-function and
>    'extent-leave-function properties.
> 
> Any thoughts?  I don't know that I can (or should) do the work before
> 19.15 goes out, so it would be fine if these were held off until the
> 20.x merge.  Of course, if they're trivial to add... :-)
> 
> -Barry


Actually quite easy...
Try this:


--Multipart_Wed_Mar_12_01:46:50_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="ext-answ"
Content-Transfer-Encoding: 7bit


(setq dispatch-extent-old-extent nil)

(defun dispatch-extent-enter-leave ()
  (let (ext tmp)
    (if (equal (setq ext (extent-at (point)))
	       dispatch-extent-old-extent)
	nil
      (if (and dispatch-extent-old-extent
	       (setq tmp (extent-property
			  dispatch-extent-old-extent 'leave-extent-func)))
	  (eval tmp))
      (if (and ext (setq tmp (extent-property
			      ext  'enter-extent-func)))
	  (eval tmp))
      (setq dispatch-extent-old-extent ext))))

(add-hook 'post-command-hook 'dispatch-extent-enter-leave)

(progn
  (insert-string "\n\n-------------\n")
  (setq pos (point))
  (insert-string "blablablablablabl\n")
  (insert-string "-------------\n")
  (goto-char pos)
  (setq ext1 (make-extent (save-excursion
			    (beginning-of-line)
			    (point))
			  (save-excursion
			    (end-of-line)
			    (point))))
  (set-extent-property ext1 'mouse-face 'bold)
  (set-extent-property ext1 'enter-extent-func
		       '(message "Entering..."))
  (set-extent-property ext1 'leave-extent-func
		       '(message "Leaving..."))
  (setq keym (make-sparse-keymap))
  (define-key keym '(button1) '(lambda ()
			  (interactive)
			   (message "Hallo")))
  (set-extent-property ext1 'keymap keym)
  )



--Multipart_Wed_Mar_12_01:46:50_1997-1
Content-Type: text/plain; charset=US-ASCII


Hope this helps (of course it's just a quick hack)

     JTL



--Multipart_Wed_Mar_12_01:46:50_1997-1--

