Paul,
Attached you will find another patch to semantic-util.el (I just copied
new [not yet released] Semantic implementation of token highlighting
functions). This patch fixes the overlay problem which goes back when
using `semantic-momentary-highlight-token'.
I hope Semantic overlays will work well now :-)
Sincerely,
David
*** semantic-util.el.ori Sat Nov 18 15:18:38 2000
--- semantic-util.el Mon Feb 12 18:06:51 2001
***************
*** 852,873 ****
"Specify that TOKEN should be highlighted.
Optional FACE specifies the face to use."
(let ((o (semantic-token-overlay token)))
! (semantic-overlay-put o 'old-face (semantic-overlay-get o 'face))
! (semantic-overlay-put o 'face (or face 'highlight))))
(defun semantic-unhighlight-token (token)
"Unhighlight TOKEN, restoring it's previous face."
(let ((o (semantic-token-overlay token)))
! (semantic-overlay-put o 'face (semantic-overlay-get o 'old-face))
! (semantic-overlay-put o 'old-face nil))
(remove-hook 'pre-command-hook
! `(lambda () (semantic-unhighlight-token `,token))))
! (defun semantic-momentary-highlight-token (token)
! "Highlight TOKEN, removing highlighting when the user hits a key."
! (semantic-highlight-token token)
(add-hook 'pre-command-hook
! `(lambda () (semantic-unhighlight-token ',token))))
(defun semantic-set-token-face (token face)
"Specify that TOKEN should use FACE for display."
--- 852,883 ----
"Specify that TOKEN should be highlighted.
Optional FACE specifies the face to use."
(let ((o (semantic-token-overlay token)))
! (semantic-overlay-put o 'old-face
! (cons (semantic-overlay-get o 'face)
! (semantic-overlay-get o 'old-face)))
! (semantic-overlay-put o 'face (or face 'highlight))
! ))
(defun semantic-unhighlight-token (token)
"Unhighlight TOKEN, restoring it's previous face."
(let ((o (semantic-token-overlay token)))
! (semantic-overlay-put o 'face (car (semantic-overlay-get o 'old-face)))
! (semantic-overlay-put o 'old-face (cdr (semantic-overlay-get o 'old-face)))
! ))
!
! (defun semantic-momentary-unhighlight-token (token)
! "Unhighlight TOKEN, restoring it's previous face."
! (semantic-unhighlight-token token)
(remove-hook 'pre-command-hook
! `(lambda () (semantic-momentary-unhighlight-token ',token))))
! (defun semantic-momentary-highlight-token (token &optional face)
! "Highlight TOKEN, removing highlighting when the user hits a key.
! Optional argument FACE is the face to use for highlighting.
! If FACE is not specified, then `highlight' will be used."
! (semantic-highlight-token token face)
(add-hook 'pre-command-hook
! `(lambda () (semantic-momentary-unhighlight-token ',token))))
(defun semantic-set-token-face (token face)
"Specify that TOKEN should use FACE for display."