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

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

RE: [h-e-w] Re: way for jumping between next/previous highlightedpositi


From: Pang.Ding-Hai
Subject: RE: [h-e-w] Re: way for jumping between next/previous highlightedpositions
Date: Wed, 12 Jul 2006 09:02:12 +0800

Thanks a lot! I will try it.
genvia

-----Original Message-----
From: address@hidden [mailto:address@hidden Behalf Of Mathias Dahl
Sent: Tuesday, July 11, 2006 21:22
To: address@hidden
Subject: [h-e-w] Re: way for jumping between next/previous highlightedpositions


"lalit mohan tripathi" <address@hidden> writes:

>      i am very new to emacs. I use hi-lock-mode to highlight some words
>      in a big buffer, How can i directly jump to next/previous
>      highlighted position other than scrolling buffer?
>      thanks in advance.
>      genvia

What about something like this:

(defun hi-lock-goto-next-highlight ()
  "Go to char where next hilight is.
Search for the next property change where the `hi-lock-overlay'
property is set."
  (interactive)
  (let (found next overlays)
    (while (and (not (eobp))
                (not found))
      (setq next (next-overlay-change (point)))
      (when (not (eq next (point-max)))
        (setq overlays (overlays-at next))
        (if (and overlays (not found))
            (if (not (overlay-get (car overlays) 'hi-lock-overlay))
                (setq overlays (cdr overlays))
              (goto-char next)
              (setq found t))
          (forward-char 1))))))

I seldom use hi-lock so I was surprised to find that no such command
already existed. Or does it?

/Mathias







reply via email to

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