* RE: thingatpt
2008-02-29 2:00 thingatpt Xavier Maillard
2008-02-29 3:29 ` thingatpt Bastien Guerry
@ 2008-02-29 3:57 ` Drew Adams
2008-02-29 7:20 ` thingatpt Andreas Röhler
2 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2008-02-29 3:57 UTC (permalink / raw)
To: 'Xavier Maillard', help-gnu-emacs
> I am trying to find out how to extend thing at point for a
> personnal need.
>
> I have several items that are composed of a series of numbers (10
> to be precise), these items represents transaction's IDs. I want
> GNU Emacs to recognise them as this so that I can do specialised
> actions on them. All is ready *but* I do not know how to define a
> "thing" with thingatpt.el.
>
> 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 ?
A basic idea of thingatpt is that you can just define a function that moves
forward across your thing. If you call your thing, say, transids, then you
would define a function `forward-transids'. That's all.
You can alternatively put one or more of these properties on a symbol that
names your thing, `transids': beginning-op, end-op,
bounds-of-thing-at-point, thing-at-point. The property values are functions
that determine the beginning, end, beginning and end of such a thing, or the
entire thing itself.
thingatpt.el has several examples of defining types of things: url (via
properties end-op, beginning-op, thing-at-point, and
bounds-of-thing-at-point), whitespace (via function forward-whitespace),
buffer (via properties end-op and beginning-op), symbol (via function
forward-symbol), and so on.
You can also use the function thing-at-point to define things. See the
examples of word-at-point and sentence-at-point. You can, similarly, use
function form-at-point to do the same thing - see examples number-at-point
and list-at-point.
Library thingatpt+.el has additional examples of defining things:
http://www.emacswiki.org/cgi-bin/wiki/thingatpt%2b.el
http://www.emacswiki.org/cgi-bin/wiki/ThingAtPointPlus
For more info (start here):
http://www.emacswiki.org/cgi-bin/wiki/ThingAtPoint
HTH.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: thingatpt
2008-02-29 2:00 thingatpt Xavier Maillard
2008-02-29 3:29 ` thingatpt Bastien Guerry
2008-02-29 3:57 ` thingatpt Drew Adams
@ 2008-02-29 7:20 ` Andreas Röhler
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Röhler @ 2008-02-29 7:20 UTC (permalink / raw)
To: Xavier Maillard; +Cc: help-gnu-emacs
Am Freitag, 29. Februar 2008 03:00 schrieb Xavier Maillard:
> Hi,
>
> I am trying to find out how to extend thing at point for a
> personnal need.
>
> I have several items that are composed of a series of numbers (10
> to be precise), these items represents transaction's IDs. I want
> GNU Emacs to recognise them as this so that I can do specialised
> actions on them. All is ready *but* I do not know how to define a
> "thing" with thingatpt.el.
>
> 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 ?
>
> Regards,
>
> Xavier
thingatpt-utils 1.9
published at
http://lists.gnu.org/archive/html/gnu-emacs-sources/2008-02/msg00000.html
provides number-atpt, forward- backward-, bounds-of etc.
All things there you may quote, doublequote, trim etc.
Should you need to select a certain range of numbers
only, I could implement that.
Andreas Röhler
^ permalink raw reply [flat|nested] 4+ messages in thread