help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overlays and the Priority Property


From: Phil Rooke
Subject: Overlays and the Priority Property
Date: Tue, 22 Jan 2002 22:33:30 +0000

I've been trying to learn some elisp and have been looking at using
overlays.  By way of example I have a simple test function:

(defun test-overlay-priorities ()
  (interactive)
  (switch-to-buffer (get-buffer-create "overlay-test"))
  (insert "This line and the next have a low priority overlay.\n"
          "This line alone has an additional high priority overlay.")
  (setq o (make-overlay (point-min) (point-max)))
  (overlay-put o 'priority 1)
  (overlay-put o 'mouse-face 'highlight)
  (goto-char (point-min))
  (forward-line 1)
  (setq p (point))
  (end-of-line)
  (setq o (make-overlay p (point)))
  (overlay-put o 'priority 1000)
  (overlay-put o 'mouse-face 'secondary-selection))

If I execute this command and bring the mouse up onto the second
text line from below then just the second line is highlighted in my
secondary-selection face as I expect.  If I continue to move the mouse
up to the first line then both lines are highlighted but now in my
highlight face, again as expected.  However, if I then move the mouse
back down onto the second line both lines remain highlighted.  I had
expected the higher priority overlay to take precedence now so that just
the second line was highlighted again.

Have I misunderstood something or done something wrong?

Thanks,

Phil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]