[Top][All Lists]

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

Re: thingatpt

From: Bastien Guerry
Subject: Re: thingatpt
Date: Fri, 29 Feb 2008 03:29:23 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Xavier Maillard <address@hidden> writes:

> I am trying to find out how to extend thing at point for a
> personnal need.

I'm not sure you need thingatpt.  

> On the same topic, I can have several transaction IDs on the same
> line, for exmple:
> 1234567890 0123456789 etc.
> I'd like to be able to navigate to the next/previous item using
> the TAB key, how would you do that ?

I would use something like this:

(defvar my-mouse-map (make-sparse-keymap))

(define-key my-mouse-map [(tab)] 'my-goto-next-active-string)

(defun my-goto-next-active-string ()
  (let ((pos (point)))
    (re-search-forward "\\<[0-9]\\{10\\}\\>" nil t)
    (if (and (eq (match-beginning 0) pos)
             (re-search-forward "\\<[0-9]\\{10\\}\\>" nil t))
        (goto-char (match-beginning 0))
      (goto-char pos))))

(defun my-make-active-strings ()
    (goto-char (point-min))
    (while (re-search-forward "\\<[0-9]\\{10\\}\\>" nil t)
      (add-text-properties (match-beginning 0) (match-end 0)
                           (list 'mouse-face 'highlight
                                 'rear-nonsticky t
                                 'keymap my-mouse-map)))))

You can also use `next-single-property-change' instead of the regexp 
in my-goto-next-active-string.  Hope this gives you directions.


reply via email to

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